-
Notifications
You must be signed in to change notification settings - Fork 37
/
setup.py
76 lines (61 loc) · 2.53 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
# Py3plex installation file. Cython code for fa2 is the courtesy of Bhargav Chippada.
# https://github.com/bhargavchippada/forceatlas2
from os import path
import sys
from setuptools import setup, find_packages
from setuptools.extension import Extension
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
if "--cpp" in sys.argv:
if path.isfile(path.join(here, 'py3plex/visualization/fa2/fa2util.c')):
print("Using existing visualization engine..")
# cython build locally and add fa2/fa2util.c to MANIFEST or fa2.egg-info/SOURCES.txt
# run: python setup.py build_ext --inplace
ext_modules = [
Extension('fa2.fa2util', ['py3plex/visualization/fa2/fa2util.c'])
]
cmdclass = {}
cythonopts = {"ext_modules": ext_modules, "cmdclass": cmdclass}
else:
print("Compiling the visualization engine..")
cythonopts = None
# Uncomment the following line if you want to install without optimizations
# cythonopts = {"py_modules": ["fa2.fa2util"]}
try:
if cythonopts is None:
from Cython.Build import build_ext
ext_modules = [
Extension('fa2.fa2util', [
'py3plex/visualization/fa2/fa2util.py',
'py3plex/visualization/fa2/fa2util.pxd'
])
]
cmdclass = {'build_ext': build_ext}
cythonopts = {"ext_modules": ext_modules, "cmdclass": cmdclass}
except:
print(
"Installing without optimizations.. Please install gcc for better performance!"
)
cythonopts = {"py_modules": ["py3plex/visualization/fa2.fa2util"]}
sys.argv.remove("--cpp")
else:
cythonopts = {"py_modules": ["py3plex/visualization/fa2.fa2util"]}
def parse_requirements(file):
required_packages = []
with open(path.join(path.dirname(__file__), file)) as req_file:
for line in req_file:
required_packages.append(line.strip())
return required_packages
setup(name='py3plex',
version='0.95a',
description="A Multilayer network analysis python3 library",
url='http://github.com/skblaz/py3plex',
python_requires='>3.6.0',
author='Blaž Škrlj',
author_email='blaz.skrlj@ijs.si',
license='MIT',
packages=find_packages(),
install_requires=parse_requirements("requirements.txt"),
zip_safe=False,
include_package_data=True,
**cythonopts)