From c23259e813561de3c0b91a6e27cca4a7040e6ac1 Mon Sep 17 00:00:00 2001 From: Francesco Nattino Date: Thu, 8 Jun 2023 11:09:56 +0200 Subject: [PATCH 1/2] fix argument for install requirements --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f0df289..f80cec8 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ license="BSD 3-clause", # packages=["morphsnakes"], py_modules=["morphsnakes"], - requires=['numpy', 'scipy'], + install_requires=['numpy', 'scipy'], long_description=""" The Morphological Snakes are a family of methods for image-guided evolution of curves and surfaces represented as a level-set of an embedding From fc059fc8c6bcad531f1f126bff51761ba130cca9 Mon Sep 17 00:00:00 2001 From: Francesco Nattino Date: Thu, 8 Jun 2023 11:44:01 +0200 Subject: [PATCH 2/2] avoid import of library before dependencies are installed --- morphsnakes.py | 1 - setup.py | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/morphsnakes.py b/morphsnakes.py index c5734ff..9e6c19b 100644 --- a/morphsnakes.py +++ b/morphsnakes.py @@ -65,7 +65,6 @@ ] __version__ = (2, 1, 1) -__version_str__ = ".".join(map(str, __version__)) class _fcycle(object): diff --git a/setup.py b/setup.py index f80cec8..c4ab8ba 100644 --- a/setup.py +++ b/setup.py @@ -5,11 +5,23 @@ except ImportError: from distutils.core import setup -from morphsnakes import __version_str__ + +def get_version(): + """ Avoid importing package before dependencies are installed. """ + values = {} + with open("morphsnakes.py", "r") as f: + for line in f.readlines(): + if "__version__" in line: + exec(line, {}, values) + break + + version = values.get("__version__", (0, 1, 0)) + return ".".join(map(str, version)) + setup( name="morphsnakes", - version=__version_str__, + version=get_version(), description="Morphological Snakes", author="Pablo Márquez Neila", author_email="pablo.marquez@artorg.unibe.ch",