Просмотр исходного кода

-S option for ppackage as well as packp3d

David Rose 16 лет назад
Родитель
Сommit
7472fd8e5d
3 измененных файлов с 26 добавлено и 11 удалено
  1. 6 0
      direct/src/p3d/Packager.py
  2. 5 10
      direct/src/p3d/packp3d.py
  3. 15 1
      direct/src/p3d/ppackage.py

+ 6 - 0
direct/src/p3d/Packager.py

@@ -1582,6 +1582,11 @@ class Packager:
         # any applications.
         self.allowPythonDev = False
 
+        # Fill this with a list of (certificate, chain, pkey,
+        # password) tuples to automatically sign each p3d file
+        # generated.
+        self.signParams = []
+
         # The platform string.
         self.platform = PandaSystem.getPlatform()
 
@@ -2015,6 +2020,7 @@ class Packager:
             raise PackagerError, 'unmatched endPackage'
 
         package = self.currentPackage
+        package.signParams += self.signParams[:]
         package.close()
 
         self.packageList.append(package)

+ 5 - 10
direct/src/p3d/packp3d.py

@@ -82,7 +82,6 @@ def makePackedApp(args):
 
     root = Filename('.')
     main = None
-    signParams = []
     configFlags = []
     requires = []
     allowPythonDev = False
@@ -93,7 +92,11 @@ def makePackedApp(args):
         elif option == '-m':
             main = value
         elif option == '-S':
-            signParams.append(value)
+            tokens = value.split(',')
+            while len(tokens) < 4:
+                tokens.append('')
+            certificate, chain, pkey, password = tokens[:4]
+            packager.signParams.append((certificate, chain, pkey, password))
         elif option == '-c':
             configFlags.append(value.split('=', 1))
         elif option == '-r':
@@ -158,14 +161,6 @@ def makePackedApp(args):
 
         packager.do_dir(root)
         packager.do_mainModule(mainModule)
-
-        for param in signParams:
-            tokens = param.split(',')
-            while len(tokens) < 4:
-                tokens.append('')
-            certificate, chain, pkey, password = tokens[:4]
-            packager.do_sign(certificate, chain = chain, pkey = pkey, password = password)
-
         packager.endPackage()
         packager.close()
         

+ 15 - 1
direct/src/p3d/ppackage.py

@@ -62,6 +62,14 @@ Options:
      This option may be repeated as necessary.  These directories may
      also be specified with the pdef-path Config.prc variable.
 
+  -S file.crt[,chain.crt[,file.key[,\"password\"]]]
+     Signs any resulting p3d file(s) with the indicated certificate.
+     You may specify the signing certificate, the optional
+     authorization chain, and the private key in three different
+     files, or they may all be combined in the first file.  If the
+     private key is encrypted, the password will be required to
+     decrypt it.
+
   -D
      Sets the allow_python_dev flag in any applications built with
      this command.  This enables additional runtime debug operations,
@@ -96,7 +104,7 @@ packager = Packager.Packager()
 buildPatches = False
 
 try:
-    opts, args = getopt.getopt(sys.argv[1:], 'i:ps:DP:h')
+    opts, args = getopt.getopt(sys.argv[1:], 'i:ps:S:DP:h')
 except getopt.error, msg:
     usage(1, msg)
 
@@ -107,6 +115,12 @@ for opt, arg in opts:
         buildPatches = True
     elif opt == '-s':
         packager.installSearch.appendDirectory(Filename.fromOsSpecific(arg))
+    elif opt == '-S':
+        tokens = arg.split(',')
+        while len(tokens) < 4:
+            tokens.append('')
+        certificate, chain, pkey, password = tokens[:4]
+        packager.signParams.append((certificate, chain, pkey, password))
     elif opt == '-D':
         packager.allowPythonDev = True
     elif opt == '-P':