mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
Distutils: Skip copying frozen Python packages
This commit is contained in:
parent
df7e3f03e2
commit
a628dd6edc
@ -18,12 +18,13 @@ class Distribution(distutils.dist.Distribution):
|
|||||||
class build(distutils.command.build.build):
|
class build(distutils.command.build.build):
|
||||||
def run(self):
|
def run(self):
|
||||||
distutils.command.build.build.run(self)
|
distutils.command.build.build.run(self)
|
||||||
basename = os.path.abspath(os.path.join(self.build_base, self.distribution.get_fullname()))
|
builddir = self.build_base
|
||||||
|
basename = os.path.abspath(os.path.join(builddir, self.distribution.get_fullname()))
|
||||||
gamedir = self.distribution.game_dir
|
gamedir = self.distribution.game_dir
|
||||||
startfile = os.path.join(gamedir, self.distribution.mainfile)
|
startfile = os.path.join(gamedir, self.distribution.mainfile)
|
||||||
|
|
||||||
if not os.path.exists(self.build_base):
|
if not os.path.exists(builddir):
|
||||||
os.makedirs(self.build_base)
|
os.makedirs(builddir)
|
||||||
|
|
||||||
freezer = FreezeTool.Freezer()
|
freezer = FreezeTool.Freezer()
|
||||||
freezer.addModule('__main__', filename=startfile)
|
freezer.addModule('__main__', filename=startfile)
|
||||||
@ -31,11 +32,19 @@ class build(distutils.command.build.build):
|
|||||||
freezer.done(addStartupModules=True)
|
freezer.done(addStartupModules=True)
|
||||||
freezer.generateRuntimeFromStub(basename)
|
freezer.generateRuntimeFromStub(basename)
|
||||||
|
|
||||||
|
ignore_copy_list = [
|
||||||
|
'__pycache__',
|
||||||
|
self.distribution.mainfile,
|
||||||
|
*freezer.getAllModuleNames(),
|
||||||
|
]
|
||||||
|
|
||||||
for item in os.listdir(gamedir):
|
for item in os.listdir(gamedir):
|
||||||
if item in ('__pycache__', startfile):
|
|
||||||
continue
|
|
||||||
src = os.path.join(gamedir, item)
|
src = os.path.join(gamedir, item)
|
||||||
dst = os.path.join(self.build_base, item)
|
dst = os.path.join(builddir, item)
|
||||||
|
|
||||||
|
if item in ignore_copy_list:
|
||||||
|
print("Skip", src)
|
||||||
|
continue
|
||||||
|
|
||||||
if os.path.isdir(src):
|
if os.path.isdir(src):
|
||||||
print("Copy dir", src, dst)
|
print("Copy dir", src, dst)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user