From: garyo Date: Mon, 11 May 2009 15:49:12 +0000 (+0000) Subject: Make building SCons distribution on Windows work better: make whereis() look for... X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=95f60d10922b2a26b1e69bb7f8252013e5dcd533;p=scons.git Make building SCons distribution on Windows work better: make whereis() look for .exe as well as original filename on Windows. git-svn-id: http://scons.tigris.org/svn/scons/trunk@4187 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/SConstruct b/SConstruct index 1c0ebbed..c4ce97e5 100644 --- a/SConstruct +++ b/SConstruct @@ -48,6 +48,8 @@ project = 'scons' default_version = '1.2.0' copyright = "Copyright (c) %s The SCons Foundation" % copyright_years +platform = distutils.util.get_platform() + SConsignFile() # @@ -55,15 +57,20 @@ SConsignFile() # is available on this system. # def whereis(file): + exts = [''] + if platform == "win32": + exts += ['.exe'] for dir in string.split(os.environ['PATH'], os.pathsep): f = os.path.join(dir, file) - if os.path.isfile(f): - try: - st = os.stat(f) - except: - continue - if stat.S_IMODE(st[stat.ST_MODE]) & 0111: - return f + for ext in exts: + f_ext = f + ext + if os.path.isfile(f_ext): + try: + st = os.stat(f_ext) + except: + continue + if stat.S_IMODE(st[stat.ST_MODE]) & 0111: + return f_ext return None # @@ -163,8 +170,6 @@ if build_id is None: python_ver = sys.version[0:3] -platform = distutils.util.get_platform() - # Re-exporting LD_LIBRARY_PATH is necessary if the Python version was # built with the --enable-shared option. @@ -836,7 +841,7 @@ for p in [ scons ]: AddPostAction(dist_distutils_targets, Chmod(dist_distutils_targets, 0644)) if not gzip: - print "gzip not found; skipping .tar.gz package for %s." % pkg + print "gzip not found in %s; skipping .tar.gz package for %s." % (os.environ['PATH'], pkg) else: distutils_formats.append('gztar')