Reading Python 3.8.0 .dblite file from Python 2.7

Don Baldwin <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <BY5PR02MB6131E52CECB051B4BDB1EBF6F55D0@BY5PR02MB6131.namprd02.prod.outlook.com>
Hi,

We're trying to migrate our builds from SCons 2.0.0.final.0 to SCons 3.1.1, and from Python 2.7 to 3.8.0.  However, we still need to maintain some kind of compatibility between these versions because:


  1.  We still need to support older builds using older versions of Python and SCons 2.0.0.final.0.
  2.  We have several tools outside of the build that use the sconsign tool to read the .dblite files, and these are still running with Python 2.x.

We see the following error when trying to read the .dblite file from builds built with Python 3.8.0 from a tool that's running under Python 2.7:

ignoring invalid `dblite' file

From what I've read, this seems to be due to the incompatibility between the pickle library between Python 2 and 3.

I see the following code in lib/SCons/compat/__init__.py:

# Was pickle.HIGHEST_PROTOCOL
# Changed to 2 so py3.5+'s pickle will be compatible with py2.7.
PICKLE_PROTOCOL = pickle.HIGHEST_PROTOCOL

When I modify this to set PICKLE_PROTOCOL = 2, my tools are able to successfully read the .dblite files, but I'd prefer not to have to modify the native SCons code.

Is there a way to set this value from my SConscript file, or some other preferred way to handle this situation?

Thanks,
Don Baldwin

_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.