forked from cnvogelg/amitools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
118 lines (104 loc) · 3.03 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
117
from __future__ import print_function
import os
import sys
import setuptools.command.build_ext
from subprocess import call
from setuptools import setup, find_packages
from distutils.extension import Extension
# has cython?
try:
from Cython.Build import cythonize
has_cython = True
except ImportError:
has_cython = False
# use cython?
use_cython = has_cython
if '--no-cython' in sys.argv:
use_cython = False
sys.argv.remove('--no-cython')
print("use_cython:", use_cython)
# if generated file is missing cython is required
ext_file = 'musashi/emu.c'
if not os.path.exists(ext_file) and not use_cython:
print("generated cython file missing! cython is essential to proceed!")
print("please install with: pip install cyton")
sys.exit(1)
class BuildPyCommand(setuptools.command.build_ext.build_ext):
"""Custom build command."""
def run(self):
call(['make', 'do_gen'])
setuptools.command.build_ext.build_ext.run(self)
cython_file = 'musashi/emu.pyx'
sourcefiles = [
'musashi/traps.c',
'musashi/mem.c',
'musashi/m68kcpu.c',
'musashi/m68kdasm.c',
'gen/m68kopac.c',
'gen/m68kopdm.c',
'gen/m68kopnz.c',
'gen/m68kops.c'
]
depends = [
'musashi/pycpu.pyx',
'musashi/pymem.pyx',
'musashi/pytraps.pyx'
]
inc_dirs = [
'musashi',
'gen'
]
extensions = [Extension("musashi.emu", sourcefiles,
depends=depends, include_dirs=inc_dirs)]
# use cython?
if use_cython:
sourcefiles.append(cython_file)
extensions = cythonize(extensions)
else:
sourcefiles.append(ext_file)
scripts = {
'console_scripts' : [
'fdtool = amitools.tools.fdtool:main',
'geotool = amitools.tools.geotool:main',
'hunktool = amitools.tools.hunktool:main',
'rdbtool = amitools.tools.rdbtool:main',
'romtool = amitools.tools.romtool:main',
'typetool = amitools.tools.typetool:main',
'vamos = amitools.tools.vamos:main',
'vamospath = amitools.tools.vamospath:main',
'xdfscan = amitools.tools.xdfscan:main',
'xdftool = amitools.tools.xdftool:main'
]
}
setup(
cmdclass = {
'build_ext': BuildPyCommand,
},
name = "amitools",
description='A package to support development with classic Amiga m68k systems',
long_description=open("README.md").read(),
version = "0.1.0",
maintainer = "Christian Vogelgsang",
maintainer_email = "[email protected]",
url = "http://github.com/cnvogelg/amitools",
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python",
"Topic :: System :: Emulators",
],
license = "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
packages = find_packages(),
zip_safe = False,
entry_points = scripts,
setup_requires = ['pytest-runner'],
tests_require= ['pytest'],
# install_requires = ['lhafile==0.2.1'],
dependency_links = [
"http://github.com/FrodeSolheim/python-lhafile/zipball/master#egg=lhafile-0.2.1"
],
ext_modules = extensions,
# win problems:
# use_scm_version=True,
include_package_data=True
)