-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsetup.py
executable file
·45 lines (36 loc) · 1.43 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# NO META-DATA here except for dynamic parameters and cython
from setuptools import setup, find_packages, Extension
import os
import re
import numpy as np
cmdclass = {}
ext_modules = []
# include_dirs is needed here for MAC OS systems
ext_modules += [
Extension("mews.cython.markov",
["src/mews/cython/markov.pyx"],
include_dirs=[np.get_include()]),
Extension("mews.cython.markov_time_dependent",
["src/mews/cython/markov_time_dependent.pyx"],
include_dirs=[np.get_include()])
]
def readme_function():
file_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(file_dir, 'README.md'), encoding='utf-8') as f:
LONG_DESCRIPTION = f.read()
return LONG_DESCRIPTION
def version_function():
# get version from __init__.py
file_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(file_dir, 'src', 'mews', '__init__.py')) as f:
version_file = f.read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
VERSION = version_match.group(1)
else:
raise RuntimeError("Unable to find version string.")
return VERSION
setup(version=version_function(),
ext_modules=ext_modules,
long_description=readme_function())