diff options
author | William Deegan <bill@baddogconsulting.com> | 2016-09-11 23:53:50 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2016-09-11 23:53:50 (GMT) |
commit | 2de3e0c670a7f172cd6753679baede25fcd44963 (patch) | |
tree | 81078c0ba73957adffba31d2229d985736872b62 | |
parent | 6ae4ba738ba63e37eda4a8b77c59fd21782e413a (diff) | |
parent | d8f891005dc3edc527e62fd06fa92feab94db61d (diff) | |
download | SCons-2de3e0c670a7f172cd6753679baede25fcd44963.zip SCons-2de3e0c670a7f172cd6753679baede25fcd44963.tar.gz SCons-2de3e0c670a7f172cd6753679baede25fcd44963.tar.bz2 |
Merged in dholth/scons (pull request #348)
-rw-r--r-- | src/CHANGES.txt | 2 | ||||
-rw-r--r-- | src/engine/SCons/SConsign.py | 6 | ||||
-rw-r--r-- | src/engine/SCons/Tool/msvs.py | 15 | ||||
-rw-r--r-- | src/engine/SCons/compat/__init__.py | 6 | ||||
-rw-r--r-- | src/engine/SCons/dblite.py | 4 |
5 files changed, 23 insertions, 10 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 361af21..69fb621 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -11,6 +11,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER metaclass on PyPy); wrap most-used open() calls in 'with' statements to avoid too many open files. - Add __main__.py for `python -m SCons` in case it is on PYTHONPATH. + - Always use highest available pickle protocol for efficiency. From Alexey Klimkin: - Use memoization to optimize PATH evaluation across all dependencies per @@ -20,6 +21,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Fixed msvs.py for Visual Studio Express editions that would report "Error : ValueError: invalid literal for float(): 10.0Exp". + From Paweł Tomulik: - Fixed the issue with LDMODULEVERSIONFLAGS reported by Tim Jennes (https://pairlist4.pair.net/pipermail/scons-users/2016-May/004893.html). diff --git a/src/engine/SCons/SConsign.py b/src/engine/SCons/SConsign.py index cb089aa..3a5e5c0 100644 --- a/src/engine/SCons/SConsign.py +++ b/src/engine/SCons/SConsign.py @@ -39,6 +39,8 @@ import pickle import SCons.dblite import SCons.Warnings +from SCons.compat import PICKLE_PROTOCOL + def corrupt_dblite_warning(filename): SCons.Warnings.warn(SCons.Warnings.CorruptSConsignWarning, "Ignoring corrupt .sconsign file: %s"%filename) @@ -272,7 +274,7 @@ class DB(Base): path = normcase(self.dir.get_internal_path()) for key, entry in self.entries.items(): entry.convert_to_sconsign() - db[path] = pickle.dumps(self.entries, 1) + db[path] = pickle.dumps(self.entries, PICKLE_PROTOCOL) if sync: try: @@ -360,7 +362,7 @@ class DirFile(Dir): return for key, entry in self.entries.items(): entry.convert_to_sconsign() - pickle.dump(self.entries, file, 1) + pickle.dump(self.entries, file, PICKLE_PROTOCOL) file.close() if fname != self.sconsign: try: diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index 6e91909..8166d7d 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -54,6 +54,7 @@ import SCons.Warnings from .MSCommon import msvc_exists, msvc_setup_env_once from SCons.Defaults import processDefines +from SCons.compat import PICKLE_PROTOCOL ############################################################################## # Below here are the classes and functions for generation of @@ -641,10 +642,10 @@ class _GenerateV6DSP(_DSPGenerator): if self.nokeep == 0: # now we pickle some data and add it to the file -- MSDEV will ignore it. - pdata = pickle.dumps(self.configs,1) + pdata = pickle.dumps(self.configs,PICKLE_PROTOCOL) pdata = base64.encodestring(pdata) self.file.write(pdata + '\n') - pdata = pickle.dumps(self.sources,1) + pdata = pickle.dumps(self.sources,PICKLE_PROTOCOL) pdata = base64.encodestring(pdata) self.file.write(pdata + '\n') @@ -913,10 +914,10 @@ class _GenerateV7DSP(_DSPGenerator, _GenerateV7User): if self.nokeep == 0: # now we pickle some data and add it to the file -- MSDEV will ignore it. - pdata = pickle.dumps(self.configs,1) + pdata = pickle.dumps(self.configs,PICKLE_PROTOCOL) pdata = base64.encodestring(pdata) self.file.write('<!-- SCons Data:\n' + pdata + '\n') - pdata = pickle.dumps(self.sources,1) + pdata = pickle.dumps(self.sources,PICKLE_PROTOCOL) pdata = base64.encodestring(pdata) self.file.write(pdata + '-->\n') @@ -1232,10 +1233,10 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User): if self.nokeep == 0: # now we pickle some data and add it to the file -- MSDEV will ignore it. - pdata = pickle.dumps(self.configs,1) + pdata = pickle.dumps(self.configs,PICKLE_PROTOCOL) pdata = base64.encodestring(pdata) self.file.write('<!-- SCons Data:\n' + pdata + '\n') - pdata = pickle.dumps(self.sources,1) + pdata = pickle.dumps(self.sources,PICKLE_PROTOCOL) pdata = base64.encodestring(pdata) self.file.write(pdata + '-->\n') @@ -1606,7 +1607,7 @@ class _GenerateV7DSW(_DSWGenerator): '\tEndGlobalSection\n') self.file.write('EndGlobal\n') if self.nokeep == 0: - pdata = pickle.dumps(self.configs,1) + pdata = pickle.dumps(self.configs,PICKLE_PROTOCOL) pdata = base64.encodestring(pdata) self.file.write(pdata + '\n') diff --git a/src/engine/SCons/compat/__init__.py b/src/engine/SCons/compat/__init__.py index 6f20b73..c6c7214 100644 --- a/src/engine/SCons/compat/__init__.py +++ b/src/engine/SCons/compat/__init__.py @@ -88,6 +88,12 @@ def rename_module(new, old): # In 3.x, 'pickle' automatically loads the fast version if available. rename_module('pickle', 'cPickle') +# Default pickle protocol. Higher protocols are more efficient/featureful +# but incompatible with older Python versions. On Python 2.7 this is 2. +# Negative numbers choose the highest available protocol. +import pickle +PICKLE_PROTOCOL=pickle.HIGHEST_PROTOCOL + # TODO: FIXME # In 3.x, 'profile' automatically loads the fast version if available. rename_module('profile', 'cProfile') diff --git a/src/engine/SCons/dblite.py b/src/engine/SCons/dblite.py index b12d320..c32f494 100644 --- a/src/engine/SCons/dblite.py +++ b/src/engine/SCons/dblite.py @@ -4,6 +4,8 @@ from __future__ import print_function import SCons.compat +from SCons.compat import PICKLE_PROTOCOL + import os import pickle import shutil @@ -119,7 +121,7 @@ class dblite(object): def sync(self): self._check_writable() f = self._open(self._tmp_name, "wb", self._mode) - self._pickle_dump(self._dict, f, 1) + self._pickle_dump(self._dict, f, PICKLE_PROTOCOL) f.close() # Windows doesn't allow renaming if the file exists, so unlink # it first, chmod'ing it to make sure we can do so. On UNIX, we |