Fix Python module name
This commit is contained in:
parent
b4142be729
commit
7b1ac85f88
|
@ -46,7 +46,7 @@ jobs:
|
|||
- name: Build native module
|
||||
working-directory: ./python
|
||||
run: |
|
||||
cp Cargo.${{ matrix.feature }}.toml Cargo.toml
|
||||
python prepare.py ${{ matrix.feature }}
|
||||
cargo build --release
|
||||
|
||||
- name: Install Python build tools (macOS)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/Cargo.lock
|
||||
/Cargo.toml
|
||||
/src/lib.rs
|
||||
/target/
|
||||
|
||||
__pycache__/
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import shutil
|
||||
import sys
|
||||
|
||||
feature = sys.argv[1]
|
||||
|
||||
module_name = "minify_html_core" if feature == "core" else "minify_html"
|
||||
cargo_file = "Cargo.core.toml" if feature == "core" else "Cargo.js.toml"
|
||||
|
||||
with open("src/lib.template.rs", "r") as template:
|
||||
actual = template.read().replace("REPLACE_WITH_MODULE_NAME", module_name)
|
||||
with open("src/lib.rs", "w") as librs:
|
||||
librs.write(actual)
|
||||
|
||||
shutil.copyfile(cargo_file, "Cargo.toml")
|
|
@ -17,7 +17,7 @@ fn minify(code: String, minify_js: bool, minify_css: bool) -> PyResult<String> {
|
|||
}
|
||||
|
||||
#[pymodule]
|
||||
fn minify_html(_py: Python, m: &PyModule) -> PyResult<()> {
|
||||
fn REPLACE_WITH_MODULE_NAME(_py: Python, m: &PyModule) -> PyResult<()> {
|
||||
m.add_wrapped(wrap_pyfunction!(minify))?;
|
||||
|
||||
Ok(())
|
Loading…
Reference in New Issue