mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
deploy-ng: Add bdist_panda3d command to create archives for each built platform
Linux platforms use tar.gz and everything else (Windows, macOS) uses zip. Later we will want to add an option to control this. Also, bdist_panda3d currently auto-runs build. We will want an option to skip this build step for debug/testing purposes.
This commit is contained in:
parent
ca036a56f2
commit
2923af7d44
@ -108,8 +108,40 @@ class build(distutils.command.build.build):
|
||||
distutils.file_util.copy_file(src, dst)
|
||||
|
||||
|
||||
class bdist_panda3d(distutils.core.Command):
|
||||
user_options = []
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
platforms = [p3d.PandaSystem.get_platform()]
|
||||
build_base = os.path.join(os.getcwd(), 'build')
|
||||
|
||||
self.run_command("build")
|
||||
os.chdir(build_base)
|
||||
|
||||
for platform in platforms:
|
||||
build_dir = os.path.join(build_base, platform)
|
||||
base_dir = self.distribution.get_name()
|
||||
temp_dir = os.path.join(build_base, base_dir)
|
||||
archive_format = 'gztar' if platform.startswith('linux') else 'zip'
|
||||
basename = '{}_{}'.format(self.distribution.get_fullname(), platform)
|
||||
|
||||
if (os.path.exists(temp_dir)):
|
||||
distutils.dir_util.remove_tree(temp_dir)
|
||||
distutils.dir_util.copy_tree(build_dir, temp_dir)
|
||||
|
||||
distutils.archive_util.make_archive(basename, archive_format, root_dir=build_base, base_dir=base_dir)
|
||||
|
||||
distutils.dir_util.remove_tree(temp_dir)
|
||||
|
||||
def setup(**attrs):
|
||||
attrs.setdefault("distclass", Distribution)
|
||||
commandClasses = attrs.setdefault("cmdclass", {})
|
||||
commandClasses['build'] = build
|
||||
commandClasses['bdist_panda3d'] = bdist_panda3d
|
||||
distutils.core.setup(**attrs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user