8614: pickleupgrade.txt should not be written for python2

This commit is contained in:
kulath 2015-06-18 20:25:33 +01:00
parent 5828dd3aa8
commit e71115af1b

View File

@ -2471,16 +2471,14 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
with open(versionpath, "w") as version_file:
version_file.write(version)
versionpath = os.path.join(name, cuni(PCKVERSFN))
with open(versionpath, "w") as version_file:
if sys.version_info[0] <3:
version = "No"
if isinstance(version, UNITYPE):
version = version.encode('utf-8')
else:
version = "Yes"
# The pickle upgrade file is not written for Python2; its contents is
# never actually examined, all that matters is whether it is present
if sys.version_info[0] >= 3:
versionpath = os.path.join(name, cuni(PCKVERSFN))
_LOG.debug("Write pickle version file to %s" % "Yes")
version_file.write(version)
with open(versionpath, "w") as version_file:
version = "Yes"
version_file.write(version)
versionpath = os.path.join(name, cuni(SCHVERSFN))
_LOG.debug("Write schema version file to %s" % str(_DBVERSION))