forked from usnistgov/pyPRISM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
113 lines (105 loc) · 4.03 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
from setuptools import setup,Extension,find_packages
## GET VERSION
import versiontools
version = versiontools.get_python_version()
## HANDLE CYTHON
# Cython needs to be handled with care as PIP cannot know to install cython
# *before* it gets to the setup.py. We handle this by following the suggestion
# here: https://stackoverflow.com/questions/4505747
try:
from Cython.Distutils import build_ext
from Cython.Build import cythonize
import numpy as np
except ImportError:
# Cython is not installed! Create C-extensions using c-files
use_cython = False
print('Using Cython to build extension from pyx!')
else:
# Cython is installed! Create C-extensions using pyx-files
use_cython = True
print('Warning! Building extension from c-files, which may be out-of-date.')
## DETECT OS
# We need to be able handle the idiosyncracies of different OS
from sys import platform as _platform
if _platform == "linux" or _platform == "linux2": #Linux
extra_compile_args = ['-fopenmp']
extra_link_args = ['-fopenmp']
elif _platform == "darwin":# MAC OSX
extra_compile_args = None
extra_link_args = None
elif _platform == "win32": # Windows 32-bit
extra_compile_args = None
extra_link_args = None
elif _platform == "win64": # Windows 64-bit
extra_compile_args = None
extra_link_args = None
else: # Catch-All
extra_compile_args = None
extra_link_args = None
## IF CYTHON
cmdclass = {}
ext_modules = []
if use_cython:
ext_modules += [
Extension('pyPRISM.trajectory.Debyer',
[ 'pyPRISM/trajectory/Debyer.pyx' ],
include_dirs=[np.get_include()],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args
),
]
ext_modules = cythonize(ext_modules)
cmdclass.update({'build_ext':build_ext})
else:
ext_modules += [
Extension('pyPRISM.trajectory.Debyer',
[ 'pyPRISM/trajectory/Debyer.c' ],
#include_dirs=[np.get_include()],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args
),
]
setup(
name='pyPRISM',
description='A python tool for Polymer Reference Interaction Site Model (PRISM) calculations',
author='Tyler B. Martin',
author_email = 'tyler.martin@nist.gov',
url = 'https://github.com/usnistgov/pyprism',
version=version,
license='LICENSE',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: Freely Distributable',
'License :: Freeware',
'License :: Public Domain',
'Natural Language :: English',
'Operating System :: MacOS',
'Operating System :: Microsoft',
'Operating System :: Unix',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 2 :: Only',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Chemistry',
'Topic :: Scientific/Engineering :: Physics',
],
keywords = 'materials science polymer theory simulation X-ray neutron scattering liquid-state nanocomposite',
project_urls = {
'Bug Reports': 'https://github.com/usnistgov/pyprism/issues',
'Source': 'https://github.com/usnistgov/pyprism',
'Documentation': 'http://pyPRISM.readthedocs.io',
},
install_requires = ['numpy>=1.8.0','scipy','Cython','pint'],
packages=find_packages(where='.'),
package_data={'pyPRISM':['test/data/*dat','test/data/*csv']},
ext_modules= ext_modules,
cmdclass = cmdclass,
)