-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·85 lines (68 loc) · 2.28 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
from setuptools import setup
from setuptools import find_packages
from distutils.cmd import Command
from setuptools.extension import Extension
import os
import sys
import io
import subprocess
import platform
# Make sure numpy and Cython get installed first.
from setuptools import dist
dist.Distribution().fetch_build_eggs(['Cython>=0.29.15', 'numpy>=1.18.0'])
import numpy as np
from Cython.Build import cythonize
# import Cython.Compiler.Options
# Cython.Compiler.Options.annotate = True
if "--line_trace" in sys.argv:
line_trace = True
print("Build with line trace enabled ...")
sys.argv.remove("--line_trace")
else:
line_trace = False
PACKAGE = "diesel"
NAME = "DIESEL"
VERSION = "0.0.1"
DESCRIPTION = "DIstributed EStimation of EnsembLe Covariance " + VERSION
AUTHOR = "Cedric Travelletti"
AUTHOR_EMAIL = "cedrictravelletti@gmail.com"
URL = 'https://github.com/CedricTravelletti/DIESEL'
requirements = "requirements.txt"
ext_modules = [
"diesel/haversine.pyx",
]
def generate_extensions(ext_modules, line_trace=False):
extensions = []
if line_trace:
print("define cython trace to True ...")
define_macros = [('CYTHON_TRACE', 1), ('CYTHON_TRACE_NOGIL', 1)]
else:
define_macros = []
for pyxfile in ext_modules:
ext = Extension(name='.'.join(pyxfile.split('/'))[:-4],
sources=[pyxfile],
define_macros=define_macros)
extensions.append(ext)
return extensions
n_cpu = 4
ext_modules_settings = cythonize(
generate_extensions(ext_modules, line_trace),
compiler_directives={'embedsignature': True, 'linetrace': line_trace}, nthreads=n_cpu)
setup(
name=NAME,
version=VERSION,
description=DESCRIPTION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
# packages=find_packages(),
packages=['diesel' 'diesel.haversine'],
include_package_data=False,
install_requires=[# io.open(requirements, encoding='utf8').read(),
# 'mvnorm @ git+https://github.com/CedricTravelletti/torch-mvnorm.git#egg=mvnorm'
],
classifiers=[],
# ext_modules=ext_modules_settings,
ext_modules=cythonize([Extension("diesel.haversine", sources=["diesel/haversine.pyx"])]),
include_dirs=[np.get_include(), '.', './diesel/'],
)