Commit 4dfb8940 by Randy Döring Committed by GitHub

installer: fix optimization level (#7666)

parent cbfdc628
...@@ -94,7 +94,7 @@ class WheelInstaller: ...@@ -94,7 +94,7 @@ class WheelInstaller:
) )
def enable_bytecode_compilation(self, enable: bool = True) -> None: def enable_bytecode_compilation(self, enable: bool = True) -> None:
self._destination.bytecode_optimization_levels = (1,) if enable else () self._destination.bytecode_optimization_levels = (-1,) if enable else ()
def install(self, wheel: Path) -> None: def install(self, wheel: Path) -> None:
with WheelFile.open(wheel) as source: with WheelFile.open(wheel) as source:
......
...@@ -77,5 +77,7 @@ def test_enable_bytecode_compilation( ...@@ -77,5 +77,7 @@ def test_enable_bytecode_compilation(
if compile: if compile:
assert cache_dir.exists() assert cache_dir.exists()
assert list(cache_dir.glob("*.pyc")) assert list(cache_dir.glob("*.pyc"))
assert not list(cache_dir.glob("*.opt-1.pyc"))
assert not list(cache_dir.glob("*.opt-2.pyc"))
else: else:
assert not cache_dir.exists() assert not cache_dir.exists()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment