Use per-platform Python wheels
This commit is contained in:
parent
fa5cd831e4
commit
d35e881bb7
7 changed files with 25 additions and 111 deletions
|
|
@ -1,12 +1,17 @@
|
|||
[package]
|
||||
name = "hyperbuild-python"
|
||||
publish = false
|
||||
name = "minify-html"
|
||||
description = "Fast allocation-less HTML minifier with smart whitespace handling"
|
||||
license = "MIT"
|
||||
homepage = "https://github.com/wilsonzlin/hyperbuild"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/wilsonzlin/hyperbuild.git"
|
||||
version = "0.2.4"
|
||||
authors = ["Wilson Lin <code@wilsonl.in>"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "hyperbuild_python_lib"
|
||||
name = "minify_html"
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
recursive-include hyperbuild *.so *.pyd
|
||||
1
python/README.md
Symbolic link
1
python/README.md
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../README.md
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
import importlib
|
||||
import inspect
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
|
||||
|
||||
def _load_native_module():
|
||||
os_name_raw = platform.system()
|
||||
if os_name_raw == "Linux":
|
||||
os_name = "linux"
|
||||
elif os_name_raw == "Darwin":
|
||||
os_name = "macos"
|
||||
elif os_name_raw == "Windows":
|
||||
os_name = "windows"
|
||||
else:
|
||||
os_name = "unknown"
|
||||
|
||||
os_arch_raw = platform.machine()
|
||||
if os_arch_raw == "AMD64" or os_arch_raw == "x86_64":
|
||||
os_arch = "x86_64"
|
||||
else:
|
||||
os_arch = "unknown"
|
||||
|
||||
this_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe()))[0]))
|
||||
pyv = sys.version_info
|
||||
sys.path.insert(0, this_folder)
|
||||
module = importlib.import_module(''.join([os_name, "-", os_arch, '-', str(pyv.major), '_', str(pyv.minor), ".hyperbuild"]))
|
||||
sys.path.pop(0)
|
||||
return module
|
||||
|
||||
|
||||
minify = _load_native_module().minify
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
import setuptools
|
||||
|
||||
with open("README.md", "r") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
setuptools.setup(
|
||||
name="hyperbuild",
|
||||
version="0.2.4",
|
||||
author="Wilson Lin",
|
||||
author_email="code@wilsonl.in",
|
||||
description="Fast allocation-less HTML minifier with smart whitespace handling",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/wilsonzlin/hyperbuild",
|
||||
packages=["hyperbuild"],
|
||||
include_package_data=True,
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Programming Language :: Python :: Implementation :: CPython",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
],
|
||||
python_requires='>=3.5',
|
||||
)
|
||||
|
|
@ -16,7 +16,7 @@ fn minify(code: String, minify_js: bool) -> PyResult<String> {
|
|||
}
|
||||
|
||||
#[pymodule]
|
||||
fn hyperbuild(_py: Python, m: &PyModule) -> PyResult<()> {
|
||||
fn minify_html(_py: Python, m: &PyModule) -> PyResult<()> {
|
||||
m.add_wrapped(wrap_pyfunction!(minify))?;
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
Reference in a new issue