From 2817408db32beefc05c4e912a2bded73b292707b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 12 Nov 2020 16:06:54 +0200 Subject: [PATCH] Fixed an issue when `pio package pack` ignores some folders // Resolve #3730 --- HISTORY.rst | 3 ++- platformio/package/pack.py | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 600d0b96..adfc71e5 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -11,11 +11,12 @@ PlatformIO Core 5 5.0.3 (2020-??-??) ~~~~~~~~~~~~~~~~~~ -- Added an error selector for `Sublime Text `__ build runner (`issue #3733 `_) +- Added an error selector for `Sublime Text `__ build runner (`issue #3733 `_) - Generate a working "projectEnvName" for PlatformIO IDE's debugger for VSCode - Force VSCode's intelliSenseMode to "gcc-x64" when GCC toolchain is used - Print ignored test suites and environments in the test summary report only in verbose mode (`issue #3726 `_) - Fixed an issue when the package manager tries to install a built-in library from the registry (`issue #3662 `_) +- Fixed an issue when `pio package pack `__ ignores some folders (`issue #3730 `_) 5.0.2 (2020-10-30) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/package/pack.py b/platformio/package/pack.py index ebdca496..164ce96c 100644 --- a/platformio/package/pack.py +++ b/platformio/package/pack.py @@ -46,6 +46,8 @@ class PackagePacker(object): ".git/", ".hg/", ".svn/", + ] + EXCLUDE_EXTRA = [ # Tests "tests?", # Docs @@ -120,7 +122,6 @@ class PackagePacker(object): src = tmp_dir src = self.find_source_root(src) - manifest = self.load_manifest(src) filename = self.get_archive_name( manifest["name"], @@ -188,7 +189,7 @@ class PackagePacker(object): return dst def compute_src_filters(self, src, include, exclude): - exclude_default = self.EXCLUDE_DEFAULT[:] + exclude_extra = self.EXCLUDE_EXTRA[:] # extend with library extra filters if any( os.path.isfile(os.path.join(src, name)) @@ -198,11 +199,15 @@ class PackagePacker(object): ManifestFileType.MODULE_JSON, ) ): - exclude_default.extend(self.EXCLUDE_LIBRARY_EXTRA) + exclude_extra.extend(self.EXCLUDE_LIBRARY_EXTRA) result = ["+<%s>" % p for p in include or ["*", ".*"]] + result += ["-<%s>" % p for p in self.EXCLUDE_DEFAULT] + # exclude items declared in manifest result += ["-<%s>" % p for p in exclude or []] - result += ["-<%s>" % p for p in exclude_default] + # apply extra excludes if no custom "export" field in manifest + if not include and not exclude: + result += ["-<%s>" % p for p in exclude_extra] # automatically include manifests result += ["+<%s>" % p for p in self.INCLUDE_DEFAULT] return result