Clean up byte-compilation code in packaging (#11254 followup).

- Don't use keyword arguments for debug_override; I find it more
  readable to have a comment explaining that True makes pyc and False
  pyo than to write out the non-obvious (when you haven’t read the doc)
  argument name

- Move duplicate code from build_py and install_lib into cmd

- Remove obsolete verbose argument of util.byte_compile

- Remove obsolete passing of -O/-OO to the Python process spawned by
  util.byte_compile (I’ll remove the whole spawning later, after I write
  more tests to check the contents of pyc and pyo files; now that
  byte_compile does not depend on the value of __debug__ in the calling
  Python, we can call py_compile or compileall directly)
This commit is contained in:
Éric Araujo 2011-11-14 18:10:19 +01:00
parent d5d4406c8e
commit f8361623f0
6 changed files with 57 additions and 78 deletions

View file

@ -44,8 +44,8 @@ class InstallLibTestCase(support.TempdirManager,
f = os.path.join(project_dir, 'foo.py')
self.write_file(f, '# python file')
cmd.byte_compile([f])
pyc_file = imp.cache_from_source('foo.py', debug_override=True)
pyo_file = imp.cache_from_source('foo.py', debug_override=False)
pyc_file = imp.cache_from_source('foo.py', True)
pyo_file = imp.cache_from_source('foo.py', False)
self.assertTrue(os.path.exists(pyc_file))
self.assertTrue(os.path.exists(pyo_file))