diff -Nru curtin-17.1-555-gc5cb03e/debian/changelog curtin-17.1-558-g4fc6bad/debian/changelog --- curtin-17.1-555-gc5cb03e/debian/changelog 2017-12-20 21:01:21.000000000 +0000 +++ curtin-17.1-558-g4fc6bad/debian/changelog 2018-01-12 21:04:01.000000000 +0000 @@ -1,6 +1,6 @@ -curtin (17.1-555-gc5cb03e-0ubuntu1~ubuntu17.04.1) zesty; urgency=low +curtin (17.1-558-g4fc6bad-0ubuntu1~ubuntu17.04.1) zesty; urgency=low * Auto build. - -- Launchpad Package Builder Wed, 20 Dec 2017 21:01:21 +0000 + -- Launchpad Package Builder Fri, 12 Jan 2018 21:04:01 +0000 diff -Nru curtin-17.1-555-gc5cb03e/debian/git-build-recipe.manifest curtin-17.1-558-g4fc6bad/debian/git-build-recipe.manifest --- curtin-17.1-555-gc5cb03e/debian/git-build-recipe.manifest 2017-12-20 21:01:21.000000000 +0000 +++ curtin-17.1-558-g4fc6bad/debian/git-build-recipe.manifest 2018-01-12 21:04:01.000000000 +0000 @@ -1,2 +1,2 @@ -# git-build-recipe format 0.4 deb-version 17.1-555-gc5cb03e-0ubuntu1 -lp:curtin git-commit:c5cb03e197f0a5066188530f50b2c6c1f15a904a +# git-build-recipe format 0.4 deb-version 17.1-558-g4fc6bad-0ubuntu1 +lp:curtin git-commit:4fc6badb90f2108e6c03d6c8bd4c999ad2510a0d diff -Nru curtin-17.1-555-gc5cb03e/tests/unittests/test_pack.py curtin-17.1-558-g4fc6bad/tests/unittests/test_pack.py --- curtin-17.1-555-gc5cb03e/tests/unittests/test_pack.py 2017-12-20 21:01:21.000000000 +0000 +++ curtin-17.1-558-g4fc6bad/tests/unittests/test_pack.py 2018-01-12 21:04:01.000000000 +0000 @@ -4,6 +4,7 @@ from curtin import util from curtin.commands.install import INSTALL_PASS_MSG, INSTALL_START_MSG +import glob import json import os import shutil @@ -148,7 +149,6 @@ # has, and verify that python --help has that changed string, then # change it back for other tests. version_py = os.path.join(self.extract_dir, 'curtin', 'version.py') - version_pyc = version_py + "c" hack_version_str = "MY_VERSION_STRING" orig_contents = util.load_file(version_py) hacked_contents = orig_contents.replace( @@ -156,11 +156,11 @@ self.assertIn(hack_version_str, hacked_contents) try: util.write_file(version_py, hacked_contents) - util.del_file(version_pyc) + remove_pyc_for_file(version_py) out, err = self.run_main(['--help']) finally: - util.del_file(version_pyc) util.write_file(version_py, orig_contents) + remove_pyc_for_file(version_py) self.assertIn(hack_version_str, out) @@ -171,4 +171,20 @@ self.assertTrue(os.path.isdir(os.path.join(tld, 'curtin'))) self.assertTrue(os.path.isdir(os.path.join(tld, 'bin'))) + +def remove_pyc_for_file(py_path): + """Remove any .pyc files that have been created by running py_path. + + Different versions of python create different .pyc files for a given .py: + my_path/my.py -> my_path/my.pyc + my_path/__pycache__/my..pyc""" + without_py = py_path.rpartition(".")[0] + pycache_wildcard = os.path.join( + os.path.dirname(without_py), "__pycache__", + os.path.basename(without_py)) + ".*.pyc" + for pyc in [without_py + ".pyc"] + glob.glob(pycache_wildcard): + if os.path.exists(pyc): + os.unlink(pyc) + + # vi: ts=4 expandtab syntax=python