Make building SCons distribution on Windows work better: make whereis() look for...
authorgaryo <garyo@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 11 May 2009 15:49:12 +0000 (15:49 +0000)
committergaryo <garyo@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 11 May 2009 15:49:12 +0000 (15:49 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@4187 fdb21ef1-2011-0410-befe-b5e4ea1792b1

SConstruct

index 1c0ebbed353abd5fa15278513098718ce41bb1c9..c4ce97e570a3f3587a547349e7b0d2a67f718e96 100644 (file)
@@ -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')