Skip to content

Commit

Permalink
Fix version issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarans committed May 22, 2019
1 parent 6d84afa commit 90f044d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
sys.path.append('src') # Only needed for this project
from hdx.utilities import CleanCommand, PackageCommand, PublishCommand
from hdx.utilities.loader import load_file_to_str
import hdx.utilities

requirements = ['basicauth',
'beautifulsoup4',
Expand Down Expand Up @@ -34,12 +35,14 @@
"Topic :: Software Development :: Libraries :: Python Modules",
]

hdx.utilities.project_version = load_file_to_str(join('src', 'hdx', 'utilities', 'version.txt'), strip=True)

setup(
name='hdx-python-utilities',
description='HDX Python Utilities',
license='MIT',
url='https://github.com/OCHA-DAP/hdx-python-utilities',
version=load_file_to_str(join('src', 'hdx', 'utilities', 'version.txt'), strip=True),
version=hdx.utilities.project_version,
author='Michael Rans',
author_email='rans@email.com',
keywords=['HDX', 'utilities', 'library', 'country', 'iso 3166'],
Expand Down
10 changes: 6 additions & 4 deletions src/hdx/utilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import six
from setuptools import Command

from hdx.utilities.version import get_utils_version
project_version = None


def raisefrom(exc_type, message, exc):
Expand Down Expand Up @@ -103,7 +103,9 @@ def run(self):
log.info('Uploading the package to PyPI using twine...')
os.system('twine upload dist/*')

log.info('Pushing git tags...')
os.system('git tag v{0}'.format(get_utils_version()))
os.system('git push --tags')
if project_version:
log.info('Pushing git tags...')
os.system('git tag v{0}'.format(project_version))
os.system('git push --tags')

sys.exit()
4 changes: 2 additions & 2 deletions src/hdx/utilities/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"""Version utility"""
import logging

from hdx.utilities.loader import load_file_to_str
from hdx.utilities.path import script_dir_plus_file

logger = logging.getLogger(__name__)


def get_utils_version():
version_file = open(script_dir_plus_file('version.txt', get_utils_version))
return version_file.read().strip()
return load_file_to_str(script_dir_plus_file('version.txt', get_utils_version), strip=True)
2 changes: 1 addition & 1 deletion src/hdx/utilities/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.1
1.7.2

0 comments on commit 90f044d

Please sign in to comment.