1 diff -dur -x '*~' -x '*.orig' -x '*.rej' Python-3.2.1.orig/Lib/distutils/tests/test_build_py.py Python-3.2.1/Lib/distutils/tests/test_build_py.py
2 --- Python-3.2.1.orig/Lib/distutils/tests/test_build_py.py 2011-07-09 08:58:47.000000000 +0200
3 +++ Python-3.2.1/Lib/distutils/tests/test_build_py.py 2011-07-15 13:55:54.000000000 +0200
11 from distutils.command.build_py import build_py
13 self.assertEqual(len(cmd.get_outputs()), 3)
14 pkgdest = os.path.join(destination, "pkg")
15 files = os.listdir(pkgdest)
16 + byte_compiled_files = os.listdir(os.path.join(pkgdest, "__pycache__"))
17 self.assertIn("__init__.py", files)
18 self.assertIn("README.txt", files)
19 + init_pyc = "__init__.{}.pyc".format(imp.get_tag())
20 # XXX even with -O, distutils writes pyc, not pyo; bug?
21 if sys.dont_write_bytecode:
22 - self.assertNotIn("__init__.pyc", files)
23 + self.assertNotIn(init_pyc, byte_compiled_files)
25 - self.assertIn("__init__.pyc", files)
26 + self.assertIn(init_pyc, byte_compiled_files)
28 def test_empty_package_dir(self):
29 # See SF 1668596/1720897.
30 diff -dur -x '*~' -x '*.orig' -x '*.rej' Python-3.2.1.orig/Lib/distutils/tests/test_install_lib.py Python-3.2.1/Lib/distutils/tests/test_install_lib.py
31 --- Python-3.2.1.orig/Lib/distutils/tests/test_install_lib.py 2011-07-09 08:58:47.000000000 +0200
32 +++ Python-3.2.1/Lib/distutils/tests/test_install_lib.py 2011-07-15 13:53:50.000000000 +0200
34 """Tests for distutils.command.install_data."""
40 from distutils.command.install_lib import install_lib
42 'byte-compile not supported')
43 def test_byte_compile(self):
44 pkg_dir, dist = self.create_dist()
45 + cache_dir = os.path.join(pkg_dir, '__pycache__')
46 cmd = install_lib(dist)
47 cmd.compile = cmd.optimize = 1
49 f = os.path.join(pkg_dir, 'foo.py')
50 self.write_file(f, '# python file')
52 - self.assertTrue(os.path.exists(os.path.join(pkg_dir, 'foo.pyc')))
53 - self.assertTrue(os.path.exists(os.path.join(pkg_dir, 'foo.pyo')))
54 + compiled_file = os.path.join(cache_dir,
55 + "foo.{}.pyc".format(imp.get_tag()))
56 + optimized_file = os.path.join(cache_dir,
57 + "foo.{}.pyo".format(imp.get_tag()))
58 + self.assertTrue(os.path.exists(compiled_file))
59 + self.assertTrue(os.path.exists(optimized_file))
61 def test_get_outputs(self):
62 pkg_dir, dist = self.create_dist()
63 diff -dur -x '*~' -x '*.orig' -x '*.rej' Python-3.2.1.orig/Lib/distutils/util.py Python-3.2.1/Lib/distutils/util.py
64 --- Python-3.2.1.orig/Lib/distutils/util.py 2011-07-09 08:58:47.000000000 +0200
65 +++ Python-3.2.1/Lib/distutils/util.py 2011-07-15 13:53:50.000000000 +0200
70 -import sys, os, string, re
71 +import sys, os, string, re, imp
72 from distutils.errors import DistutilsPlatformError
73 from distutils.dep_util import newer
74 from distutils.spawn import spawn
76 # Terminology from the py_compile module:
77 # cfile - byte-compiled file
78 # dfile - purported source filename (same as 'file' by default)
79 - cfile = file + (__debug__ and "c" or "o")
80 + cfile = imp.cache_from_source(file, debug_override=not optimize)
83 if file[:len(prefix)] != prefix: