Repository navigation
Expand file tree
/
Copy pathsetup.py
More file actions
60 lines (57 loc) · 2.2 KB
/
Copy pathsetup.py
File metadata and controls
60 lines (57 loc) · 2.2 KB
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 pathlib
from setuptools import setup
from setuptools.command.build_ext import build_ext
from setuptools.errors import CompileError
from setuptools.extension import Extension
from subprocess import CalledProcessError, check_call
HERE = pathlib.Path(__file__).parent
README = (HERE / "README.md").read_text()
class build_ext_external(build_ext):
"""Placeholder for externally-built extension."""
def build_extension(self, ext: Extension):
if not all(pathlib.Path(p).exists() for p in ext.sources):
try:
check_call(['go', 'build', '-buildmode=c-shared', '-o', *ext.sources])
except CalledProcessError as e:
raise CompileError('Go compilation failed!') from e
setup(
name="tdewolff-minify",
version="{VERSION}",
description="Go minifiers for web formats",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/tdewolff/minify",
author="Taco de Wolff",
author_email="tacodewolff@gmail.com",
license="MIT",
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: JavaScript",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"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 :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Software Development :: Pre-processors",
"Topic :: Text Processing :: Markup",
],
ext_modules=[
Extension("minify", ["minify.so"]),
],
cmdclass={"build_ext": build_ext_external},
packages=["minify"],
package_dir={"": "src"},
include_package_data=True,
cffi_modules=["build_minify.py:ffi"],
install_requires=["cffi>=1.0.0"],
zip_safe=False,
)