From e00d6aea30013acc529ffedbc4953c89c104ad80 Mon Sep 17 00:00:00 2001 From: jlaura <jlaura@usgs.gov> Date: Mon, 2 Jul 2018 07:14:41 -0700 Subject: [PATCH] Adds __version__ attribute (#35) * Refactors out bad class attribute * Adds dynamic versioning --- setup.py | 2 +- tests/test_generic_frame.py | 1 - usgscam/__init__.py | 21 ++++++++++++++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 56c89ba..be02bd9 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ extensions = [generate_extension('usgscam.genericframe', ['usgscam/genericframe. setup( name='usgscam', - version='0.1.0', + version='0.1.1', ext_modules=cythonize(extensions), description='Cython wrapper to the USGS MDIS Camera Model', author='Jay Laura', diff --git a/tests/test_generic_frame.py b/tests/test_generic_frame.py index eec33d1..05a19bc 100644 --- a/tests/test_generic_frame.py +++ b/tests/test_generic_frame.py @@ -35,7 +35,6 @@ class TestCassiniNAC: - class TestMdisWac: @pytest.mark.parametrize('image, ground',[ ((512, 512, 0), (-73589.5516508502, 562548.342040933, 2372508.44060771)), diff --git a/usgscam/__init__.py b/usgscam/__init__.py index 1e14436..c0b14c5 100644 --- a/usgscam/__init__.py +++ b/usgscam/__init__.py @@ -1,5 +1,20 @@ + +from pkg_resources import get_distribution, DistributionNotFound +import os.path + +try: + _dist = get_distribution('autocnet') + # Normalize case for Windows systems + dist_loc = os.path.normcase(_dist.location) + here = os.path.normcase(__file__) + if not here.startswith(os.path.join(dist_loc, 'autocnet')): + # not installed, but there is another version that *is* + raise DistributionNotFound +except DistributionNotFound: + __version__ = 'Please install this project with setup.py' +else: + __version__ = _dist.version + import usgscam.genericframe -import usgscam.orex import usgscam.genericls -#from usgscam import mdis -#from usgscam import orex +import usgscam.orex -- GitLab