-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
78 lines (63 loc) · 2.07 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import re
import glob
import subprocess
try:
from setuptools import setup
setup
except ImportError:
from distutils.core import setup
setup
VERSION = "0.7"
from pybind11 import get_cmake_dir
from pybind11.setup_helpers import Pybind11Extension, build_ext
srcs = glob.glob("forcepho/src/compute_gaussians_kernel.cc")
srcs.sort()
ext_modules = [
Pybind11Extension("forcepho.src.compute_gaussians_kernel",
srcs,
include_dirs=["forcepho/src"],
cxx_std=11,
# Example: passing in the version to the compiled code
# define_macros = [('VERSION_INFO', get_gitvers())],
),
]
def get_gitvers(version=VERSION):
try:
process = subprocess.Popen(
['git', 'rev-parse', '--short', 'HEAD'], shell=False, stdout=subprocess.PIPE,
universal_newlines=True, encoding="utf-8")
git_head_hash = process.communicate()[0].strip()
#git_head_hash = git_head_hash.decode("utf-8")
version = f"{version}+{git_head_hash}"
except:
pass
with open("./forcepho/_version.py", "w") as f:
f.write(f"__version__ = '{version}'")
return version
setup(
name="forcepho",
url="https://github.com/bd-j/forcepho",
version=get_gitvers(),
author="Ben Johnson",
author_email="benjamin.johnson@cfa.harvard.edu",
packages=["forcepho",
#"forcepho.src",
"forcepho.mixtures",
"forcepho.patches",
"forcepho.slow",
"forcepho.utils"],
ext_modules=ext_modules,
#cmdclass={"build_ext": build_ext},
#license="LICENSE",
description="Image Forward Modeling",
long_description=open("README.md").read(),
package_data={"": ["README.md", "LICENSE"],
"forcepho": ["src/*.cu", "src/*.cc", "src/*.h", "src/*.hh"]},
#scripts=glob.glob("scripts/*.py"),
include_package_data=True,
install_requires=["numpy", "pybind11"],
)