Browse Source

ppackage -H is convenient

David Rose 15 years ago
parent
commit
b4900f139b
2 changed files with 19 additions and 2 deletions
  1. 8 1
      direct/src/p3d/Packager.py
  2. 11 1
      direct/src/p3d/ppackage.py

+ 8 - 1
direct/src/p3d/Packager.py

@@ -1851,6 +1851,11 @@ class Packager:
         # Particularly useful on OSX to reference the universal SDK.
         # Particularly useful on OSX to reference the universal SDK.
         self.systemRoot = None
         self.systemRoot = None
 
 
+        # Set this true to treat setHost() the same as addHost(), thus
+        # ignoring any request to specify a particular download host,
+        # e.g. for testing and development.
+        self.ignoreSetHost = False
+
         # The download URL at which these packages will eventually be
         # The download URL at which these packages will eventually be
         # hosted.
         # hosted.
         self.hosts = {}
         self.hosts = {}
@@ -2065,7 +2070,9 @@ class Packager:
         """ Specifies the URL that will ultimately host these
         """ Specifies the URL that will ultimately host these
         contents. """
         contents. """
 
 
-        self.host = host
+        if not self.ignoreSetHost:
+            self.host = host
+            
         self.addHost(host, downloadUrl = downloadUrl,
         self.addHost(host, downloadUrl = downloadUrl,
                      descriptiveName = descriptiveName, hostDir = hostDir,
                      descriptiveName = descriptiveName, hostDir = hostDir,
                      mirrors = mirrors)
                      mirrors = mirrors)

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

@@ -106,6 +106,12 @@ Options:
      instead of the system library.  This is particularly useful for
      instead of the system library.  This is particularly useful for
      cross-compilation.  At the moment, this is supported only on OSX.
      cross-compilation.  At the moment, this is supported only on OSX.
 
 
+  -H
+     Treats a packager.setHost() call in the pdef file as if it were
+     merely a call to packager.addHost().  This allows producing a
+     package for an alternate host than its normally configured host,
+     which is sometimes useful in development.
+
   -h
   -h
      Display this help
      Display this help
 """
 """
@@ -129,10 +135,11 @@ signParams = []
 allowPythonDev = False
 allowPythonDev = False
 universalBinaries = False
 universalBinaries = False
 systemRoot = None
 systemRoot = None
+ignoreSetHost = False
 platforms = []
 platforms = []
 
 
 try:
 try:
-    opts, args = getopt.getopt(sys.argv[1:], 'i:ps:S:DuP:R:h')
+    opts, args = getopt.getopt(sys.argv[1:], 'i:ps:S:DuP:R:Hh')
 except getopt.error, msg:
 except getopt.error, msg:
     usage(1, msg)
     usage(1, msg)
 
 
@@ -157,6 +164,8 @@ for opt, arg in opts:
         platforms.append(arg)
         platforms.append(arg)
     elif opt == '-R':
     elif opt == '-R':
         systemRoot = arg
         systemRoot = arg
+    elif opt == '-H':
+        ignoreSetHost = True
         
         
     elif opt == '-h':
     elif opt == '-h':
         usage(0)
         usage(0)
@@ -200,6 +209,7 @@ for platform in platforms:
     packager.signParams = signParams
     packager.signParams = signParams
     packager.allowPythonDev = allowPythonDev
     packager.allowPythonDev = allowPythonDev
     packager.systemRoot = systemRoot
     packager.systemRoot = systemRoot
+    packager.ignoreSetHost = ignoreSetHost
 
 
     try:
     try:
         packager.setup()
         packager.setup()