forked from greole/owls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
51 lines (40 loc) · 1.4 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
46
47
48
49
50
51
import os
import subprocess
import sys
from setuptools import setup
#from io import open
package_name = 'Owls'
# Fetch version from git tags, and write to version.py.
# Also, when git is not available (PyPi package), use stored version.py.
version_py = os.path.join(os.path.dirname(__file__), 'Owls/version.py')
try:
version_git = subprocess.check_output(["git", "describe"], universal_newlines=True).rstrip()
except:
with open(version_py, 'w') as fh:
version_git = open(version_py).read().strip().split('=')[-1].replace('"','')
version_msg = "# Do not edit this file, pipeline versioning is governed by git tags"
with open(version_py, 'w') as fh:
fh.write(version_msg + os.linesep + "__version__='{}'".format(version_git))
# Get the version from Owls/version.py without importing the package
# exec(compile(open(package_name + '/version.py').read(),
# package_name + '/version.py', 'exec'))
packages = [
'future',
'numpy',
'pandas',
'functional',
]
if '--with-matplotlib' in sys.argv:
packages.extend('matplotlib')
config = {
'author': 'Gregor Olenik',
'author_email': '[email protected]',
'description': 'A simple library for reading and processing OpenFOAM data',
'license': 'BSD',
'version': version_git,
'packages': [package_name],
'install_requires': packages,
'name': package_name,
'zip_safe': False
}
setup(**config)