forked from unibe-cns/NEAT
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
executable file
·86 lines (72 loc) · 2.67 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
NEAT (NEural Analysis Toolkit)
Author: W. Wybo
"""
import re
from setuptools import setup
from setuptools.extension import Extension
from Cython.Build import cythonize
import os, subprocess, shutil, sys
def read_version():
with open("./neat/__version__.py") as f:
line = f.read()
match = re.findall(r"[0-9]+\.[0-9]+\.[0-9]+", line)
return match[0]
def read_requirements():
with open('./requirements/requirements.txt') as fp:
requirements = fp.read()
return requirements
class DelayedIncludeDirs(list):
"""Delay importing of numpy until extension is built. This allows pip
to install numpy if it's not available.
"""
def __init__(self):
super().__init__()
# WARNING: for some reason we need to have a non-empty list otherwise
# __iter__ is never called; this dummy value is never used!
self.append('dummy value')
def __iter__(self):
import numpy
return iter([numpy.get_include(), "neat/tools/simtools/net/*.h"])
ext = Extension(name="netsim",
sources=["neat/tools/simtools/net/netsim.pyx",
"neat/tools/simtools/net/Ionchannels.cc",
"neat/tools/simtools/net/netsim.pyx",
"neat/tools/simtools/net/NETC.cc",
"neat/tools/simtools/net/Synapses.cc",
"neat/tools/simtools/net/Tools.cc"
],
language="c++",
extra_compile_args=["-w", "-O3", "-std=gnu++11"],
include_dirs=DelayedIncludeDirs(),
)
s_ = setup(
name='neatdend',
version=read_version(),
scripts=['neat/channels/compilechannels'],
packages=['neat',
'neat.trees',
'neat.tools',
'neat.tools.fittools',
'neat.tools.plottools',
'neat.tools.simtools.neuron',
'neat.channels',
'neat.channels.channelcollection'],
package_data={
"neat.tools.simtools.neuron": ["mech_storage/*.mod"],
},
ext_package='neat',
ext_modules=cythonize([ext], language_level=3),
include_package_data=True,
author='Willem Wybo, Jakob Jordan, Benjamin Ellenberger',
classifiers=['Development Status :: 3 - Alpha',
'Programming Language :: Python :: 3.7',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)'],
license='GPLv3',
url='https://github.com/unibe-cns/NEAT',
long_description=open('README.rst').read(),
long_description_content_type="text/x-rst",
install_requires=read_requirements(),
)