deploy-ng: Allow setting build_apps command line options via bdist_apps command line options

This commit is contained in:
Mitchell Stokes 2018-11-03 12:32:29 -07:00
parent a42ebaea74
commit d9256755e3

View File

@ -1133,10 +1133,16 @@ class bdist_apps(setuptools.Command):
} }
description = 'bundle built Panda3D applications into distributable forms' description = 'bundle built Panda3D applications into distributable forms'
user_options = [] user_options = build_apps.user_options + [
]
def _build_apps_options(self):
return [opt[0].replace('-', '_').replace('=', '') for opt in build_apps.user_options]
def initialize_options(self): def initialize_options(self):
self.installers = {} self.installers = {}
for opt in self._build_apps_options():
setattr(self, opt, None)
def finalize_options(self): def finalize_options(self):
# We need to massage the inputs a bit in case they came from a # We need to massage the inputs a bit in case they came from a
@ -1283,14 +1289,16 @@ class bdist_apps(setuptools.Command):
subprocess.check_call(cmd) subprocess.check_call(cmd)
def run(self): def run(self):
build_cmd = self.get_finalized_command('build_apps') build_cmd = self.distribution.get_command_obj('build_apps')
if not build_cmd.platforms: for opt in self._build_apps_options():
platforms = [p3d.PandaSystem.get_platform()] optval = getattr(self, opt)
else: if optval is not None:
platforms = build_cmd.platforms setattr(build_cmd, opt, optval)
build_base = build_cmd.build_base build_cmd.finalize_options()
self.run_command('build_apps') self.run_command('build_apps')
platforms = build_cmd.platforms
build_base = build_cmd.build_base
os.chdir(build_base) os.chdir(build_base)
for platform in platforms: for platform in platforms: