2008-02-07 11:24:55 +01:00
|
|
|
#! /usr/bin/env python
|
|
|
|
#
|
|
|
|
# SCons - a Software Constructor
|
|
|
|
#
|
2011-08-31 00:28:24 +02:00
|
|
|
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
|
2008-02-07 11:24:55 +01:00
|
|
|
#
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
# a copy of this software and associated documentation files (the
|
|
|
|
# "Software"), to deal in the Software without restriction, including
|
|
|
|
# without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
# permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
# the following conditions:
|
|
|
|
#
|
|
|
|
# The above copyright notice and this permission notice shall be included
|
|
|
|
# in all copies or substantial portions of the Software.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
|
|
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
|
|
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
#
|
|
|
|
|
2011-08-31 00:28:24 +02:00
|
|
|
__revision__ = "src/script/scons.py 5183 2010/11/25 14:46:21 bdeegan"
|
2008-02-07 11:24:55 +01:00
|
|
|
|
2011-08-31 00:28:24 +02:00
|
|
|
__version__ = "2.1.0.alpha.20101125"
|
2008-02-07 11:24:55 +01:00
|
|
|
|
2011-08-31 00:28:24 +02:00
|
|
|
__build__ = "r5183[MODIFIED]"
|
2008-02-07 11:24:55 +01:00
|
|
|
|
2011-08-31 00:28:24 +02:00
|
|
|
__buildsys__ = "ubuntu"
|
2008-02-07 11:24:55 +01:00
|
|
|
|
2011-08-31 00:28:24 +02:00
|
|
|
__date__ = "2010/11/25 14:46:21"
|
2008-02-07 11:24:55 +01:00
|
|
|
|
2011-08-31 00:28:24 +02:00
|
|
|
__developer__ = "bdeegan"
|
2008-02-07 11:24:55 +01:00
|
|
|
|
|
|
|
import os
|
|
|
|
import os.path
|
|
|
|
import sys
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# BEGIN STANDARD SCons SCRIPT HEADER
|
|
|
|
#
|
|
|
|
# This is the cut-and-paste logic so that a self-contained script can
|
|
|
|
# interoperate correctly with different SCons versions and installation
|
|
|
|
# locations for the engine. If you modify anything in this section, you
|
|
|
|
# should also change other scripts that use this same header.
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
# Strip the script directory from sys.path() so on case-insensitive
|
|
|
|
# (WIN32) systems Python doesn't think that the "scons" script is the
|
|
|
|
# "SCons" package. Replace it with our own library directories
|
|
|
|
# (version-specific first, in case they installed by hand there,
|
|
|
|
# followed by generic) so we pick up the right version of the build
|
|
|
|
# engine modules if they're in either directory.
|
|
|
|
|
2011-08-31 00:28:24 +02:00
|
|
|
|
|
|
|
# Check to see if the python version is > 3.0 which is currently unsupported
|
|
|
|
# If so exit with error message
|
|
|
|
try:
|
|
|
|
if sys.version_info >= (3,0,0):
|
|
|
|
msg = "scons: *** SCons version %s does not run under Python version %s.\n"
|
|
|
|
sys.stderr.write(msg % (__version__, sys.version.split()[0]))
|
|
|
|
sys.exit(1)
|
|
|
|
except AttributeError:
|
|
|
|
# Pre-1.6 Python has no sys.version_info
|
|
|
|
# No need to check version as we then know the version is < 3.0.0 and supported
|
|
|
|
pass
|
|
|
|
|
2008-02-07 11:24:55 +01:00
|
|
|
script_dir = sys.path[0]
|
|
|
|
|
|
|
|
if script_dir in sys.path:
|
|
|
|
sys.path.remove(script_dir)
|
|
|
|
|
|
|
|
libs = []
|
|
|
|
|
2011-08-31 00:28:24 +02:00
|
|
|
if "SCONS_LIB_DIR" in os.environ:
|
2008-02-07 11:24:55 +01:00
|
|
|
libs.append(os.environ["SCONS_LIB_DIR"])
|
|
|
|
|
2009-01-06 11:52:43 +01:00
|
|
|
local_version = 'scons-local-' + __version__
|
|
|
|
local = 'scons-local'
|
2008-02-07 11:24:55 +01:00
|
|
|
if script_dir:
|
2009-01-06 11:52:43 +01:00
|
|
|
local_version = os.path.join(script_dir, local_version)
|
2008-02-07 11:24:55 +01:00
|
|
|
local = os.path.join(script_dir, local)
|
2009-01-06 11:52:43 +01:00
|
|
|
libs.append(os.path.abspath(local_version))
|
2008-02-07 11:24:55 +01:00
|
|
|
libs.append(os.path.abspath(local))
|
|
|
|
|
|
|
|
scons_version = 'scons-%s' % __version__
|
|
|
|
|
|
|
|
prefs = []
|
|
|
|
|
|
|
|
if sys.platform == 'win32':
|
|
|
|
# sys.prefix is (likely) C:\Python*;
|
|
|
|
# check only C:\Python*.
|
|
|
|
prefs.append(sys.prefix)
|
|
|
|
prefs.append(os.path.join(sys.prefix, 'Lib', 'site-packages'))
|
|
|
|
else:
|
|
|
|
# On other (POSIX) platforms, things are more complicated due to
|
|
|
|
# the variety of path names and library locations. Try to be smart
|
|
|
|
# about it.
|
|
|
|
if script_dir == 'bin':
|
|
|
|
# script_dir is `pwd`/bin;
|
|
|
|
# check `pwd`/lib/scons*.
|
|
|
|
prefs.append(os.getcwd())
|
|
|
|
else:
|
|
|
|
if script_dir == '.' or script_dir == '':
|
|
|
|
script_dir = os.getcwd()
|
|
|
|
head, tail = os.path.split(script_dir)
|
|
|
|
if tail == "bin":
|
|
|
|
# script_dir is /foo/bin;
|
|
|
|
# check /foo/lib/scons*.
|
|
|
|
prefs.append(head)
|
|
|
|
|
|
|
|
head, tail = os.path.split(sys.prefix)
|
|
|
|
if tail == "usr":
|
|
|
|
# sys.prefix is /foo/usr;
|
|
|
|
# check /foo/usr/lib/scons* first,
|
|
|
|
# then /foo/usr/local/lib/scons*.
|
|
|
|
prefs.append(sys.prefix)
|
|
|
|
prefs.append(os.path.join(sys.prefix, "local"))
|
|
|
|
elif tail == "local":
|
|
|
|
h, t = os.path.split(head)
|
|
|
|
if t == "usr":
|
|
|
|
# sys.prefix is /foo/usr/local;
|
|
|
|
# check /foo/usr/local/lib/scons* first,
|
|
|
|
# then /foo/usr/lib/scons*.
|
|
|
|
prefs.append(sys.prefix)
|
|
|
|
prefs.append(head)
|
|
|
|
else:
|
|
|
|
# sys.prefix is /foo/local;
|
|
|
|
# check only /foo/local/lib/scons*.
|
|
|
|
prefs.append(sys.prefix)
|
|
|
|
else:
|
|
|
|
# sys.prefix is /foo (ends in neither /usr or /local);
|
|
|
|
# check only /foo/lib/scons*.
|
|
|
|
prefs.append(sys.prefix)
|
|
|
|
|
2011-08-31 00:28:24 +02:00
|
|
|
temp = [os.path.join(x, 'lib') for x in prefs]
|
|
|
|
temp.extend([os.path.join(x,
|
2008-02-07 11:24:55 +01:00
|
|
|
'lib',
|
|
|
|
'python' + sys.version[:3],
|
2011-08-31 00:28:24 +02:00
|
|
|
'site-packages') for x in prefs])
|
2008-02-07 11:24:55 +01:00
|
|
|
prefs = temp
|
|
|
|
|
|
|
|
# Add the parent directory of the current python's library to the
|
|
|
|
# preferences. On SuSE-91/AMD64, for example, this is /usr/lib64,
|
|
|
|
# not /usr/lib.
|
|
|
|
try:
|
|
|
|
libpath = os.__file__
|
|
|
|
except AttributeError:
|
|
|
|
pass
|
|
|
|
else:
|
2009-01-06 11:52:43 +01:00
|
|
|
# Split /usr/libfoo/python*/os.py to /usr/libfoo/python*.
|
|
|
|
libpath, tail = os.path.split(libpath)
|
|
|
|
# Split /usr/libfoo/python* to /usr/libfoo
|
|
|
|
libpath, tail = os.path.split(libpath)
|
|
|
|
# Check /usr/libfoo/scons*.
|
|
|
|
prefs.append(libpath)
|
2008-02-07 11:24:55 +01:00
|
|
|
|
2011-08-31 00:28:24 +02:00
|
|
|
try:
|
|
|
|
import pkg_resources
|
|
|
|
except ImportError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
# when running from an egg add the egg's directory
|
|
|
|
try:
|
|
|
|
d = pkg_resources.get_distribution('scons')
|
|
|
|
except pkg_resources.DistributionNotFound:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
prefs.append(d.location)
|
|
|
|
|
2008-02-07 11:24:55 +01:00
|
|
|
# Look first for 'scons-__version__' in all of our preference libs,
|
|
|
|
# then for 'scons'.
|
2011-08-31 00:28:24 +02:00
|
|
|
libs.extend([os.path.join(x, scons_version) for x in prefs])
|
|
|
|
libs.extend([os.path.join(x, 'scons') for x in prefs])
|
2008-02-07 11:24:55 +01:00
|
|
|
|
|
|
|
sys.path = libs + sys.path
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# END STANDARD SCons SCRIPT HEADER
|
|
|
|
##############################################################################
|
|
|
|
|
2009-01-06 11:52:43 +01:00
|
|
|
if __name__ == "__main__":
|
|
|
|
import SCons.Script
|
|
|
|
# this does all the work, and calls sys.exit
|
|
|
|
# with the proper exit status when done.
|
|
|
|
SCons.Script.main()
|
2011-08-31 00:28:24 +02:00
|
|
|
|
|
|
|
# Local Variables:
|
|
|
|
# tab-width:4
|
|
|
|
# indent-tabs-mode:nil
|
|
|
|
# End:
|
|
|
|
# vim: set expandtab tabstop=4 shiftwidth=4:
|