Commits

Anonymous committed 5c5784c

Merged revisions 4006-4010 via svnmerge from
http://scons.tigris.org/svn/scons/trunk

........
r4007 | stevenknight | 2009-02-18 21:39:15 -0800 (Wed, 18 Feb 2009) | 2 lines

Fix case-sensitive handling when a scanner returns None as a suffix.
........
r4008 | stevenknight | 2009-02-18 21:50:06 -0800 (Wed, 18 Feb 2009) | 2 lines

Return the intern() string on the first call to Node.FS.Base._save_str().
........
r4009 | stevenknight | 2009-02-18 21:53:38 -0800 (Wed, 18 Feb 2009) | 2 lines

Add a 'buildbot' action with knowledge of relevant packages.
........
r4010 | stevenknight | 2009-02-18 21:58:40 -0800 (Wed, 18 Feb 2009) | 4 lines

dd newer SCons versions to the list of all versions available for install.
Use shlex.split(), not string.split(), to split command line arguments.
Commonize interpreation of 'cd' and 'mkdir' commands. Fix usage messages.
........

  • Participants
  • Parent commits d8b5369
  • Branches vs_revamp

Comments (0)

Files changed (7)

File bin/Command.py

 
 import getopt
 import os
+import shlex
 import sys
 
 class Usage(Exception):
         pass
 
     def do_execute(self, command):
+        if type(command) == type(''):
+            command = self.subst(command)
+            cmdargs = shlex.split(command)
+            if cmdargs[0] == 'cd':
+                 command = (os.chdir,) + tuple(cmdargs[1:])
+            elif cmdargs[0] == 'mkdir':
+                 command = (os.mkdir,) + tuple(cmdargs[1:])
         if type(command) == type(()):
             func = command[0]
             args = command[1:]
             return func(*args)
         else:
-            return os.system(self.subst(command))
+            return os.system(command)
 
     def do_not_execute(self, command):
         pass
 Usage:  script-template.py [-hnq] 
 
   -h, --help                    Print this help and exit
-  -n, --no-exec                 No execute, just print the command line
-  -q, --quiet                   Quiet, don't print the command line
+  -n, --no-exec                 No execute, just print command lines
+  -q, --quiet                   Quiet, don't print command lines
 """
 
     try:

File bin/install_python.py

     long_options = ['all', 'help', 'no-exec', 'prefix=', 'quiet']
 
     helpstr = """\
-sage:  installs-scons.py [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...]
+Usage:  install_python.py [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...]
 
   -a, --all                     Install all SCons versions.
   -d DIR, --downloads=DIR       Downloads directory.
   -h, --help                    Print this help and exit
-  -n, --no-exec                 No execute, just print the command line
+  -n, --no-exec                 No execute, just print command lines
   -p PREFIX, --prefix=PREFIX    Installation prefix.
-  -q, --quiet                   Quiet, don't print the command line
+  -q, --quiet                   Quiet, don't print command lines
 """
 
     try:
 
         if not os.path.exists(tar_gz):
             if not os.path.exists(downloads_dir):
-                cmd.run((os.mkdir, downloads_dir),
-                        'mkdir %(downloads_dir)s')
+                cmd.run('mkdir %(downloads_dir)s')
             cmd.run('wget -O %(tar_gz)s %(tar_gz_url)s')
 
         cmd.run('tar zxf %(tar_gz)s')
 
-        cmd.run((os.chdir, python), 'cd %(python)s')
+        cmd.run('cd %(python)s')
 
         if (version.startswith('1.6') or
             version.startswith('2.0')):
 
         cmd.run('%(sudo)s rm -f %(prefix)s/bin/{idle,pydoc,python,python-config,smtpd.py}')
 
-        cmd.run((os.chdir, '..'), 'cd ..')
+        cmd.run('cd ..')
 
         cmd.run((shutil.rmtree, python), 'rm -rf %(python)s')
 

File bin/install_scons.py

     '1.0.1.d20080915',
     '1.0.1.d20081001',
     '1.1.0',
+    '1.1.0.d20081104',
+    '1.1.0.d20081125',
+    '1.1.0.d20081207',
+    '1.2.0',
+    '1.2.0.d20090113',
 ]
 
 def main(argv=None):
     long_options = ['all', 'help', 'no-exec', 'prefix=', 'quiet']
 
     helpstr = """\
-Usage:  install-scons.py [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...]
+Usage:  install_scons.py [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...]
 
   -a, --all                     Install all SCons versions.
   -d DIR, --downloads=DIR       Downloads directory.
   -h, --help                    Print this help and exit
