using optimisation level for interpreter during compilation, fix #3
This commit is contained in:
parent
dccb62fe1b
commit
574596dba7
@ -40,9 +40,16 @@ def compile(
|
|||||||
click.echo("Base interpreter path could not be found", err=True)
|
click.echo("Base interpreter path could not be found", err=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
opt_level: str = ""
|
||||||
|
if optimise == 1:
|
||||||
|
opt_level = "-O"
|
||||||
|
elif optimise == 2:
|
||||||
|
opt_level = "-OO"
|
||||||
|
|
||||||
exclude_rx: str = "[\\\\|/]+tcl[\\\\|/]+"
|
exclude_rx: str = "[\\\\|/]+tcl[\\\\|/]+"
|
||||||
cmd = [
|
run_cmd: list[str] = [
|
||||||
str(pth_intp),
|
str(pth_intp),
|
||||||
|
opt_level,
|
||||||
"-m",
|
"-m",
|
||||||
"compileall",
|
"compileall",
|
||||||
"./python/",
|
"./python/",
|
||||||
@ -52,10 +59,12 @@ def compile(
|
|||||||
str(optimise),
|
str(optimise),
|
||||||
]
|
]
|
||||||
if force:
|
if force:
|
||||||
cmd.extend(("-f",))
|
run_cmd.extend(("-f",))
|
||||||
|
|
||||||
|
run_cmd = [cmd for cmd in run_cmd if cmd]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.run(cmd)
|
subprocess.run(run_cmd)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print_error(err)
|
print_error(err)
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user