Browse Source

pdeploy is now fully working for all platforms, I think.

rdb 16 years ago
parent
commit
0f1a3e13d7
2 changed files with 30 additions and 2 deletions
  1. 14 2
      direct/src/p3d/DeploymentTools.py
  2. 16 0
      direct/src/p3d/pdeploy.py

+ 14 - 2
direct/src/p3d/DeploymentTools.py

@@ -4,12 +4,11 @@ to build for as many platforms as possible. """
 
 
 __all__ = ["Standalone", "Installer"]
 __all__ = ["Standalone", "Installer"]
 
 
-import os, sys, subprocess, tarfile, shutil, time
+import os, sys, subprocess, tarfile, shutil, time, zipfile
 from direct.directnotify.DirectNotifyGlobal import *
 from direct.directnotify.DirectNotifyGlobal import *
 from pandac.PandaModules import PandaSystem, HTTPClient, Filename, VirtualFileSystem
 from pandac.PandaModules import PandaSystem, HTTPClient, Filename, VirtualFileSystem
 from direct.p3d.HostInfo import HostInfo
 from direct.p3d.HostInfo import HostInfo
 from direct.showbase.AppRunnerGlobal import appRunner
 from direct.showbase.AppRunnerGlobal import appRunner
-import glob
 
 
 class CachedFile:
 class CachedFile:
     def __init__(self): self.str = ""
     def __init__(self): self.str = ""
@@ -415,6 +414,19 @@ class Installer:
         archive.add(appfn.toOsSpecific(), appname)
         archive.add(appfn.toOsSpecific(), appname)
         archive.close()
         archive.close()
         
         
+        # Put the .pkg into a zipfile
+        archive = Filename(output.getDirname(), "%s %s.zip" % (self.fullname, self.version))
+        dir = Filename(output.getDirname())
+        dir.makeAbsolute()
+        zip = zipfile.ZipFile(archive.toOsSpecific(), 'w')
+        for root, dirs, files in os.walk(output.toOsSpecific()):
+            for name in files:
+                file = Filename.fromOsSpecific(os.path.join(root, name))
+                file.makeAbsolute()
+                file.makeRelativeTo(dir)
+                zip.write(os.path.join(root, name), str(file))
+        zip.close()
+        
         return output
         return output
 
 
     def buildNSIS(self, output, platform):
     def buildNSIS(self, output, platform):

+ 16 - 0
direct/src/p3d/pdeploy.py

@@ -84,6 +84,14 @@ Options:
      is licensed under.
      is licensed under.
      Only relevant when generating a graphical installer.
      Only relevant when generating a graphical installer.
 
 
+  -a com.your_company
+     Short identifier of the author of the application. The default
+     is "org.panda3d", but you will most likely want to change
+     it to your own name or that of your organization or company.
+
+  -A "Your Company"
+     Full name of the author of the application.
+
   -h
   -h
      Display this help
      Display this help
 
 
@@ -111,6 +119,8 @@ platforms = []
 currentPlatform = False
 currentPlatform = False
 licensename = ""
 licensename = ""
 licensefile = Filename()
 licensefile = Filename()
+authorid = ""
+authorname = ""
 
 
 try:
 try:
     opts, args = getopt.getopt(sys.argv[1:], 'n:N:v:o:t:P:cl:L:h')
     opts, args = getopt.getopt(sys.argv[1:], 'n:N:v:o:t:P:cl:L:h')
@@ -137,6 +147,10 @@ for opt, arg in opts:
         licensename = arg.strip()
         licensename = arg.strip()
     elif opt == '-L':
     elif opt == '-L':
         licensefile = Filename.fromOsSpecific(arg)
         licensefile = Filename.fromOsSpecific(arg)
+    elif opt == '-a':
+        authorid = arg.strip()
+    elif opt == '-A':
+        authorname = arg.strip()
         
         
     elif opt == '-h':
     elif opt == '-h':
         usage(0)
         usage(0)
@@ -197,6 +211,8 @@ elif deploy_mode == 'installer':
     i = Installer(shortname, fullname, appFilename, version, tokens = tokens)
     i = Installer(shortname, fullname, appFilename, version, tokens = tokens)
     i.licensename = licensename
     i.licensename = licensename
     i.licensefile = licensefile
     i.licensefile = licensefile
+    i.authorid = authorid
+    i.authorname = authorname
     
     
     if currentPlatform:
     if currentPlatform:
         platform = PandaSystem.getPlatform()
         platform = PandaSystem.getPlatform()