-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
88 lines (75 loc) · 2.16 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
#****************************************************************************
#* setup.py for jitcc
#****************************************************************************
import os
import sys
import platform
from setuptools import Extension, find_namespace_packages
version="0.0.1"
proj_dir = os.path.dirname(os.path.abspath(__file__))
try:
import sys
sys.path.insert(0, os.path.join(proj_dir, "python"))
from jitcc.__build_num__ import BUILD_NUM
version += ".%s" % str(BUILD_NUM)
except ImportError:
pass
isSrcBuild = False
try:
from ivpm.setup import setup
isSrcBuild = os.path.isdir(os.path.join(proj_dir, "src"))
print("jitcc: running IVPM SrcBuild")
except ImportError as e:
from setuptools import setup
print("jitcc: running non-src build (%s)" % str(e))
if isSrcBuild:
incdir = os.path.join(proj_dir, "src", "include")
else:
incdir = os.path.join(proj_dir, "python/jitcc/share/include")
vsc_dir = proj_dir
ext = Extension("jitcc.core",
sources=[
os.path.join(vsc_dir, 'python', "core.pyx"),
],
language="c++",
include_dirs=[incdir]
)
ext.cython_directives={'language_level' : '3'}
setup_args = dict(
name = "jitcc",
version=version,
packages=find_namespace_packages(where='python'),
package_dir = {'' : 'python'},
author = "Matthew Ballance",
author_email = "[email protected]",
description = ("Supports compiling and running C code on the fly"),
long_description="""
Support for compiling and running C code on the fly
""",
license = "Apache 2.0",
keywords = ["JIT", "Verilog", "RTL", "Python"],
url = "https://github.com/mballance-utils/jitcc",
entry_points={
'ivpm.pkginfo': [
'jitcc = jitcc.pkginfo:PkgInfo'
]
},
install_requires=[
'debug-mgr',
],
setup_requires=[
'setuptools_scm',
'cython'
],
ext_modules=[ ext ]
)
if isSrcBuild:
setup_args["ivpm_extdep_pkgs"] = ["debug-mgr"]
setup_args["ivpm_extra_data"] = {
"jitcc": [
("src/include", "share"),
("build/{libdir}/{libpref}jitcc{dllext}", ""),
("build/{libdir}/{libpref}tcc{dllext}", "")
]
}
setup(**setup_args)