3 This is an Aegis-to-SCons build script that collects a copy of the
4 current SCons into a bootstrap/ subdirectory and then executes it with
5 the supplied command-line options.
7 Right now, it only understands the SCons -Y option, which is the only
8 one currently used. It collects the repositories specified by -Y and
9 searches them, in order, for the pieces of SCons to copy into the local
10 bootstrap/ subdirectory.
12 This is essentially a minimal build of SCons to bootstrap ourselves into
13 executing it for the full build of all the packages, as specified in our
14 local SConstruct file.
19 # Copyright (c) 2001, 2002, 2003 Steven Knight
21 # Permission is hereby granted, free of charge, to any person obtaining
22 # a copy of this software and associated documentation files (the
23 # "Software"), to deal in the Software without restriction, including
24 # without limitation the rights to use, copy, modify, merge, publish,
25 # distribute, sublicense, and/or sell copies of the Software, and to
26 # permit persons to whom the Software is furnished to do so, subject to
27 # the following conditions:
29 # The above copyright notice and this permission notice shall be included
30 # in all copies or substantial portions of the Software.
32 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
33 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
34 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
49 opts, args = getopt.getopt(sys.argv[1:], "Y:", [])
55 def find(file, search=search):
57 f = os.path.join(dir, file)
59 return os.path.normpath(f)
60 sys.stderr.write("could not find `%s' in search path:\n" % file)
61 sys.stderr.write("\t" + string.join(search, "\n\t") + "\n")
64 scons_py = os.path.join('src', 'script', 'scons.py')
65 src_engine = os.path.join('src', 'engine')
66 MANIFEST_in = find(os.path.join(src_engine, 'MANIFEST.in'))
68 files = [ scons_py ] + map(lambda x: os.path.join(src_engine, x[:-1]),
69 open(MANIFEST_in).readlines())
75 dst = os.path.join(subdir, file)
76 dir, _ = os.path.split(dst)
77 if not os.path.isdir(dir):
79 contents = open(src, 'rb').read()
82 open(dst, 'wb').write(contents)
84 args = [ sys.executable, os.path.join(subdir, scons_py) ] + sys.argv[1:]
86 sys.stdout.write(string.join(args, " ") + '\n')
89 os.environ['SCONS_LIB_DIR'] = os.path.join(subdir, src_engine)
91 os.execve(sys.executable, args, os.environ)