From 4baa69df4313bb6fbe4e1d8f74c0419854f80497 Mon Sep 17 00:00:00 2001 From: Tom Aldcroft Date: Fri, 8 Mar 2019 06:59:58 -0500 Subject: [PATCH] Fix mistake in getting __version__ from __init__.py --- Ska/engarchive/__init__.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Ska/engarchive/__init__.py b/Ska/engarchive/__init__.py index ad2e545f..430b5570 100644 --- a/Ska/engarchive/__init__.py +++ b/Ska/engarchive/__init__.py @@ -1,15 +1,14 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -# Get the version. Ska.engarchive / cheta is a twisted case because the -# package metadata can live either one or two directories above. So just -# try both. -from setuptools_scm import get_version -from pathlib import Path -root = Path('..') +from pkg_resources import get_distribution, DistributionNotFound + try: - __version__ = get_version(root=root, relative_to=__file__) -except LookupError: - __version__ = get_version(root=root / '..', relative_to=__file__) + # Normally use the generic __name__ here, but for the dual Ska.engarchive + # and cheta install, hardwire to 'Ska.engarchive' which is the package name. + __version__ = get_distribution('Ska.engarchive').version +except DistributionNotFound: + # package is not installed + pass def test(*args, **kwargs):