-
Notifications
You must be signed in to change notification settings - Fork 161
/
setup.py
executable file
·97 lines (86 loc) · 3.45 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
#!/usr/bin/env python
from setuptools import setup
from setuptools.command.develop import develop
import distutils.log
from distutils.command.build import build
from distutils.cmd import Command
def read_text_file(path):
import os
with open(os.path.join(os.path.dirname(__file__), path)) as f:
return f.read()
class BuildGenerateInstructions(build):
def run(self):
self.run_command("generate")
build.run(self)
class DevelopGenerateInstructions(develop):
def run(self):
self.run_command("generate")
develop.run(self)
class GenerateInstructions(Command):
description = "Generate PeachPy instructions from Opcodes DB"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
# package_dir may be None, in that case use the current directory.
import os
if not self.distribution.package_dir:
src_dir = os.getcwd()
else:
src_dir = os.path.abspath(self.distribution.package_dir[""])
# Run code-generation script
import opcodes
self.announce("Generating x86-64 instruction classes from opcodes %s" % opcodes.__version__,
level=distutils.log.INFO)
import codegen.x86_64
codegen.x86_64.main(src_dir)
setup(
name="PeachPy",
version="0.2.0",
description="Portable Efficient Assembly Codegen in Higher-level Python",
author="Marat Dukhan",
author_email="[email protected]",
url="https://github.com/Maratyszcza/PeachPy/",
packages=["peachpy", "peachpy.c",
"peachpy.common", "peachpy.x86_64", "peachpy.arm",
"peachpy.formats", "peachpy.formats.elf", "peachpy.formats.macho", "peachpy.formats.mscoff"],
keywords=["assembly", "codegen", "x86-64"],
long_description=read_text_file("README.rst"),
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: POSIX :: FreeBSD",
"Operating System :: MacOS :: MacOS X",
"Programming Language :: Assembly",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Natural Language :: English",
"Topic :: Scientific/Engineering",
"Topic :: Software Development",
"Topic :: Software Development :: Assemblers",
"Topic :: Software Development :: Code Generators",
"Topic :: Software Development :: Compilers",
"Topic :: Software Development :: Libraries"
],
setup_requires=["Opcodes>=0.3.13", "six"],
install_requires=["six", 'enum34;python_version<"3.4"'],
cmdclass={
"build": BuildGenerateInstructions,
"develop": DevelopGenerateInstructions,
"generate": GenerateInstructions,
})