Remove creation of unnecessary version files

The BSDDB version is not relevant for DBAPI databases.  The python
version will always be 3 and the pickle upgrade "YES".
This commit is contained in:
Nick Hall 2016-12-08 18:56:50 +00:00
parent f321d68db1
commit c358d5c3e1
2 changed files with 0 additions and 62 deletions

View File

@ -556,12 +556,6 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
"""
If update is False: then don't update any files
"""
db_python_version = self.get_python_version(directory)
current_python_version = sys.version_info[0]
if db_python_version != current_python_version:
raise exceptions.DbPythonError(str(db_python_version),
str(current_python_version),
str(current_python_version))
db_schema_version = self.get_schema_version(directory)
current_schema_version = self.VERSION[0]
if db_schema_version != current_schema_version:
@ -737,29 +731,6 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
"""Return True when the file has a supported version."""
return True
def get_version(self):
"""
Return the version number of the schema.
"""
if self._directory:
filepath = os.path.join(self._directory, "bdbversion.txt")
try:
with open(filepath, "r", encoding='utf-8') as name_file:
version = name_file.readline().strip()
except (OSError, IOError) as msg:
LOG.error(str(msg))
version = "(0, 0, 0)"
return ast.literal_eval(version)
else:
return (0, 0, 0)
def get_python_version(self, directory=None):
"""
Get the version of python that the database was created
under. Assumes 3, if not found.
"""
raise NotImplementedError
def get_schema_version(self, directory=None):
"""
Get the version of the schema that the database was created

View File

@ -68,24 +68,6 @@ class DBAPI(DbGeneric):
}
return summary
def get_python_version(self, directory=None):
"""
Get the version of python that the database was created
under. Assumes 3, if not found.
"""
if directory is None:
directory = self._directory
version = 3
if directory:
versionpath = os.path.join(directory, "pythonversion.txt")
if os.path.exists(versionpath):
with open(versionpath, "r") as version_file:
version = version_file.read()
version = int(version)
else:
LOG.info("Missing '%s'. Assuming version 3.", versionpath)
return version
def get_schema_version(self, directory=None):
"""
Get the version of the schema that the database was created
@ -106,21 +88,6 @@ class DBAPI(DbGeneric):
def write_version(self, directory):
"""Write files for a newly created DB."""
versionpath = os.path.join(directory, "bdbversion.txt")
_LOG.debug("Write bsddb version %s", str(self.VERSION))
with open(versionpath, "w") as version_file:
version_file.write(str(self.VERSION))
versionpath = os.path.join(directory, "pythonversion.txt")
_LOG.debug("Write python version file to %s", str(sys.version_info[0]))
with open(versionpath, "w") as version_file:
version_file.write(str(sys.version_info[0]))
versionpath = os.path.join(directory, "pickleupgrade.txt")
_LOG.debug("Write pickle version file to %s", "Yes")
with open(versionpath, "w") as version_file:
version_file.write("YES")
_LOG.debug("Write schema version file to %s", str(self.VERSION[0]))
versionpath = os.path.join(directory, "schemaversion.txt")
with open(versionpath, "w") as version_file: