diff --git a/deodr/__init__.py b/deodr/__init__.py index 0844d8f..92a878e 100644 --- a/deodr/__init__.py +++ b/deodr/__init__.py @@ -9,6 +9,8 @@ Martin de La Gorce. 2019. """ +__version__ = "0.1.17" + __all__ = [ "Scene2D", "Scene3D", @@ -20,14 +22,11 @@ ] import os - from .differentiable_renderer import Camera, Scene2D, Scene3D from .laplacian_rigid_energy import LaplacianRigidEnergy from .obj import read_obj from .triangulated_mesh import ColoredTriMesh, TriMesh root_path = os.path.dirname(__file__) -with open(os.path.join(root_path, "version.txt")) as f: - __version__ = f.read().strip() data_path = os.path.join(root_path, "data") diff --git a/setup.py b/setup.py index af32b94..61132ac 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ """Setup script for the DEODR project.""" import os +import re from setuptools import setup, find_packages from Cython.Build import cythonize @@ -24,9 +25,15 @@ libname = "deodr" -with open(os.path.join(os.path.dirname(__file__), "deodr", "version.txt")) as f: - version = f.read().strip() - +with open(os.path.join(os.path.dirname(__file__), 'deodr', '__init__.py')) as fp: + for line in fp: + m = re.search(r'^\s*__version__\s*=\s*([\'"])([^\'"]+)\1\s*$', line) + if m: + version = m.group(2) + break + else: + raise RuntimeError('Unable to find own __version__ string') +print(f"version = {version}") setup( name=libname, version=version,