summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/engine/SCons/SConsign.py6
-rw-r--r--src/engine/SCons/Tool/msvs.py15
-rw-r--r--src/engine/SCons/compat/__init__.py5
-rw-r--r--src/engine/SCons/dblite.py4
4 files changed, 20 insertions, 10 deletions
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 6df4928..02b9a34 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..9a911f7 100644
--- a/src/engine/SCons/compat/__init__.py
+++ b/src/engine/SCons/compat/__init__.py
@@ -88,6 +88,11 @@ 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.
+PICKLE_PROTOCOL=-1
+
# 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