Anonymous avatar Anonymous committed dcb6bb8

Look for SConstruct, Sconstruct, and sconstruct files.

Comments (0)

Files changed (6)

doc/design/native.sgml

 
  <para>
 
-  By default, the &SCons; utility reads a configuration file named
-  &SConstruct; in the current directory.  A <option>-f</option>
-  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 <option>-f</option> command-line option exists to read a
+  different file name.
 
  </para>
 

doc/man/desc.sgml

 
  <para>
 
-   By default, &scons; reads configuration information from the
-   file named  <filename>SConstruct</filename> in the current
-   directory.  An alternate file name may be specified via the
-    <option>-f</option> 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>-f</option> 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.
 
  </para>
 

doc/man/options.sgml

       <para>
 
         Change to the specified <replaceable>directory</replaceable>
-        before reading <filename>SConstruct</filename> or doing
-        anything else.  Multiple <option>-C</option> options are
-        interpreted relative to the previous one.  (This is nearly
-        equivalent to <literal>-f directory/SConstruct</literal>,
-        except that it will search for <filename>SConstruct</filename>,
+        before searching for the <filename>SConstruct</filename>,
+        <filename>Sconstruct</filename> or
+        <filename>sconstruct</filename> file, or doing anything
+        else.  Multiple <option>-C</option> options are interpreted
+        relative to the previous one.  (This is nearly equivalent
+        to <literal>-f directory/SConstruct</literal>, except
+        that it will search for <filename>SConstruct</filename>,
         <filename>Sconstruct</filename>, or
         <filename>sconstruct</filename> in the directory.)
 
 <!ENTITY Makefile "<filename>Makefile</filename>">
 <!ENTITY SConscript "<filename>SConscript</filename>">
 <!ENTITY SConstruct "<filename>SConstruct</filename>">
+<!ENTITY Sconstruct "<filename>Sconstruct</filename>">
+<!ENTITY sconstruct "<filename>sconstruct</filename>">
 <!ENTITY sconsign "<filename>.consign</filename>">
 
 
 	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()

test/SConstruct.py

+#!/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()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.