Skip to content

Commit 878ced8

Browse files
committed
(BUGFIX) added version number to setup.py
1 parent 06679a2 commit 878ced8

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

setup.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,28 @@
22
from setuptools import setup, find_packages
33
from Cython.Build import cythonize
44
import numpy
5+
import os
6+
import codecs
7+
def read(rel_path):
8+
here = os.path.abspath(os.path.dirname(__file__))
9+
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
10+
return fp.read()
11+
12+
def get_version(rel_path):
13+
for line in read(rel_path).splitlines():
14+
if line.startswith('__version__'):
15+
delim = '"' if '"' in line else "'"
16+
return line.split(delim)[1]
17+
else:
18+
raise RuntimeError("Unable to find version string.")
519

620
setup(
721
name="LoopStructural",
822
install_requires=[
923
'Cython'
1024
],
11-
packages=find_packages(),
25+
version=get_version("LoopStructural/__init__.py"),
26+
packages=find_packages(),
1227
ext_modules=cythonize("LoopStructural/interpolators/cython/*.pyx",compiler_directives={"language_level": "3"}),
1328
include_dirs=[numpy.get_include()],
1429
include_package_data=True,

0 commit comments

Comments
 (0)