forked from platformio/platformio-core
Include hidden files by default in a package
This commit is contained in:
@@ -26,7 +26,14 @@ from platformio.unpacker import FileUnpacker
|
|||||||
|
|
||||||
|
|
||||||
class PackagePacker(object):
|
class PackagePacker(object):
|
||||||
EXCLUDE_DEFAULT = ["._*", ".DS_Store", ".git", ".hg", ".svn", ".pio"]
|
EXCLUDE_DEFAULT = [
|
||||||
|
"._*",
|
||||||
|
".DS_Store",
|
||||||
|
".git",
|
||||||
|
".hg",
|
||||||
|
".svn",
|
||||||
|
".pio",
|
||||||
|
]
|
||||||
INCLUDE_DEFAULT = ManifestFileType.items().values()
|
INCLUDE_DEFAULT = ManifestFileType.items().values()
|
||||||
|
|
||||||
def __init__(self, package, manifest_uri=None):
|
def __init__(self, package, manifest_uri=None):
|
||||||
@@ -116,7 +123,7 @@ class PackagePacker(object):
|
|||||||
return dst
|
return dst
|
||||||
|
|
||||||
def compute_src_filters(self, include, exclude):
|
def compute_src_filters(self, include, exclude):
|
||||||
result = ["+<%s>" % p for p in include or ["*"]]
|
result = ["+<%s>" % p for p in include or ["*", ".*"]]
|
||||||
result += ["-<%s>" % p for p in exclude or []]
|
result += ["-<%s>" % p for p in exclude or []]
|
||||||
result += ["-<%s>" % p for p in self.EXCLUDE_DEFAULT]
|
result += ["-<%s>" % p for p in self.EXCLUDE_DEFAULT]
|
||||||
# automatically include manifests
|
# automatically include manifests
|
||||||
|
@@ -26,6 +26,9 @@ from platformio.package.pack import PackagePacker
|
|||||||
|
|
||||||
def test_base(tmpdir_factory):
|
def test_base(tmpdir_factory):
|
||||||
pkg_dir = tmpdir_factory.mktemp("package")
|
pkg_dir = tmpdir_factory.mktemp("package")
|
||||||
|
pkg_dir.join(".git").mkdir().join("file").write("")
|
||||||
|
pkg_dir.join(".gitignore").write("tests")
|
||||||
|
pkg_dir.join("._ignored").write("")
|
||||||
pkg_dir.join("main.cpp").write("#include <stdio.h>")
|
pkg_dir.join("main.cpp").write("#include <stdio.h>")
|
||||||
p = PackagePacker(str(pkg_dir))
|
p = PackagePacker(str(pkg_dir))
|
||||||
# test missed manifest
|
# test missed manifest
|
||||||
@@ -38,7 +41,7 @@ def test_base(tmpdir_factory):
|
|||||||
p.pack()
|
p.pack()
|
||||||
with tarfile.open(os.path.join(str(pkg_dir), "foo-1.0.0.tar.gz"), "r:gz") as tar:
|
with tarfile.open(os.path.join(str(pkg_dir), "foo-1.0.0.tar.gz"), "r:gz") as tar:
|
||||||
assert set(tar.getnames()) == set(
|
assert set(tar.getnames()) == set(
|
||||||
["include/main.h", "library.json", "main.cpp"]
|
[".gitignore", "include/main.h", "library.json", "main.cpp"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user