From 68140ed63ce1b3dec1929791002e2add008cd5a5 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Mon, 10 Sep 2001 20:30:28 +0000 Subject: [PATCH] Look for SConstruct, Sconstruct, and sconstruct files. git-svn-id: http://scons.tigris.org/svn/scons/trunk@37 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- doc/design/native.sgml | 8 +++++--- doc/man/desc.sgml | 13 +++++++------ doc/man/options.sgml | 12 +++++++----- doc/scons.mod | 2 ++ src/scons.py | 7 +++++-- test/SConstruct.py | 40 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 66 insertions(+), 16 deletions(-) create mode 100644 test/SConstruct.py diff --git a/doc/design/native.sgml b/doc/design/native.sgml index c9fd4bf6..e2a756c6 100644 --- a/doc/design/native.sgml +++ b/doc/design/native.sgml @@ -32,9 +32,11 @@ - By default, the &SCons; utility reads a configuration file named - &SConstruct; in the current directory. A - command-line option exists to read a different file name. + By default, the &SCons; utility searches for a file named + &SConstruct;, &Sconstruct; or &sconstruct (in that order) in the + current directory, and reads its configuration from the first file + found. A command-line option exists to read a + different file name. diff --git a/doc/man/desc.sgml b/doc/man/desc.sgml index da2961ee..75ac82ac 100644 --- a/doc/man/desc.sgml +++ b/doc/man/desc.sgml @@ -14,12 +14,13 @@ - By default, &scons; reads configuration information from the - file named SConstruct in the current - directory. An alternate file name may be specified via the - option. If the alternate file is not in - the local directory, &scons; will internally change its working - directory (chdir) to the directory containing the file. + By default, &scons; searches for a file named &SConstruct;, + &Sconstruct; or &sconstruct (in that order) in the current directory + and reads its configuration from the first file found. An alternate + file name may be specified via the option. If + the specified file is not in the local directory, &scons; will + internally change its working directory (chdir) to the directory + containing the file. diff --git a/doc/man/options.sgml b/doc/man/options.sgml index a231908b..b24c18fa 100644 --- a/doc/man/options.sgml +++ b/doc/man/options.sgml @@ -107,11 +107,13 @@ Change to the specified directory - before reading SConstruct or doing - anything else. Multiple options are - interpreted relative to the previous one. (This is nearly - equivalent to -f directory/SConstruct, - except that it will search for SConstruct, + before searching for the SConstruct, + Sconstruct or + sconstruct file, or doing anything + else. Multiple options are interpreted + relative to the previous one. (This is nearly equivalent + to -f directory/SConstruct, except + that it will search for SConstruct, Sconstruct, or sconstruct in the directory.) diff --git a/doc/scons.mod b/doc/scons.mod index b8a231a0..7e5470e4 100644 --- a/doc/scons.mod +++ b/doc/scons.mod @@ -49,6 +49,8 @@ Makefile"> SConscript"> SConstruct"> +Sconstruct"> +sconstruct"> .consign"> diff --git a/src/scons.py b/src/scons.py index 7f86d152..f624fba5 100644 --- a/src/scons.py +++ b/src/scons.py @@ -448,9 +448,12 @@ def main(): opt_func[opt](opt, arg) if not Scripts: - Scripts.append('SConstruct') + for file in ['SConstruct', 'Sconstruct', 'sconstruct']: + if os.path.isfile(file): + Scripts.append(file) + break - if local_help and not os.path.isfile(Scripts[0]): + if local_help and not Scripts: # They specified -h, but there's no SConstruct. Give them # the options usage before we try to read it and fail. PrintUsage() diff --git a/test/SConstruct.py b/test/SConstruct.py new file mode 100644 index 00000000..b68bed47 --- /dev/null +++ b/test/SConstruct.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python + +__revision__ = "test/SConstruct.py __REVISION__ __DATE__ __DEVELOPER__" + +import TestCmd + +test = TestCmd.TestCmd(program = 'scons.py', + workdir = '', + interpreter = 'python') + +wpath = test.workpath() + +test.write('sconstruct', """ +import os +print "sconstruct", os.getcwd() +""") + +test.run(chdir = '.') + +test.fail_test(test.stdout() != ("sconstruct %s\n" % wpath)) + +test.write('Sconstruct', """ +import os +print "Sconstruct", os.getcwd() +""") + +test.run(chdir = '.') + +test.fail_test(test.stdout() != ("Sconstruct %s\n" % wpath)) + +test.write('SConstruct', """ +import os +print "SConstruct", os.getcwd() +""") + +test.run(chdir = '.') + +test.fail_test(test.stdout() != ("SConstruct %s\n" % wpath)) + +test.pass_test() -- 2.26.2