From bfc1f605609218b9734d3cf3eab3531a2f4624e1 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Fri, 31 May 2019 15:39:39 -0700 Subject: [PATCH] [2.7] bpo-12639: msilib.Directory.start_component() fails if *keyfile* is not None (GH-13688) * bpo-12639: msilib.Directory.start_component() fails if *keyfile* is not None (GH-13688) msilib.Directory.start_component() was passing an extra argument to CAB.gen_id(). (cherry picked from commit c8d5bf6c3fa09b43f6a5ee779d493d251dbcc53c) Co-authored-by: Zackery Spytz --- Lib/msilib/__init__.py | 2 +- Lib/test/test_msilib.py | 8 ++++++++ .../next/Library/2019-05-30-16-16-47.bpo-12639.TQFOR4.rst | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2019-05-30-16-16-47.bpo-12639.TQFOR4.rst diff --git a/Lib/msilib/__init__.py b/Lib/msilib/__init__.py index 0352b60c0b2..9520dfc021a 100644 --- a/Lib/msilib/__init__.py +++ b/Lib/msilib/__init__.py @@ -276,7 +276,7 @@ class Directory: if Win64: flags |= 256 if keyfile: - keyid = self.cab.gen_id(self.absolute, keyfile) + keyid = self.cab.gen_id(keyfile) self.keyfiles[keyfile] = keyid else: keyid = None diff --git a/Lib/test/test_msilib.py b/Lib/test/test_msilib.py index a2f3943e228..58f709d70dc 100644 --- a/Lib/test/test_msilib.py +++ b/Lib/test/test_msilib.py @@ -43,6 +43,14 @@ class MsiDatabaseTestCase(unittest.TestCase): sum_info = None unlink(db_path) + def test_directory_start_component_keyfile(self): + db, db_path = init_database() + feature = msilib.Feature(db, 0, 'Feature', 'A feature', 'Python') + cab = msilib.CAB('CAB') + dir = msilib.Directory(db, cab, None, TESTFN, 'TARGETDIR', + 'SourceDir', 0) + dir.start_component(None, feature, None, 'keyfile') + class Test_make_id(unittest.TestCase): #http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx diff --git a/Misc/NEWS.d/next/Library/2019-05-30-16-16-47.bpo-12639.TQFOR4.rst b/Misc/NEWS.d/next/Library/2019-05-30-16-16-47.bpo-12639.TQFOR4.rst new file mode 100644 index 00000000000..aade9121b4b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-05-30-16-16-47.bpo-12639.TQFOR4.rst @@ -0,0 +1,2 @@ +:meth:`msilib.Directory.start_component()` no longer fails if *keyfile* is +not ``None``.