update dr rs and compile_mod.py

This commit is contained in:
shenjack-5600u 2024-05-26 10:47:05 +08:00
parent 15380d4fb7
commit 160ad716c2
Signed by: shenjack
GPG Key ID: FDF9864E11C7E79F
2 changed files with 15 additions and 3 deletions

View File

@ -19,7 +19,8 @@ setup(
RustExtension( RustExtension(
target="Difficult_Rocket_rs.Difficult_Rocket_rs", target="Difficult_Rocket_rs.Difficult_Rocket_rs",
binding=Binding.PyO3, binding=Binding.PyO3,
strip=Strip.All, rustc_flags=["-Ctarget-cpu=native"],
strip=Strip.No,
) )
], ],
zip_safe=False, zip_safe=False,

View File

@ -1,13 +1,16 @@
import os
import sys
import argparse import argparse
import subprocess import subprocess
import sys
import os from pathlib import Path
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
# script -py <py_version> (3.8 ~ 3.12) # script -py <py_version> (3.8 ~ 3.12)
parser.add_argument("-py", type=str, help="python version") parser.add_argument("-py", type=str, help="python version")
parser.add_argument("-all", help="用所有的python版本编译", action="store_true") parser.add_argument("-all", help="用所有的python版本编译", action="store_true")
parser.add_argument("-clean", help="清理编译文件", action="store_true")
args = parser.parse_args() args = parser.parse_args()
@ -17,8 +20,16 @@ if __name__ == "__main__":
subprocess.run(["cargo", "fmt", "--all"]) subprocess.run(["cargo", "fmt", "--all"])
if args.clean:
subprocess.run(["cargo", "clean"])
os.chdir("../") os.chdir("../")
if args.clean:
subprocess.run([sys.executable, "setup.py", "clean"])
sys.exit(0)
if not args.py: if not args.py:
if args.all: if args.all:
all_version = ("38", "39", "310", "311", "312") all_version = ("38", "39", "310", "311", "312")