|
7 | 7 |
|
8 | 8 | from setuptools import setup
|
9 | 9 |
|
10 |
| -extra = {'ext_modules': []} |
| 10 | +extra = {"ext_modules": []} |
11 | 11 | try:
|
12 | 12 | from Cython.Build import cythonize
|
13 |
| - p = os.path.join('src', 'wheezy', 'html') |
14 |
| - extra['ext_modules'] += cythonize( |
15 |
| - [os.path.join(p, '*.py'), |
16 |
| - os.path.join(p, 'ext', '*.py')], |
17 |
| - exclude=[os.path.join(p, '__init__.py'), |
18 |
| - os.path.join(p, 'ext', '__init__.py')], |
19 |
| - nthreads=2, quiet=True) |
| 13 | + |
| 14 | + p = os.path.join("src", "wheezy", "html") |
| 15 | + extra["ext_modules"] += cythonize( |
| 16 | + [os.path.join(p, "*.py"), os.path.join(p, "ext", "*.py")], |
| 17 | + exclude=[ |
| 18 | + os.path.join(p, "__init__.py"), |
| 19 | + os.path.join(p, "ext", "__init__.py"), |
| 20 | + ], |
| 21 | + nthreads=2, |
| 22 | + quiet=True, |
| 23 | + ) |
20 | 24 | except ImportError:
|
21 | 25 | pass
|
22 | 26 |
|
23 |
| -can_build_ext = getattr( |
24 |
| - platform, 'python_implementation', |
25 |
| - lambda: None |
26 |
| -)() != 'PyPy' and 'java' not in sys.platform |
| 27 | +can_build_ext = ( |
| 28 | + getattr(platform, "python_implementation", lambda: None)() != "PyPy" |
| 29 | + and "java" not in sys.platform |
| 30 | +) |
27 | 31 |
|
28 | 32 | if can_build_ext: # noqa: C901
|
29 |
| - from distutils.core import Extension # noqa |
30 | 33 | from distutils.command.build_ext import build_ext # noqa
|
31 |
| - sources = [os.path.join('src', 'wheezy', 'html', 'boost.c')] |
32 |
| - extra['ext_modules'] += [Extension('wheezy.html.boost', sources)] |
| 34 | + from distutils.core import Extension # noqa |
33 | 35 |
|
34 |
| - class BuildExtOptional(build_ext): |
| 36 | + sources = [os.path.join("src", "wheezy", "html", "boost.c")] |
| 37 | + extra["ext_modules"] += [Extension("wheezy.html.boost", sources)] |
35 | 38 |
|
| 39 | + class BuildExtOptional(build_ext): |
36 | 40 | def run(self):
|
37 | 41 | from distutils.errors import DistutilsPlatformError
|
| 42 | + |
38 | 43 | try:
|
39 | 44 | build_ext.run(self)
|
40 | 45 | except DistutilsPlatformError:
|
41 | 46 | self.warn()
|
42 | 47 |
|
43 | 48 | def build_extension(self, ext):
|
44 |
| - from distutils.errors import CCompilerError |
45 |
| - from distutils.errors import DistutilsExecError |
| 49 | + from distutils.errors import CCompilerError, DistutilsExecError |
| 50 | + |
46 | 51 | try:
|
47 | 52 | build_ext.build_extension(self, ext)
|
48 | 53 | except (CCompilerError, DistutilsExecError):
|
49 | 54 | self.warn()
|
50 | 55 |
|
51 | 56 | def warn(self):
|
52 |
| - print(' WARNING '.center(44, '*')) |
53 |
| - print('An optional extension could not be compiled.') |
| 57 | + print(" WARNING ".center(44, "*")) |
| 58 | + print("An optional extension could not be compiled.") |
54 | 59 |
|
55 |
| - extra['cmdclass'] = {'build_ext': BuildExtOptional} |
| 60 | + extra["cmdclass"] = {"build_ext": BuildExtOptional} |
56 | 61 |
|
57 |
| -README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read() |
| 62 | +README = open(os.path.join(os.path.dirname(__file__), "README.md")).read() |
58 | 63 | VERSION = (
|
59 | 64 | re.search(
|
60 |
| - r'__version__ = "(.+)"', |
61 |
| - open("src/wheezy/html/__init__.py").read(), |
| 65 | + r'__version__ = "(.+)"', open("src/wheezy/html/__init__.py").read(), |
62 | 66 | )
|
63 | 67 | .group(1)
|
64 | 68 | .strip()
|
65 | 69 | )
|
66 | 70 |
|
67 | 71 | setup(
|
68 |
| - name='wheezy.html', |
| 72 | + name="wheezy.html", |
69 | 73 | version=VERSION,
|
70 |
| - description='A lightweight html rendering library', |
| 74 | + description="A lightweight html rendering library", |
71 | 75 | long_description=README,
|
72 |
| - long_description_content_type='text/markdown', |
73 |
| - url='https://github.com/akornatskyy/wheezy.html', |
74 |
| - author='Andriy Kornatskyy', |
75 |
| - author_email='andriy.kornatskyy@live.com', |
76 |
| - license='MIT', |
| 76 | + long_description_content_type="text/markdown", |
| 77 | + url="https://github.com/akornatskyy/wheezy.html", |
| 78 | + author="Andriy Kornatskyy", |
| 79 | + author_email="andriy.kornatskyy@live.com", |
| 80 | + license="MIT", |
77 | 81 | classifiers=[
|
78 |
| - 'Environment :: Web Environment', |
79 |
| - 'Intended Audience :: Developers', |
80 |
| - 'License :: OSI Approved :: MIT License', |
81 |
| - 'Natural Language :: English', |
82 |
| - 'Operating System :: OS Independent', |
83 |
| - 'Programming Language :: Python', |
84 |
| - 'Programming Language :: Python :: 2', |
85 |
| - 'Programming Language :: Python :: 2.4', |
86 |
| - 'Programming Language :: Python :: 2.5', |
87 |
| - 'Programming Language :: Python :: 2.6', |
88 |
| - 'Programming Language :: Python :: 2.7', |
89 |
| - 'Programming Language :: Python :: 3', |
90 |
| - 'Programming Language :: Python :: 3.2', |
91 |
| - 'Programming Language :: Python :: 3.3', |
92 |
| - 'Programming Language :: Python :: 3.4', |
93 |
| - 'Programming Language :: Python :: 3.5', |
94 |
| - 'Programming Language :: Python :: 3.6', |
95 |
| - 'Programming Language :: Python :: 3.7', |
96 |
| - 'Programming Language :: Python :: 3.8', |
97 |
| - 'Programming Language :: Python :: Implementation :: CPython', |
98 |
| - 'Programming Language :: Python :: Implementation :: PyPy', |
99 |
| - 'Topic :: Internet :: WWW/HTTP', |
100 |
| - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', |
101 |
| - 'Topic :: Software Development :: Libraries :: Python Modules', |
102 |
| - 'Topic :: Software Development :: Widget Sets', |
103 |
| - 'Topic :: Text Processing :: Markup :: HTML' |
| 82 | + "Environment :: Web Environment", |
| 83 | + "Intended Audience :: Developers", |
| 84 | + "License :: OSI Approved :: MIT License", |
| 85 | + "Natural Language :: English", |
| 86 | + "Operating System :: OS Independent", |
| 87 | + "Programming Language :: Python", |
| 88 | + "Programming Language :: Python :: 2", |
| 89 | + "Programming Language :: Python :: 2.4", |
| 90 | + "Programming Language :: Python :: 2.5", |
| 91 | + "Programming Language :: Python :: 2.6", |
| 92 | + "Programming Language :: Python :: 2.7", |
| 93 | + "Programming Language :: Python :: 3", |
| 94 | + "Programming Language :: Python :: 3.2", |
| 95 | + "Programming Language :: Python :: 3.3", |
| 96 | + "Programming Language :: Python :: 3.4", |
| 97 | + "Programming Language :: Python :: 3.5", |
| 98 | + "Programming Language :: Python :: 3.6", |
| 99 | + "Programming Language :: Python :: 3.7", |
| 100 | + "Programming Language :: Python :: 3.8", |
| 101 | + "Programming Language :: Python :: Implementation :: CPython", |
| 102 | + "Programming Language :: Python :: Implementation :: PyPy", |
| 103 | + "Topic :: Internet :: WWW/HTTP", |
| 104 | + "Topic :: Internet :: WWW/HTTP :: Dynamic Content", |
| 105 | + "Topic :: Software Development :: Libraries :: Python Modules", |
| 106 | + "Topic :: Software Development :: Widget Sets", |
| 107 | + "Topic :: Text Processing :: Markup :: HTML", |
104 | 108 | ],
|
105 |
| - keywords='html widget markup mako jinja2 tenjin wheezy.template ' |
106 |
| - 'preprocessor', |
107 |
| - packages=['wheezy', 'wheezy.html', 'wheezy.html.ext'], |
108 |
| - package_dir={'': 'src'}, |
109 |
| - namespace_packages=['wheezy'], |
| 109 | + keywords="html widget markup mako jinja2 tenjin wheezy.template " |
| 110 | + "preprocessor", |
| 111 | + packages=["wheezy", "wheezy.html", "wheezy.html.ext"], |
| 112 | + package_dir={"": "src"}, |
| 113 | + namespace_packages=["wheezy"], |
110 | 114 | zip_safe=False,
|
111 | 115 | extras_require={
|
112 |
| - 'mako': [ |
113 |
| - 'mako>=0.7.0' |
114 |
| - ], |
115 |
| - 'tenjin': [ |
116 |
| - 'tenjin>=1.1.0' |
117 |
| - ], |
118 |
| - 'jinja2': [ |
119 |
| - 'jinja2>=2.6' |
120 |
| - ], |
121 |
| - 'wheezy.template': [ |
122 |
| - 'wheezy.template>=0.1.88' |
123 |
| - ] |
| 116 | + "mako": ["mako>=0.7.0"], |
| 117 | + "tenjin": ["tenjin>=1.1.0"], |
| 118 | + "jinja2": ["jinja2>=2.6"], |
| 119 | + "wheezy.template": ["wheezy.template>=0.1.88"], |
124 | 120 | },
|
125 |
| - platforms='any', |
| 121 | + platforms="any", |
126 | 122 | **extra
|
127 | 123 | )
|
0 commit comments