-  -n, --no-exec                 No execute, just print the command line
+  -n, --no-exec                 No execute, just print command lines
   -p PREFIX, --prefix=PREFIX    Installation prefix.
-  -q, --quiet                   Quiet, don't print the command line
+  -q, --quiet                   Quiet, don't print command lines
 """
 
     try:
 
         if not os.path.exists(tar_gz):
             if not os.path.exists(downloads_dir):
-                cmd.run((os.mkdir, downloads_dir),
-                        'mkdir %(downloads_dir)s')
+                cmd.run('mkdir %(downloads_dir)s')
             cmd.run('wget -O %(tar_gz)s %(tar_gz_url)s')
 
         cmd.run('tar zxf %(tar_gz)s')
 
-        cmd.run((os.chdir, scons), 'cd %(scons)s')
+        cmd.run('cd %(scons)s')
 
         if version in ('0.01', '0.02', '0.03', '0.04', '0.05',
                        '0.06', '0.07', '0.08', '0.09', '0.10'):
             cmd.run('%(python)s setup.py build')
             cmd.run('%(sudo)s %(python)s setup.py install --prefix=%(prefix)s --no-scons-script')
 
-        cmd.run((os.chdir, '..'), 'cd ..')
+        cmd.run('cd ..')
 
         cmd.run((shutil.rmtree, scons), 'rm -rf %(scons)s')
 

File bin/scons_dev_master.py

     'zip',
 ]
 
+BUILDBOT_PACKAGES = [
+    'buildbot',
+    'cron',
+]
+
 default_args = [
     'upgrade',
     'checkout',
         testing                 Install packages for testing SCons
         scons-versions          Install versions of SCons
         python-versions         Install versions of Python
+
+    ACTIONS (optional):
+        buildbot                Install packages for running BuildBot
 """
 
     scons_url = 'http://scons.tigris.org/svn/scons/trunk'
     install_packages = ' '.join(INSTALL_PACKAGES)
     building_packages = ' '.join(BUILDING_PACKAGES)
     testing_packages = ' '.join(TESTING_PACKAGES)
+    buildbot_packages = ' '.join(BUILDBOT_PACKAGES)
     python_packages = ' '.join(PYTHON_PACKAGES)
 
     cmd = CommandRunner(locals())
             cmd.run('%(sudo)s apt-get %(yesflag)s install %(building_packages)s')
         elif arg == 'testing':
             cmd.run('%(sudo)s apt-get %(yesflag)s install %(testing_packages)s')
+        elif arg == 'buildbot':
+            cmd.run('%(sudo)s apt-get %(yesflag)s install %(buildbot_packages)s')
         elif arg == 'python-versions':
             if install_packages:
                 cmd.run('%(sudo)s apt-get %(yesflag)s install %(install_packages)s')

File src/engine/SCons/Environment.py

             scanners.reverse()
             for scanner in scanners:
                 for k in scanner.get_skeys(self):
-                    if self['PLATFORM'] == 'win32':
+                    if k and self['PLATFORM'] == 'win32':
                         k = string.lower(k)
                     result[k] = scanner
 
     def get_scanner(self, skey):
         """Find the appropriate scanner given a key (usually a file suffix).
         """
-        if self['PLATFORM'] == 'win32':
+        if skey and self['PLATFORM'] == 'win32':
             skey = string.lower(skey)
         return self._gsm().get(skey)
 

File src/engine/SCons/EnvironmentTests.py

         s1 = Scanner(name = 'scanner1', skeys = [".c", ".cc"])
         s2 = Scanner(name = 'scanner2', skeys = [".m4"])
         s3 = Scanner(name = 'scanner3', skeys = [".m4", ".m5"])
+        s4 = Scanner(name = 'scanner4', skeys = [None])
 
 #        XXX Tests for scanner execution through different environments,
 #        XXX if we ever want to do that some day
         s = map(env.get_scanner, uc_suffixes)
         assert s == [s1, s1, None, s2, s3], s
 
+        # Verify behavior for a scanner returning None (on Windows
+        # where we might try to perform case manipulation on None).
+        env.Replace(SCANNERS = [s4])
+        s = map(env.get_scanner, suffixes)
+        assert s == [None, None, None, None, None], s
+
     def test_ENV(self):
         """Test setting the external ENV in Environments
         """

File src/engine/SCons/Node/FS.py

             return self._memo['_save_str']
         except KeyError:
             pass
-        result = self._get_str()
-        self._memo['_save_str'] = intern(result)
+        result = intern(self._get_str())
+        self._memo['_save_str'] = result
         return result
 
     def _get_str(self):