-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
60 lines (46 loc) · 1.7 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
import os
from setuptools import setup
from setuptools.command.install import install as InstallCommand
from tools.download import get_remote_binary
version = '0.4.0'
local_install = os.environ.get('LOCAL', 0)
with open('README.md', 'r') as f:
long_description = f.read()
class PostInstallCommand(InstallCommand):
"""Post-installation for installation mode."""
def run(self):
if not local_install:
dist = os.path.join(self.build_lib, 'py_sourcemap/py_sourcemap.so')
binary_fp = get_remote_binary(version)
with open(dist, 'wb') as f:
f.write(binary_fp.read())
InstallCommand.run(self)
install_requires = ['wheel']
tests_require = install_requires + ['pytest']
setup(
name='py-sourcemap',
version=version,
packages=['py_sourcemap'],
description='A tiny source-map-mappings bindings for python using PyO3',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/LeetCode-OpenSource/py-sourcemap',
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: Python',
'Programming Language :: Rust',
'License :: OSI Approved :: MIT License',
],
install_requires=install_requires,
tests_require=tests_require,
cmdclass={
'install': PostInstallCommand,
},
# rust extensions are not zip safe, just like C-extensions.
zip_safe=False)