From 7a7eca25ee36a8ac5c8f282c27b03ad50ee426e8 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Mon, 12 Mar 2018 21:29:39 -0700 Subject: [PATCH] deploy-ng: Only add Python files that were frozen to the ignore list This allows copying over unfrozen Python files by adding modules to the exclude_modules dictionary (behaves like include_modules) and then making sure the Python file matches a pattern in the include_patterns list. --- direct/src/showutil/dist.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/direct/src/showutil/dist.py b/direct/src/showutil/dist.py index 24a953afd2..ec767ecf68 100644 --- a/direct/src/showutil/dist.py +++ b/direct/src/showutil/dist.py @@ -124,8 +124,8 @@ class build_apps(distutils.core.Command): self.rename_paths = _parse_dict(self.rename_paths) self.include_patterns = _parse_list(self.include_patterns) self.exclude_patterns = _parse_list(self.exclude_patterns) - self.include_modules = _parse_list(self.include_modules) - self.exclude_modules = _parse_list(self.exclude_modules) + self.include_modules = _parse_dict(self.include_modules) + self.exclude_modules = _parse_dict(self.exclude_modules) self.plugins = _parse_list(self.plugins) num_gui_apps = len(self.gui_apps) @@ -276,6 +276,7 @@ class build_apps(distutils.core.Command): # Create runtimes freezer_extras = set() freezer_modules = set() + freezer_modpaths = set() ext_suffixes = set() def create_runtime(appname, mainscript, use_console): freezer = FreezeTool.Freezer(platform=platform, path=path) @@ -325,6 +326,10 @@ class build_apps(distutils.core.Command): freezer_extras.update(freezer.extras) freezer_modules.update(freezer.getAllModuleNames()) + freezer_modpaths.update({ + mod[1].filename.to_os_specific() + for mod in freezer.getModuleDefs() if mod[1].filename + }) for suffix in freezer.moduleSuffixes: if suffix[2] == imp.C_EXTENSION: ext_suffixes.add(suffix[0]) @@ -434,10 +439,10 @@ class build_apps(distutils.core.Command): ignore_copy_list = [ '__pycache__', '*.pyc', - '*.py', '{}/*'.format(self.build_base), ] ignore_copy_list += self.exclude_patterns + ignore_copy_list += freezer_modpaths ignore_copy_list = [p3d.GlobPattern(i) for i in ignore_copy_list] include_copy_list = [p3d.GlobPattern(i) for i in self.include_patterns]