mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
platform_specific
This commit is contained in:
parent
010f740ff6
commit
ba832881c5
@ -341,6 +341,6 @@ class PackageInfo:
|
|||||||
|
|
||||||
if root not in sys.path:
|
if root not in sys.path:
|
||||||
sys.path.append(root)
|
sys.path.append(root)
|
||||||
print "Installed %s %s" % (self.packageName, self.packageVersion)
|
#print "Installed %s %s" % (self.packageName, self.packageVersion)
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class Packager:
|
|||||||
def __init__(self, package, filename,
|
def __init__(self, package, filename,
|
||||||
newName = None, deleteTemp = False,
|
newName = None, deleteTemp = False,
|
||||||
explicit = False, compress = None, extract = None,
|
explicit = False, compress = None, extract = None,
|
||||||
executable = None):
|
executable = None, platformSpecific = None):
|
||||||
assert isinstance(filename, Filename)
|
assert isinstance(filename, Filename)
|
||||||
self.filename = Filename(filename)
|
self.filename = Filename(filename)
|
||||||
self.newName = newName
|
self.newName = newName
|
||||||
@ -44,6 +44,7 @@ class Packager:
|
|||||||
self.compress = compress
|
self.compress = compress
|
||||||
self.extract = extract
|
self.extract = extract
|
||||||
self.executable = executable
|
self.executable = executable
|
||||||
|
self.platformSpecific = platformSpecific
|
||||||
|
|
||||||
if not self.newName:
|
if not self.newName:
|
||||||
self.newName = self.filename.cStr()
|
self.newName = self.filename.cStr()
|
||||||
@ -68,7 +69,8 @@ class Packager:
|
|||||||
|
|
||||||
if self.extract is None:
|
if self.extract is None:
|
||||||
self.extract = self.executable or (ext in packager.extractExtensions)
|
self.extract = self.executable or (ext in packager.extractExtensions)
|
||||||
self.platformSpecific = self.executable or (ext in packager.platformSpecificExtensions)
|
if self.platformSpecific is None:
|
||||||
|
self.platformSpecific = self.executable or (ext in packager.platformSpecificExtensions)
|
||||||
|
|
||||||
|
|
||||||
if self.executable:
|
if self.executable:
|
||||||
@ -110,6 +112,11 @@ class Packager:
|
|||||||
if exclude.matches(self.filename):
|
if exclude.matches(self.filename):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
# A platform-specific file is implicitly excluded from
|
||||||
|
# not-platform-specific packages.
|
||||||
|
if self.platformSpecific and package.platformSpecificConfig is False:
|
||||||
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
class ExcludeFilename:
|
class ExcludeFilename:
|
||||||
@ -224,6 +231,12 @@ class Packager:
|
|||||||
if not self.host:
|
if not self.host:
|
||||||
self.host = self.packager.host
|
self.host = self.packager.host
|
||||||
|
|
||||||
|
# Check the platform_specific config variable. This has
|
||||||
|
# only three settings: None (unset), True, or False.
|
||||||
|
self.platformSpecificConfig = self.configs.get('platform_specific', None)
|
||||||
|
if self.platformSpecificConfig is not None:
|
||||||
|
self.platformSpecificConfig = bool(self.platformSpecificConfig)
|
||||||
|
|
||||||
# A special case when building the "panda3d" package. We
|
# A special case when building the "panda3d" package. We
|
||||||
# enforce that the version number matches what we've been
|
# enforce that the version number matches what we've been
|
||||||
# compiled with.
|
# compiled with.
|
||||||
@ -245,17 +258,6 @@ class Packager:
|
|||||||
|
|
||||||
# Every p3dapp requires panda3d.
|
# Every p3dapp requires panda3d.
|
||||||
self.packager.do_require('panda3d')
|
self.packager.do_require('panda3d')
|
||||||
|
|
||||||
# Check to see if any of the files are platform-specific.
|
|
||||||
platformSpecific = False
|
|
||||||
for file in self.files:
|
|
||||||
if file.isExcluded(self):
|
|
||||||
# Skip this file.
|
|
||||||
continue
|
|
||||||
if file.platformSpecific:
|
|
||||||
platformSpecific = True
|
|
||||||
if platformSpecific and not self.platform:
|
|
||||||
self.platform = PandaSystem.getPlatform()
|
|
||||||
|
|
||||||
if not self.p3dApplication and not self.version:
|
if not self.p3dApplication and not self.version:
|
||||||
# If we don't have an implicit version, inherit the
|
# If we don't have an implicit version, inherit the
|
||||||
@ -271,6 +273,23 @@ class Packager:
|
|||||||
else:
|
else:
|
||||||
self.installMultifile()
|
self.installMultifile()
|
||||||
|
|
||||||
|
def considerPlatform(self):
|
||||||
|
# Check to see if any of the files are platform-specific,
|
||||||
|
# making the overall package platform-specific.
|
||||||
|
|
||||||
|
platformSpecific = self.platformSpecificConfig
|
||||||
|
for file in self.files:
|
||||||
|
if file.isExcluded(self):
|
||||||
|
# Skip this file.
|
||||||
|
continue
|
||||||
|
if file.platformSpecific:
|
||||||
|
platformSpecific = True
|
||||||
|
|
||||||
|
if platformSpecific and self.platformSpecificConfig is not False:
|
||||||
|
if not self.platform:
|
||||||
|
self.platform = PandaSystem.getPlatform()
|
||||||
|
|
||||||
|
|
||||||
def installMultifile(self):
|
def installMultifile(self):
|
||||||
""" Installs the package, either as a p3d application, or
|
""" Installs the package, either as a p3d application, or
|
||||||
as a true package. Either is implemented with a
|
as a true package. Either is implemented with a
|
||||||
@ -413,6 +432,9 @@ class Packager:
|
|||||||
# Handled above.
|
# Handled above.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Check to see if we should be platform-specific.
|
||||||
|
self.considerPlatform()
|
||||||
|
|
||||||
# Now that we've processed all of the component files,
|
# Now that we've processed all of the component files,
|
||||||
# (and set our platform if necessary), we can generate the
|
# (and set our platform if necessary), we can generate the
|
||||||
# output filename and write the output files.
|
# output filename and write the output files.
|
||||||
@ -480,6 +502,8 @@ class Packager:
|
|||||||
just a single dll and a jpg file; but it can support other
|
just a single dll and a jpg file; but it can support other
|
||||||
kinds of similar "solo" packages as well. """
|
kinds of similar "solo" packages as well. """
|
||||||
|
|
||||||
|
self.considerPlatform()
|
||||||
|
|
||||||
packageDir = self.packageName
|
packageDir = self.packageName
|
||||||
if self.platform:
|
if self.platform:
|
||||||
packageDir += '/' + self.platform
|
packageDir += '/' + self.platform
|
||||||
@ -517,7 +541,6 @@ class Packager:
|
|||||||
print "Could not copy %s to %s" % (
|
print "Could not copy %s to %s" % (
|
||||||
file.filename, targetPath)
|
file.filename, targetPath)
|
||||||
|
|
||||||
|
|
||||||
# Replace or add the entry in the contents.
|
# Replace or add the entry in the contents.
|
||||||
a = Packager.PackageEntry()
|
a = Packager.PackageEntry()
|
||||||
a.fromFile(self.packageName, self.platform, self.version,
|
a.fromFile(self.packageName, self.platform, self.version,
|
||||||
@ -790,10 +813,6 @@ class Packager:
|
|||||||
the current list of files. """
|
the current list of files. """
|
||||||
|
|
||||||
freezer = self.freezer
|
freezer = self.freezer
|
||||||
if freezer.extras:
|
|
||||||
if not self.platform:
|
|
||||||
self.platform = PandaSystem.getPlatform()
|
|
||||||
|
|
||||||
for moduleName, filename in freezer.extras:
|
for moduleName, filename in freezer.extras:
|
||||||
filename = Filename.fromOsSpecific(filename)
|
filename = Filename.fromOsSpecific(filename)
|
||||||
newName = filename.getBasename()
|
newName = filename.getBasename()
|
||||||
@ -803,7 +822,9 @@ class Packager:
|
|||||||
# Sometimes the PYTHONPATH has the wrong case in it.
|
# Sometimes the PYTHONPATH has the wrong case in it.
|
||||||
filename.makeTrueCase()
|
filename.makeTrueCase()
|
||||||
self.addFile(filename, newName = newName,
|
self.addFile(filename, newName = newName,
|
||||||
explicit = False, extract = True)
|
explicit = False, extract = True,
|
||||||
|
executable = True,
|
||||||
|
platformSpecific = True)
|
||||||
freezer.extras = []
|
freezer.extras = []
|
||||||
|
|
||||||
|
|
||||||
@ -1155,10 +1176,6 @@ class Packager:
|
|||||||
return newName
|
return newName
|
||||||
|
|
||||||
def addComponent(self, file):
|
def addComponent(self, file):
|
||||||
if file.platformSpecific:
|
|
||||||
if not self.platform:
|
|
||||||
self.platform = PandaSystem.getPlatform()
|
|
||||||
|
|
||||||
compressionLevel = 0
|
compressionLevel = 0
|
||||||
if file.compress:
|
if file.compress:
|
||||||
compressionLevel = self.compressionLevel
|
compressionLevel = self.compressionLevel
|
||||||
|
@ -147,7 +147,7 @@ class packp3d(p3d):
|
|||||||
# the targeted runtime.
|
# the targeted runtime.
|
||||||
|
|
||||||
config(display_name = "Panda3D Application Packer",
|
config(display_name = "Panda3D Application Packer",
|
||||||
hidden = True)
|
hidden = True, platform_specific = False)
|
||||||
require('panda3d', 'egg')
|
require('panda3d', 'egg')
|
||||||
|
|
||||||
mainModule('direct.p3d.packp3d')
|
mainModule('direct.p3d.packp3d')
|
||||||
@ -159,7 +159,7 @@ class ppackage(p3d):
|
|||||||
# more packages or p3d applications.
|
# more packages or p3d applications.
|
||||||
|
|
||||||
config(display_name = "Panda3D General Package Utility",
|
config(display_name = "Panda3D General Package Utility",
|
||||||
hidden = True)
|
hidden = True, platform_specific = False)
|
||||||
require('panda3d', 'egg')
|
require('panda3d', 'egg')
|
||||||
|
|
||||||
mainModule('direct.p3d.ppackage')
|
mainModule('direct.p3d.ppackage')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user