mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
allow ppackage to drop p3d files into the current directory by default
This commit is contained in:
parent
cfe0796c46
commit
2eaf5a88b5
@ -339,6 +339,10 @@ class Packager:
|
|||||||
def close(self):
|
def close(self):
|
||||||
""" Writes out the contents of the current package. """
|
""" Writes out the contents of the current package. """
|
||||||
|
|
||||||
|
if not self.p3dApplication and not self.packager.allowPackages:
|
||||||
|
message = 'Cannot generate packages without an installDir; use -i'
|
||||||
|
raise PackagerError, message
|
||||||
|
|
||||||
if not self.host:
|
if not self.host:
|
||||||
self.host = self.packager.host
|
self.host = self.packager.host
|
||||||
|
|
||||||
@ -629,11 +633,14 @@ class Packager:
|
|||||||
|
|
||||||
print "Generating %s" % (self.packageFilename)
|
print "Generating %s" % (self.packageFilename)
|
||||||
|
|
||||||
self.packageFullpath = Filename(self.packager.installDir, self.packageFilename)
|
|
||||||
self.packageFullpath.makeDir()
|
|
||||||
|
|
||||||
if self.p3dApplication:
|
if self.p3dApplication:
|
||||||
|
self.packageFullpath = Filename(self.packager.p3dInstallDir, self.packageFilename)
|
||||||
|
self.packageFullpath.makeDir()
|
||||||
self.makeP3dInfo()
|
self.makeP3dInfo()
|
||||||
|
else:
|
||||||
|
self.packageFullpath = Filename(self.packager.installDir, self.packageFilename)
|
||||||
|
self.packageFullpath.makeDir()
|
||||||
|
|
||||||
self.multifile.repack()
|
self.multifile.repack()
|
||||||
|
|
||||||
# Also sign the multifile before we close it.
|
# Also sign the multifile before we close it.
|
||||||
@ -686,6 +693,10 @@ class Packager:
|
|||||||
if self.version:
|
if self.version:
|
||||||
packageDir += '/' + self.version
|
packageDir += '/' + self.version
|
||||||
|
|
||||||
|
if not self.packager.allowPackages:
|
||||||
|
message = 'Cannot generate packages without an installDir; use -i'
|
||||||
|
raise PackagerError, message
|
||||||
|
|
||||||
installPath = Filename(self.packager.installDir, packageDir)
|
installPath = Filename(self.packager.installDir, packageDir)
|
||||||
# Remove any files already in the installPath.
|
# Remove any files already in the installPath.
|
||||||
origFiles = vfs.scanDirectory(installPath)
|
origFiles = vfs.scanDirectory(installPath)
|
||||||
@ -2144,8 +2155,18 @@ class Packager:
|
|||||||
|
|
||||||
self.currentPackage = None
|
self.currentPackage = None
|
||||||
|
|
||||||
# We must have an actual install directory.
|
if self.installDir:
|
||||||
assert(self.installDir)
|
# If we were given an install directory, we can build
|
||||||
|
# packages as well as plain p3d files, and it all goes
|
||||||
|
# into the specified directory.
|
||||||
|
self.p3dInstallDir = self.installDir
|
||||||
|
self.allowPackages = True
|
||||||
|
else:
|
||||||
|
# If we don't have an actual install directory, we can
|
||||||
|
# only build p3d files, and we drop them into the current
|
||||||
|
# directory.
|
||||||
|
self.p3dInstallDir = '.'
|
||||||
|
self.allowPackages = False
|
||||||
|
|
||||||
if not PandaSystem.getPackageVersionString() or not PandaSystem.getPackageHostUrl():
|
if not PandaSystem.getPackageVersionString() or not PandaSystem.getPackageHostUrl():
|
||||||
raise PackagerError, 'This script must be run using a version of Panda3D that has been built\nfor distribution. Try using ppackage.p3d or packp3d.p3d instead.'
|
raise PackagerError, 'This script must be run using a version of Panda3D that has been built\nfor distribution. Try using ppackage.p3d or packp3d.p3d instead.'
|
||||||
@ -2170,9 +2191,10 @@ class Packager:
|
|||||||
if not package.p3dApplication and not package.solo:
|
if not package.p3dApplication and not package.solo:
|
||||||
packageNames.append(package.packageName)
|
packageNames.append(package.packageName)
|
||||||
|
|
||||||
from PatchMaker import PatchMaker
|
if packageNames:
|
||||||
pm = PatchMaker(self.installDir)
|
from PatchMaker import PatchMaker
|
||||||
pm.buildPatches(packageNames = packageNames)
|
pm = PatchMaker(self.installDir)
|
||||||
|
pm.buildPatches(packageNames = packageNames)
|
||||||
|
|
||||||
def readPackageDef(self, packageDef, packageNames = None):
|
def readPackageDef(self, packageDef, packageNames = None):
|
||||||
""" Reads the named .pdef file and constructs the named
|
""" Reads the named .pdef file and constructs the named
|
||||||
@ -2339,6 +2361,11 @@ class Packager:
|
|||||||
|
|
||||||
package.p3dApplication = p3dApplication
|
package.p3dApplication = p3dApplication
|
||||||
package.solo = solo
|
package.solo = solo
|
||||||
|
|
||||||
|
if not package.p3dApplication and not self.allowPackages:
|
||||||
|
message = 'Cannot generate packages without an installDir; use -i'
|
||||||
|
raise PackagerError, message
|
||||||
|
|
||||||
|
|
||||||
def endPackage(self):
|
def endPackage(self):
|
||||||
""" Closes the current package specification. This actually
|
""" Closes the current package specification. This actually
|
||||||
@ -3123,6 +3150,10 @@ class Packager:
|
|||||||
self.contents = {}
|
self.contents = {}
|
||||||
self.contentsChanged = False
|
self.contentsChanged = False
|
||||||
|
|
||||||
|
if not self.allowPackages:
|
||||||
|
# Don't bother.
|
||||||
|
return
|
||||||
|
|
||||||
contentsFilename = Filename(self.installDir, 'contents.xml')
|
contentsFilename = Filename(self.installDir, 'contents.xml')
|
||||||
doc = TiXmlDocument(contentsFilename.toOsSpecific())
|
doc = TiXmlDocument(contentsFilename.toOsSpecific())
|
||||||
if not doc.LoadFile():
|
if not doc.LoadFile():
|
||||||
|
@ -142,7 +142,7 @@ for opt, arg in opts:
|
|||||||
elif opt == '-p':
|
elif opt == '-p':
|
||||||
buildPatches = True
|
buildPatches = True
|
||||||
elif opt == '-s':
|
elif opt == '-s':
|
||||||
installSearch.appendDirectory(Filename.fromOsSpecific(arg))
|
installSearch.append(Filename.fromOsSpecific(arg))
|
||||||
elif opt == '-S':
|
elif opt == '-S':
|
||||||
tokens = arg.split(',')
|
tokens = arg.split(',')
|
||||||
while len(tokens) < 4:
|
while len(tokens) < 4:
|
||||||
@ -172,10 +172,6 @@ packageNames = None
|
|||||||
if len(args) > 1:
|
if len(args) > 1:
|
||||||
packageNames = args[1:]
|
packageNames = args[1:]
|
||||||
|
|
||||||
if not installDir:
|
|
||||||
print '\nYou must name the target install directory with the -i parameter.\n'
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if universalBinaries:
|
if universalBinaries:
|
||||||
if platforms:
|
if platforms:
|
||||||
print '\nYou may not specify both -u and -P.\n'
|
print '\nYou may not specify both -u and -P.\n'
|
||||||
@ -190,7 +186,9 @@ if not platforms:
|
|||||||
for platform in platforms:
|
for platform in platforms:
|
||||||
packager = Packager.Packager(platform = platform)
|
packager = Packager.Packager(platform = platform)
|
||||||
packager.installDir = installDir
|
packager.installDir = installDir
|
||||||
packager.installSearch = [installDir] + installSearch + packager.installSearch
|
packager.installSearch = installSearch + packager.installSearch
|
||||||
|
if installDir is not None:
|
||||||
|
packager.installSearch = [installDir] + packager.installSearch
|
||||||
packager.signParams = signParams
|
packager.signParams = signParams
|
||||||
packager.allowPythonDev = allowPythonDev
|
packager.allowPythonDev = allowPythonDev
|
||||||
packager.systemRoot = systemRoot
|
packager.systemRoot = systemRoot
|
||||||
|
Loading…
x
Reference in New Issue
Block a user