forked from m-labs/llvmlite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
116 lines (95 loc) · 3.62 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
try:
from setuptools import setup, Extension
from setuptools.command.build_py import build_py as build
from setuptools.command.build_ext import build_ext
from setuptools.command.install import install
except ImportError:
from distutils.core import setup, Extension
from distutils.command.build import build
from distutils.command.build_ext import build_ext
from distutils.command.install import install
from distutils.spawn import spawn
import os
import sys
if os.environ.get('READTHEDOCS', None) == 'True':
sys.exit("setup.py disabled on readthedocs: called with %s"
% (sys.argv,))
from llvmlite.utils import get_library_files
import versioneer
versioneer.VCS = 'git'
versioneer.versionfile_source = 'llvmlite/_version.py'
versioneer.versionfile_build = 'llvmlite/_version.py'
versioneer.tag_prefix = 'v' # tags are like v1.2.0
versioneer.parentdir_prefix = 'llvmlite-' # dirname like 'myproject-1.2.0'
here_dir = os.path.dirname(__file__)
cmdclass = versioneer.get_cmdclass()
build = cmdclass.get('build', build)
build_ext = cmdclass.get('build_ext', build_ext)
class LlvmliteBuild(build):
def finalize_options(self):
build.finalize_options(self)
# The build isn't platform-independent
if self.build_lib == self.build_purelib:
self.build_lib = self.build_platlib
def get_sub_commands(self):
# Force "build_ext" invocation.
commands = build.get_sub_commands(self)
for c in commands:
if c == 'build_ext':
return commands
return ['build_ext'] + commands
class LlvmliteBuildExt(build_ext):
def run(self):
build_ext.run(self)
cmd = [sys.executable, os.path.join(here_dir, 'ffi', 'build.py')]
spawn(cmd, dry_run=self.dry_run)
# HACK: this makes sure the library file (which is large) is only
# included in binary builds, not source builds.
self.distribution.package_data = {
"llvmlite.binding": get_library_files(),
}
class LlvmliteInstall(install):
# Ensure install see the libllvmlite shared library
# This seems to only be necessary on OSX.
def run(self):
self.distribution.package_data = {
"llvmlite.binding": get_library_files(),
}
install.run(self)
cmdclass.update({'build': LlvmliteBuild,
'build_ext': LlvmliteBuildExt,
'install': LlvmliteInstall,
})
packages = ['llvmlite',
'llvmlite.binding',
'llvmlite.ir',
'llvmlite.llvmpy',
'llvmlite.tests',
]
install_requires = []
if sys.version_info < (3, 4):
install_requires.append('enum34')
setup(name='llvmlite',
description="lightweight wrapper around basic LLVM functionality",
version=versioneer.get_version(),
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Topic :: Software Development :: Code Generators",
"Topic :: Software Development :: Compilers",
],
# Include the separately-compiled shared library
author="Continuum Analytics, Inc.",
author_email="numba-users@continuum.io",
url="http://llvmlite.pydata.org",
download_url="https://github.com/numba/llvmlite",
packages=packages,
install_requires=install_requires,
license="BSD",
cmdclass=cmdclass,
)