aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2016-06-05 08:18:01 +0200
committerMichał Górny <mgorny@gentoo.org>2022-01-27 11:12:02 +0100
commit657be90d93775ca0225d1bde993df0b05d6ed5ec (patch)
tree0c13b28c33f82bb6551c0b4a74e1e326de99e4b5
parentstart a pypy3.9 release branch (diff)
downloadpypy-657be90d93775ca0225d1bde993df0b05d6ed5ec.tar.gz
pypy-657be90d93775ca0225d1bde993df0b05d6ed5ec.tar.bz2
pypy-657be90d93775ca0225d1bde993df0b05d6ed5ec.zip
distutils: make -OO enable both opt-1 and opt-2 optimizationgentoo-3.9-7.3.8rc1
Bug: http://bugs.python.org/issue27226 Bug: https://bugs.gentoo.org/585060
-rw-r--r--lib-python/3/distutils/command/build_py.py8
-rw-r--r--lib-python/3/distutils/command/install_lib.py12
2 files changed, 10 insertions, 10 deletions
diff --git a/lib-python/3/distutils/command/build_py.py b/lib-python/3/distutils/command/build_py.py
index edc2171cd1..e34749d6eb 100644
--- a/lib-python/3/distutils/command/build_py.py
+++ b/lib-python/3/distutils/command/build_py.py
@@ -315,9 +315,9 @@ class build_py (Command):
if self.compile:
outputs.append(importlib.util.cache_from_source(
filename, optimization=''))
- if self.optimize > 0:
+ for opt in range(1, self.optimize + 1):
outputs.append(importlib.util.cache_from_source(
- filename, optimization=self.optimize))
+ filename, optimization=opt))
outputs += [
os.path.join(build_dir, filename)
@@ -387,8 +387,8 @@ class build_py (Command):
if self.compile:
byte_compile(files, optimize=0,
force=self.force, prefix=prefix, dry_run=self.dry_run)
- if self.optimize > 0:
- byte_compile(files, optimize=self.optimize,
+ for opt in range(1, self.optimize + 1):
+ byte_compile(files, optimize=opt,
force=self.force, prefix=prefix, dry_run=self.dry_run)
class build_py_2to3(build_py, Mixin2to3):
diff --git a/lib-python/3/distutils/command/install_lib.py b/lib-python/3/distutils/command/install_lib.py
index 6154cf0943..049b662566 100644
--- a/lib-python/3/distutils/command/install_lib.py
+++ b/lib-python/3/distutils/command/install_lib.py
@@ -24,8 +24,8 @@ class install_lib(Command):
# 2) compile .pyc only (--compile --no-optimize; default)
# 3) compile .pyc and "opt-1" .pyc (--compile --optimize)
# 4) compile "opt-1" .pyc only (--no-compile --optimize)
- # 5) compile .pyc and "opt-2" .pyc (--compile --optimize-more)
- # 6) compile "opt-2" .pyc only (--no-compile --optimize-more)
+ # 5) compile .pyc, "opt-1" and "opt-2" .pyc (--compile --optimize-more)
+ # 6) compile "opt-1" and "opt-2" .pyc (--no-compile --optimize-more)
#
# The UI for this is two options, 'compile' and 'optimize'.
# 'compile' is strictly boolean, and only decides whether to
@@ -132,8 +132,8 @@ class install_lib(Command):
byte_compile(files, optimize=0,
force=self.force, prefix=install_root,
dry_run=self.dry_run)
- if self.optimize > 0:
- byte_compile(files, optimize=self.optimize,
+ for opt in range(1, self.optimize + 1):
+ byte_compile(files, optimize=opt,
force=self.force, prefix=install_root,
verbose=self.verbose, dry_run=self.dry_run)
@@ -167,9 +167,9 @@ class install_lib(Command):
if self.compile:
bytecode_files.append(importlib.util.cache_from_source(
py_file, optimization=''))
- if self.optimize > 0:
+ for opt in range(1, self.optimize + 1):
bytecode_files.append(importlib.util.cache_from_source(
- py_file, optimization=self.optimize))
+ py_file, optimization=opt))
return bytecode_files