|
|
@@ -18,12 +18,13 @@ class Distribution(distutils.dist.Distribution):
|
|
|
class build(distutils.command.build.build):
|
|
|
def 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
|
|
|
startfile = os.path.join(gamedir, self.distribution.mainfile)
|
|
|
|
|
|
- if not os.path.exists(self.build_base):
|
|
|
- os.makedirs(self.build_base)
|
|
|
+ if not os.path.exists(builddir):
|
|
|
+ os.makedirs(builddir)
|
|
|
|
|
|
freezer = FreezeTool.Freezer()
|
|
|
freezer.addModule('__main__', filename=startfile)
|
|
|
@@ -31,11 +32,19 @@ class build(distutils.command.build.build):
|
|
|
freezer.done(addStartupModules=True)
|
|
|
freezer.generateRuntimeFromStub(basename)
|
|
|
|
|
|
+ ignore_copy_list = [
|
|
|
+ '__pycache__',
|
|
|
+ self.distribution.mainfile,
|
|
|
+ *freezer.getAllModuleNames(),
|
|
|
+ ]
|
|
|
+
|
|
|
for item in os.listdir(gamedir):
|
|
|
- if item in ('__pycache__', startfile):
|
|
|
- continue
|
|
|
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):
|
|
|
print("Copy dir", src, dst)
|