-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
68 lines (52 loc) · 2.2 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
#!/usr/bin/env python
from distutils.core import setup, Extension
from distutils.command.build_ext import build_ext
import os
class CustomBuildExtCommand(build_ext):
"""build_ext command for use when numpy headers are needed."""
def run(self):
# Import numpy here, only when headers are needed
import numpy
# Add numpy headers to include_dirs
self.include_dirs.append(numpy.get_include())
# Call original build_ext command
build_ext.run(self)
approx_c = Extension('mistofrutta.approx._approx_c',
sources = ['mistofrutta/approx/_approx_c.cpp'],
include_dirs = [],
extra_compile_args=['-ffast-math','-Ofast'])
_ft = Extension('mistofrutta.ft._ft',
sources = ['mistofrutta/ft/_ft.cpp','mistofrutta/ft/ft.cpp'],
include_dirs = [],
extra_compile_args=['-ffast-math','-Ofast'])
_convolve = Extension('mistofrutta.convolve._convolve',
sources = ['mistofrutta/convolve/_convolve.cpp','mistofrutta/convolve/convolve.cpp'],
include_dirs = [],
extra_compile_args=['-ffast-math','-Ofast'])
if os.name == "nt":
os.environ['GIT_PYTHON_GIT_EXECUTABLE'] = 'C:\Program Files\Git\cmd\git.exe'
import numpy
approx_c.include_dirs.append(numpy.get_include())
_ft.include_dirs.append(numpy.get_include())
_convolve.include_dirs.append(numpy.get_include())
import git
# Get git commit info to build version number/tag
repo = git.Repo('.git')
git_hash = repo.head.object.hexsha
git_url = repo.remotes.origin.url
v = repo.git.describe(always=True)
if repo.is_dirty(): v += ".dirty"
requirements = [
"numpy",
"matplotlib",
"shapely",
]
setup(name='mistofrutta',
version=v,
description='Collection of random utilities',
author='Francesco Randi',
author_email='[email protected]',
packages=['mistofrutta','mistofrutta.plt','mistofrutta.geometry','mistofrutta.struct','mistofrutta.approx','mistofrutta.ft', 'mistofrutta.num'],
install_requires=requirements,
ext_modules = [approx_c, _ft, _convolve]
)