diff options
author | Greg Noel <GregNoel@tigris.org> | 2010-03-25 04:14:28 (GMT) |
---|---|---|
committer | Greg Noel <GregNoel@tigris.org> | 2010-03-25 04:14:28 (GMT) |
commit | 22d352500f1cd6bd0c53d788a5dc44a1fefa676e (patch) | |
tree | 0984fd581082c27cfbfbb7f94d5751b0e6fd2741 /src/script | |
parent | 75ac32ac8e32076e25b72a19eb56340cc585fa4e (diff) | |
download | SCons-22d352500f1cd6bd0c53d788a5dc44a1fefa676e.zip SCons-22d352500f1cd6bd0c53d788a5dc44a1fefa676e.tar.gz SCons-22d352500f1cd6bd0c53d788a5dc44a1fefa676e.tar.bz2 |
Move 2.0 changes collected in branches/pending back to trunk for further
development. Note that this set of changes is NOT backward-compatible;
the trunk no longer works with Python 1.5.2, 2.0, or 2.1.
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/scons-time.py | 21 | ||||
-rw-r--r-- | src/script/scons.py | 13 | ||||
-rw-r--r-- | src/script/sconsign.py | 26 |
3 files changed, 28 insertions, 32 deletions
diff --git a/src/script/scons-time.py b/src/script/scons-time.py index eeddd87..c75bc13 100644 --- a/src/script/scons-time.py +++ b/src/script/scons-time.py @@ -30,8 +30,8 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # - from __future__ import nested_scopes +from __future__ import generators ### KEEP FOR COMPATIBILITY FIXERS __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -41,7 +41,6 @@ import os import os.path import re import shutil -import string import sys import tempfile import time @@ -177,13 +176,13 @@ class Gnuplotter(Plotter): result = [] for line in self.lines: result.extend(line.get_x_values()) - return filter(lambda r: not r is None, result) + return [r for r in result if not r is None] def get_all_y_values(self): result = [] for line in self.lines: result.extend(line.get_y_values()) - return filter(lambda r: not r is None, result) + return [r for r in result if not r is None] def get_min_x(self): try: @@ -539,7 +538,7 @@ class SConsTimer: for file in files: base = os.path.splitext(file)[0] - run, index = string.split(base, '-')[-2:] + run, index = base.split('-')[-2:] run = int(run) index = int(index) @@ -577,11 +576,11 @@ class SConsTimer: and returns the next run number after the largest it finds. """ x = re.compile(re.escape(prefix) + '-([0-9]+).*') - matches = map(lambda e, x=x: x.match(e), os.listdir(dir)) - matches = filter(None, matches) + matches = [x.match(e) for e in os.listdir(dir)] + matches = [_f for _f in matches if _f] if not matches: return 0 - run_numbers = map(lambda m: int(m.group(1)), matches) + run_numbers = [int(m.group(1)) for m in matches] return int(max(run_numbers)) + 1 def gnuplot_results(self, results, fmt='%s %.3f'): @@ -964,7 +963,7 @@ class SConsTimer: if self.chdir: os.chdir(self.chdir) - logfile_path = lambda x, c=self.chdir: os.path.join(c, x) + logfile_path = lambda x: os.path.join(self.chdir, x) if not args: @@ -1084,7 +1083,7 @@ class SConsTimer: if self.chdir: os.chdir(self.chdir) - logfile_path = lambda x, c=self.chdir: os.path.join(c, x) + logfile_path = lambda x: os.path.join(self.chdir, x) if not args: @@ -1462,7 +1461,7 @@ class SConsTimer: if self.chdir: os.chdir(self.chdir) - logfile_path = lambda x, c=self.chdir: os.path.join(c, x) + logfile_path = lambda x: os.path.join(self.chdir, x) if not args: diff --git a/src/script/scons.py b/src/script/scons.py index dec4222..010302f 100644 --- a/src/script/scons.py +++ b/src/script/scons.py @@ -76,7 +76,7 @@ if script_dir in sys.path: libs = [] -if os.environ.has_key("SCONS_LIB_DIR"): +if "SCONS_LIB_DIR" in os.environ: libs.append(os.environ["SCONS_LIB_DIR"]) local_version = 'scons-local-' + __version__ @@ -137,12 +137,11 @@ else: # check only /foo/lib/scons*. prefs.append(sys.prefix) - temp = map(lambda x: os.path.join(x, 'lib'), prefs) - temp.extend(map(lambda x: os.path.join(x, + temp = [os.path.join(x, 'lib') for x in prefs] + temp.extend([os.path.join(x, 'lib', 'python' + sys.version[:3], - 'site-packages'), - prefs)) + 'site-packages') for x in prefs]) prefs = temp # Add the parent directory of the current python's library to the @@ -175,8 +174,8 @@ else: # Look first for 'scons-__version__' in all of our preference libs, # then for 'scons'. -libs.extend(map(lambda x: os.path.join(x, scons_version), prefs)) -libs.extend(map(lambda x: os.path.join(x, 'scons'), prefs)) +libs.extend([os.path.join(x, scons_version) for x in prefs]) +libs.extend([os.path.join(x, 'scons') for x in prefs]) sys.path = libs + sys.path diff --git a/src/script/sconsign.py b/src/script/sconsign.py index 40c5daf..fb3bd5e 100644 --- a/src/script/sconsign.py +++ b/src/script/sconsign.py @@ -23,6 +23,7 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # +from __future__ import generators ### KEEP FOR COMPATIBILITY FIXERS __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -64,7 +65,7 @@ if script_dir in sys.path: libs = [] -if os.environ.has_key("SCONS_LIB_DIR"): +if "SCONS_LIB_DIR" in os.environ: libs.append(os.environ["SCONS_LIB_DIR"]) local_version = 'scons-local-' + __version__ @@ -125,12 +126,11 @@ else: # check only /foo/lib/scons*. prefs.append(sys.prefix) - temp = map(lambda x: os.path.join(x, 'lib'), prefs) - temp.extend(map(lambda x: os.path.join(x, + temp = [os.path.join(x, 'lib') for x in prefs] + temp.extend([os.path.join(x, 'lib', 'python' + sys.version[:3], - 'site-packages'), - prefs)) + 'site-packages') for x in prefs]) prefs = temp # Add the parent directory of the current python's library to the @@ -163,8 +163,8 @@ else: # Look first for 'scons-__version__' in all of our preference libs, # then for 'scons'. -libs.extend(map(lambda x: os.path.join(x, scons_version), prefs)) -libs.extend(map(lambda x: os.path.join(x, 'scons'), prefs)) +libs.extend([os.path.join(x, scons_version) for x in prefs]) +libs.extend([os.path.join(x, 'scons') for x in prefs]) sys.path = libs + sys.path @@ -174,7 +174,6 @@ sys.path = libs + sys.path import cPickle import imp -import string import whichdb import SCons.SConsign @@ -195,7 +194,7 @@ whichdb.whichdb = my_whichdb def my_import(mname): if '.' in mname: - i = string.rfind(mname, '.') + i = mname.rfind('.') parent = my_import(mname[:i]) fp, pathname, description = imp.find_module(mname[i+1:], parent.__path__) @@ -254,7 +253,7 @@ def map_bkids(entry, name): result.append(nodeinfo_string(bkids[i], bkidsigs[i], " ")) if result == []: return None - return string.join(result, "\n ") + return "\n ".join(result) map_field = { 'action' : map_action, @@ -290,22 +289,21 @@ def nodeinfo_raw(name, ninfo, prefix=""): l.append('%s: %s' % (repr(k), repr(d.get(k)))) if '\n' in name: name = repr(name) - return name + ': {' + string.join(l, ', ') + '}' + return name + ': {' + ', '.join(l) + '}' def nodeinfo_cooked(name, ninfo, prefix=""): try: field_list = ninfo.field_list except AttributeError: field_list = [] - f = lambda x, ni=ninfo, v=Verbose: field(x, ni, v) if '\n' in name: name = repr(name) - outlist = [name+':'] + filter(None, map(f, field_list)) + outlist = [name+':'] + [_f for _f in [field(x, ninfo, Verbose) for x in field_list] if _f] if Verbose: sep = '\n ' + prefix else: sep = ' ' - return string.join(outlist, sep) + return sep.join(outlist) nodeinfo_string = nodeinfo_cooked |