-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
181 lines (142 loc) · 5.4 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import sys
import os
import logging
from distutils.core import setup, Command
from distutils.extension import Extension
try:
from Cython.Distutils import build_ext
except ImportError:
logging.warn("Cython is preferred over pyrex for python3 compatibility.")
from Pyrex.Distutils import build_ext
DESCRIPTION = open('README.md').read()
EXTRAS = {}
long_description = DESCRIPTION
#import sys
#if "checkdocs" in sys.argv:
# print long_description
METADATA = {
'name': 'pyportmidi',
'version': '0.0.7',
'license': 'MIT License',
'url': 'http://pypi.python.org/pyportmidi/',
'author': 'John Harrison, Roger B. Dannenberg, Rene Dudfield, others...',
'author_email': '[email protected]',
'maintainer': 'Rene Dudfield',
'maintainer_email': '[email protected]',
'description': 'Python Wrappings for PortMidi #python. CHANGES: new package layout.',
'long_description': long_description,
'classifiers': [
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'License :: OSI Approved :: BSD License',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Programming Language :: Cython',
'Programming Language :: C',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.0',
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
'Topic :: Multimedia :: Sound/Audio :: MIDI',
'Topic :: Software Development :: Libraries',
],
}
if "bdist_msi" in sys.argv:
# hack the version name to a format msi doesn't have trouble with
METADATA["version"] = METADATA["version"].replace("pre", "a0")
METADATA["version"] = METADATA["version"].replace("rc", "b0")
METADATA["version"] = METADATA["version"].replace("release", "")
# allow optionally using setuptools for bdist_egg.
using_setuptools = False
if "-setuptools" in sys.argv:
using_setuptools = True
from setuptools import setup, Command
sys.argv.remove ("-setuptools")
EXTRAS.update({'include_package_data': True,
'install_requires': [],
'zip_safe': False,
#'test_suite' : 'pyportmidi.tests',
}
)
# test command. For doing 'python setup.py test'
class TestCommand(Command):
user_options = [ ]
def initialize_options(self):
self._dir = os.getcwd()
def finalize_options(self):
pass
def run(self):
'''
runs the tests with default options.
'''
#import pyportmidi.tests
#pyportmidi.tests.main()
#import subprocess
#return subprocess.call([sys.executable, "run_tests.py"])
cmdclass = {'build_ext': build_ext}
# we use our test command.
if not using_setuptools:
import os
cmdclass['test'] = TestCommand
scripts = []
PACKAGEDATA = {
'cmdclass': cmdclass,
'package_dir': {'pyportmidi': 'pyportmidi',
#'pyportmidi.tests': 'test',
#'pyportmidi.docs': 'docs',
#'pyportmidi.examples': 'examples',
},
'packages': ['pyportmidi',
#'pyportmidi.tests',
],
'scripts': scripts,
}
PACKAGEDATA.update(METADATA)
PACKAGEDATA.update(EXTRAS)
if sys.platform == 'win32':
print("Found Win32 platform")
EXTENSION = dict(
ext_modules=[
Extension("pyportmidi._pyportmidi", [os.path.join("pyportmidi", "_pyportmidi.pyx")],
library_dirs = ["../Release"],
libraries = ["portmidi", "winmm"],
include_dirs = ["../porttime"],
# define_macros = [("_WIN32_", None)]) # needed by portmidi.h
extra_compile_args = ["/DWIN32"]) # needed by portmidi.h
]
)
elif sys.platform == 'darwin':
print("Found darwin (OS X) platform")
library_dirs = ["/usr/local/lib"]
include_dirs = ["/usr/local/include"]
EXTENSION = dict(
ext_modules=[
Extension("pyportmidi._pyportmidi", [os.path.join("pyportmidi", "_pyportmidi.pyx")],
library_dirs = library_dirs,
include_dirs = include_dirs,
libraries = ["portmidi"],
extra_link_args=["-framework", "CoreFoundation",
"-framework", "CoreMIDI",
"-framework", "CoreAudio"])
]
)
else:
print("Assuming Linux platform")
EXTENSION = dict(
ext_modules=[
Extension("pyportmidi._pyportmidi",
[os.path.join("pyportmidi", "_pyportmidi.pyx")],
library_dirs=["./linux"],
#include_dirs=["../pm_common", "../porttime"],
libraries = ["portmidi", "asound", "pthread"]
)
]
)
PACKAGEDATA.update(EXTENSION)
setup(**PACKAGEDATA)