]> granicus.if.org Git - python/commitdiff
bpo-12639: msilib.Directory.start_component() fails if *keyfile* is not None (GH...
authorZackery Spytz <zspytz@gmail.com>
Fri, 31 May 2019 16:43:13 +0000 (10:43 -0600)
committerSteve Dower <steve.dower@python.org>
Fri, 31 May 2019 16:43:13 +0000 (09:43 -0700)
msilib.Directory.start_component() was passing an extra argument to CAB.gen_id().

Lib/msilib/__init__.py
Lib/test/test_msilib.py
Misc/NEWS.d/next/Library/2019-05-30-16-16-47.bpo-12639.TQFOR4.rst [new file with mode: 0644]

index 8c5251d9baf81e274ae3b6a0a21413c1586c7b33..0bc8dd9952462c028ec0d9dc0fdf4833c33d1530 100644 (file)
@@ -273,7 +273,7 @@ class Directory:
         if AMD64:
             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
index 4aa4753fc2a6db445b06db5c6acab516d436b955..265eaea59b5f4bb4837426572ea0d08b7192b78f 100644 (file)
@@ -83,6 +83,15 @@ class MsiDatabaseTestCase(unittest.TestCase):
         db.Close()
         self.addCleanup(unlink, db_path)
 
+    def test_directory_start_component_keyfile(self):
+        db, db_path = init_database()
+        self.addCleanup(db.Close)
+        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 (file)
index 0000000..aade912
--- /dev/null
@@ -0,0 +1,2 @@
+:meth:`msilib.Directory.start_component()` no longer fails if *keyfile* is
+not ``None``.