-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
64 lines (58 loc) · 2.51 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
from __future__ import print_function
import sys
from setuptools import setup, Extension, find_packages
import subprocess
import platform
if sys.version_info < (3,4):
print("SMPDF requires Python 3.4 or later", file=sys.stderr)
sys.exit(1)
def call_command(command):
l = command.split()
try:
result = subprocess.check_output(l)
except OSError as e:
print("Could not call %s: %s.\n"
"Please make sure the relevant command is isntalled."
% (l[0], e.strerror), file=sys.stderr)
sys.exit(1)
return result.decode().rstrip()
lhapdf_includes = call_command('lhapdf-config --cflags').split()
lhapdf_libs = call_command('lhapdf-config --libs').split()
applgrid_includes = call_command('applgrid-config --cxxflags').split()
applgrid_libs = call_command('applgrid-config --ldflags').split()
extra_compile_args = lhapdf_includes + applgrid_includes
extra_link_args = lhapdf_includes + applgrid_includes + applgrid_libs + lhapdf_libs
if platform.system() == 'Darwin':
mac_ver = platform.mac_ver()[0]
extra_compile_args += ['-mmacosx-version-min=%s' % mac_ver]
extra_link_args += ['-mmacosx-version-min=%s' % mac_ver]
module1 = Extension('applwrap',
extra_compile_args = extra_compile_args ,
extra_link_args = extra_link_args,
sources = ['src/applwrap/applwrap.cc'], language="c++")
setup (name = 'smpdf',
version = '1.1',
description = "PDFs for phenomenology",
author = 'Stefano Carrazza and Zahari Kassabov',
author_email = 'kassabov@to.infn.it',
url = 'https://github.com/scarrazza/smpdf',
long_description = "See `smpdf --help` for the full list of options",
ext_modules = [module1],
#http://stackoverflow.com/questions/24799146/use-multiprocessing-process-inside-a-script-installed-by-setuptools
entry_points = {'console_scripts': ['smpdf = _smpdf_scripts.smpdf:main']},
package_dir = {'': 'src'},
packages = find_packages('src'),
package_data = {
'':['*.template', '*.mplstyle']
},
zip_safe = False,
classifiers=[
'License :: OSI Approved :: GNU General Public License (GPL)',
'Operating System :: Unix',
'Programming Language :: Python',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Physics',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
],
)