forked from platformio/platformio-core
PackageManifest: Ignore hidden files for examples
This commit is contained in:
@ -2,8 +2,5 @@
|
||||
|
||||
version: 2
|
||||
|
||||
sphinx:
|
||||
configuration: docs/conf.py
|
||||
|
||||
formats:
|
||||
- pdf
|
||||
|
@ -42,7 +42,7 @@ class ExportModel(DataModel):
|
||||
|
||||
|
||||
class ExampleModel(DataModel):
|
||||
name = DataField(max_length=100, regex=r"^[a-zA-Z\d\-\_ ]+$", required=True)
|
||||
name = DataField(max_length=100, regex=r"^[a-zA-Z\d\-\_/ ]+$", required=True)
|
||||
base = DataField(required=True)
|
||||
files = DataField(type=ListOfType(DataField()))
|
||||
|
||||
|
@ -180,6 +180,11 @@ class BaseManifestParser(object):
|
||||
result = {}
|
||||
last_pio_project = None
|
||||
for root, _, files in os.walk(examples_dir):
|
||||
# skip hidden files and folders
|
||||
files = [f for f in files if not f.startswith(".")]
|
||||
if os.path.basename(root).startswith(".") or not files:
|
||||
continue
|
||||
|
||||
if is_platformio_project(root):
|
||||
last_pio_project = root
|
||||
result[last_pio_project] = dict(
|
||||
|
@ -432,6 +432,7 @@ def test_examples_from_dir(tmpdir_factory):
|
||||
|
||||
# PlatformIO project #1
|
||||
pio_dir = examples_dir.mkdir("PlatformIO").mkdir("hello")
|
||||
pio_dir.join(".vimrc").write("")
|
||||
pio_dir.join("platformio.ini").write("")
|
||||
pio_dir.mkdir("include").join("main.h").write("")
|
||||
pio_dir.mkdir("src").join("main.cpp").write("")
|
||||
@ -470,6 +471,7 @@ def test_examples_from_dir(tmpdir_factory):
|
||||
|
||||
data["examples"] = _sort_examples(data["examples"])
|
||||
model = ManifestModel(**data)
|
||||
assert model.examples[0].name == "PlatformIO/hello"
|
||||
assert model == ManifestModel(
|
||||
**{
|
||||
"version": "1.0.0",
|
||||
|
Reference in New Issue
Block a user