-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
executable file
·88 lines (68 loc) · 2.48 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
#!/usr/bin/env python
import os
from setuptools import setup
from distutils.util import get_platform
from getdlls import getDLLs
# Get the necessary SDL2 DLLs for the platform
override = os.getenv('SDL2DLL_PLATFORM')
platform = get_platform() if not override else override
getDLLs(platform)
# Gather list of all dll files so that they can be included in wheels, but not sdist
dllpath = os.path.join('sdl2dll', 'dll')
dllfiles = []
for path, _, files in os.walk(dllpath):
for f in files:
parentdir = 'sdl2dll' + os.sep
filepath = os.path.join(path, f).replace(parentdir, '')
dllfiles.append(filepath)
# Patch wheel naming to be platform-specific but Python version/ABI independent
cmdclass = {}
try:
from wheel.bdist_wheel import bdist_wheel
class bdist_wheel_half_pure(bdist_wheel):
def get_tag(self):
if 'macosx' in platform:
system = 'macosx_10_11_universal2'
if os.getenv('MACOS_LEGACY_WHEEL'):
system = 'macosx_10_11_x86_64'
elif platform in ['win32', 'win-amd64']:
system = platform.replace('-', '_')
elif 'manylinux' in platform:
arch = get_platform().split('-')[-1]
system = '_'.join([platform, arch])
else:
system = 'any'
return 'py2.py3', 'none', system
cmdclass['bdist_wheel'] = bdist_wheel_half_pure
except ImportError:
pass
# Install the package
with open('README.md', 'r') as f:
long_description = f.read()
setup(
name='pysdl2-dll',
version='2.30.10',
author='Austin Hurst',
author_email='[email protected]',
license='Mozilla Public License Version 2.0',
description='Pre-built SDL2 binaries for PySDL2',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/a-hurst/pysdl2-dll',
packages=['sdl2dll'],
cmdclass=cmdclass,
package_data={'sdl2dll': dllfiles},
include_package_data=True,
install_requires=[],
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Topic :: Software Development :: Libraries'
]
)