From ac6c4a39e4aba96cf0ceafbdc8532b8a9fe61a28 Mon Sep 17 00:00:00 2001 From: Ruben Verweij Date: Sat, 24 Apr 2021 15:39:36 +0200 Subject: [PATCH] Install package on travis to correctly get version number --- .travis.yml | 1 + nd2reader/__init__.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6de9aa3..9e110a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,7 @@ before_script: - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - chmod +x ./cc-test-reporter - ./cc-test-reporter before-build + - python setup.py develop # need to install to get version number script: python ./test.py diff --git a/nd2reader/__init__.py b/nd2reader/__init__.py index 970eb63..353176e 100644 --- a/nd2reader/__init__.py +++ b/nd2reader/__init__.py @@ -2,12 +2,12 @@ from os import path from nd2reader.reader import ND2Reader from nd2reader.legacy import Nd2 -#try: -import importlib.metadata as importlib_metadata -#except: -# import importlib_metadata +try: + import importlib.metadata as importlib_metadata +except: + import importlib_metadata try: __version__ = importlib_metadata.version(__name__) except: - raise ValueError('Unable to read version number') + print('Unable to read version number')