mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
Fix distutils byte-compilation to comply with PEP 3147 (#11254).
Patch by Jeff Ramnani. Tested with -B, -O and -OO.
This commit is contained in:
parent
db95c7a60c
commit
47a4521ece
6 changed files with 34 additions and 12 deletions
|
|
@ -3,6 +3,7 @@
|
|||
import os
|
||||
import sys
|
||||
import io
|
||||
import imp
|
||||
import unittest
|
||||
|
||||
from distutils.command.build_py import build_py
|
||||
|
|
@ -57,13 +58,15 @@ class BuildPyTestCase(support.TempdirManager,
|
|||
self.assertEqual(len(cmd.get_outputs()), 3)
|
||||
pkgdest = os.path.join(destination, "pkg")
|
||||
files = os.listdir(pkgdest)
|
||||
pycache_dir = os.path.join(pkgdest, "__pycache__")
|
||||
self.assertIn("__init__.py", files)
|
||||
self.assertIn("README.txt", files)
|
||||
# XXX even with -O, distutils writes pyc, not pyo; bug?
|
||||
if sys.dont_write_bytecode:
|
||||
self.assertNotIn("__init__.pyc", files)
|
||||
self.assertFalse(os.path.exists(pycache_dir))
|
||||
else:
|
||||
self.assertIn("__init__.pyc", files)
|
||||
# XXX even with -O, distutils writes pyc, not pyo; bug?
|
||||
pyc_files = os.listdir(pycache_dir)
|
||||
self.assertIn("__init__.%s.pyc" % imp.get_tag(), pyc_files)
|
||||
|
||||
def test_empty_package_dir(self):
|
||||
# See SF 1668596/1720897.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue