24
24
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
__revision__ = "src/script/scons.py 0.D006 2002/03/28 02:47:47 software"
27
__revision__ = "/home/scons/scons/branch.0/baseline/src/script/scons.py 0.96.1.D001 2004/08/23 09:55:29 knight"
29
__version__ = "0.96.1"
33
__buildsys__ = "casablanca"
35
__date__ = "2004/08/23 09:55:29"
37
__developer__ = "knight"
43
##############################################################################
44
# BEGIN STANDARD SCons SCRIPT HEADER
46
# This is the cut-and-paste logic so that a self-contained script can
47
# interoperate correctly with different SCons versions and installation
48
# locations for the engine. If you modify anything in this section, you
49
# should also change other scripts that use this same header.
50
##############################################################################
33
52
# Strip the script directory from sys.path() so on case-insensitive
34
53
# (WIN32) systems Python doesn't think that the "scons" script is the
37
56
# followed by generic) so we pick up the right version of the build
38
57
# engine modules if they're in either directory.
40
selfdir = os.path.abspath(sys.argv[0])
41
if selfdir in sys.path:
42
sys.path.remove(selfdir)
59
script_dir = sys.path[0]
61
if script_dir in sys.path:
62
sys.path.remove(script_dir)
46
66
if os.environ.has_key("SCONS_LIB_DIR"):
47
67
libs.append(os.environ["SCONS_LIB_DIR"])
69
local = 'scons-local-' + __version__
71
local = os.path.join(script_dir, local)
74
scons_version = 'scons-%s' % __version__
49
78
if sys.platform == 'win32':
50
libs.extend([ os.path.join(sys.prefix, 'SCons-0.06'),
51
os.path.join(sys.prefix, 'SCons') ])
79
# sys.prefix is (likely) C:\Python*;
80
# check only C:\Python*.
81
prefs.append(sys.prefix)
82
prefs.append(os.path.join(sys.prefix, 'Lib', 'site-packages'))
55
_bin = os.path.join('', 'bin')
56
_usr = os.path.join('', 'usr')
57
_usr_local = os.path.join('', 'usr', 'local')
59
script_dir = sys.path[0]
84
# On other (POSIX) platforms, things are more complicated due to
85
# the variety of path names and library locations. Try to be smart
61
87
if script_dir == 'bin':
88
# script_dir is `pwd`/bin;
89
# check `pwd`/lib/scons*.
62
90
prefs.append(os.getcwd())
64
92
if script_dir == '.' or script_dir == '':
65
93
script_dir = os.getcwd()
66
if script_dir[-len(_bin):] == _bin:
67
prefs.append(script_dir[:-len(_bin)])
94
head, tail = os.path.split(script_dir)
96
# script_dir is /foo/bin;
97
# check /foo/lib/scons*.
69
if sys.prefix[-len(_usr):] == _usr:
70
prefs.append(sys.prefix)
71
prefs.append(os.path.join(sys.prefix, "local"))
72
elif sys.prefix[-len(_usr_local):] == _usr_local:
73
_local = os.path.join('', 'local')
74
prefs.append(sys.prefix[:-len(_local)])
75
prefs.append(sys.prefix)
100
head, tail = os.path.split(sys.prefix)
102
# sys.prefix is /foo/usr;
103
# check /foo/usr/lib/scons* first,
104
# then /foo/usr/local/lib/scons*.
105
prefs.append(sys.prefix)
106
prefs.append(os.path.join(sys.prefix, "local"))
107
elif tail == "local":
108
h, t = os.path.split(head)
110
# sys.prefix is /foo/usr/local;
111
# check /foo/usr/local/lib/scons* first,
112
# then /foo/usr/lib/scons*.
113
prefs.append(sys.prefix)
116
# sys.prefix is /foo/local;
117
# check only /foo/local/lib/scons*.
118
prefs.append(sys.prefix)
120
# sys.prefix is /foo (ends in neither /usr or /local);
121
# check only /foo/lib/scons*.
77
122
prefs.append(sys.prefix)
79
libs.extend(map(lambda x: os.path.join(x, 'lib', 'scons-0.06'), prefs))
80
libs.extend(map(lambda x: os.path.join(x, 'lib', 'scons'), prefs))
82
sys.path = libs + sys.path[1:]
124
temp = map(lambda x: os.path.join(x, 'lib'), prefs)
125
temp.extend(map(lambda x: os.path.join(x,
127
'python' + sys.version[:3],
132
# Look first for 'scons-__version__' in all of our preference libs,
134
libs.extend(map(lambda x: os.path.join(x, scons_version), prefs))
135
libs.extend(map(lambda x: os.path.join(x, 'scons'), prefs))
137
sys.path = libs + sys.path
139
##############################################################################
140
# END STANDARD SCons SCRIPT HEADER
141
##############################################################################
84
143
import SCons.Script
85
144
SCons.Script.main()