Updating version handling

This change updates how the library version number is dynamically
loaded. It removes the use of exec in favor of a regular expression.
This commit is contained in:
Peter Hamilton 2015-09-17 14:32:14 -04:00
parent 989e19c834
commit 25ad7d3ab1
2 changed files with 6 additions and 2 deletions

View File

@ -15,13 +15,15 @@
import logging.config
import os
import re
import sys
# Dynamically set __version__
version_path = os.path.join(os.path.dirname(
os.path.realpath(__file__)), 'version.py')
with open(version_path, 'r') as version_file:
exec(version_file.read())
mo = re.search(r"^.*= '(\d\.\d\.\d)'$", version_file.read(), re.MULTILINE)
__version__ = mo.group(1)
path = os.path.join(os.path.dirname(__file__), 'logconfig.ini')

View File

@ -14,13 +14,15 @@
# limitations under the License.
import os
import re
import setuptools
# Dynamically set __version__
version_path = os.path.join(os.path.dirname(
os.path.realpath(__file__)), 'kmip', 'version.py')
with open(version_path, 'r') as version_file:
exec(version_file.read())
mo = re.search(r"^.*= '(\d\.\d\.\d)'$", version_file.read(), re.MULTILINE)
__version__ = mo.group(1)
setuptools.setup(
name='PyKMIP',