-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathsetup.py
95 lines (78 loc) · 2.81 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
import os.path
import sys
import os
from setuptools import setup
from setuptools.extension import Extension
from setuptools.command.test import test as TestCommand
pyx_path = 'bencoder.pyx'
c_path = 'bencoder.c'
if os.path.exists(c_path):
# Remove C file to force Cython recompile.
os.remove(c_path)
if os.environ.get("BENCODER_LINETRACE", "") == "1":
from Cython.Compiler.Options import get_directive_defaults
directive_defaults = get_directive_defaults()
directive_defaults['linetrace'] = True
directive_defaults['binding'] = True
from Cython.Build import cythonize
ext_modules = cythonize(Extension(
"bencoder",
[pyx_path],
extra_compile_args=['-O3']
))
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = []
def run_tests(self):
# import here, cause outside the eggs aren't loaded
import coverage
cov = coverage.Coverage()
cov.start()
import pytest
errno = pytest.main(self.pytest_args)
cov.stop()
cov.save()
sys.exit(errno)
cmdclass = {'test': PyTest}
setup(
name='bencoder.pyx',
version='3.0.1',
description='Yet another bencode implementation in Cython',
long_description=open('README.rst', 'r').read(),
author='whtsky',
author_email='[email protected]',
url='https://github.com/whtsky/bencoder.pyx',
license='BSDv3',
platforms=['POSIX', 'Windows'],
zip_safe=False,
include_package_data=True,
keywords=['bencoding', 'encode', 'decode', 'bittorrent', 'bencode', 'bencoder', 'cython'],
cmdclass=cmdclass,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Other Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Cython',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Utilities',
],
ext_modules=ext_modules,
install_requires=[],
tests_require=['cython', 'pytest', 'coverage'],
)