[Buildroot] [git commit] package/python-pathspec: enable target variant

Yann E. MORIN yann.morin.1998 at free.fr
Fri Apr 12 15:47:02 UTC 2024


commit: https://git.buildroot.net/buildroot/commit/?id=7fa769dae39ea23a14c02606a23db8978a496e19
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Also a runtime testcase is added.

Signed-off-by: Heiko Thiery <heiko.thiery at gmail.com>
[yann.morin.1998 at free.fr:
  - fix check-package
  - small codign style in test sample
]
Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
---
 package/Config.in                                  |  1 +
 package/python-pathspec/Config.in                  |  7 +++++
 package/python-pathspec/python-pathspec.mk         |  1 +
 .../tests/package/sample_python_pathspec.py        | 36 ++++++++++++++++++++++
 .../testing/tests/package/test_python_pathspec.py  | 11 +++++++
 5 files changed, 56 insertions(+)

diff --git a/package/Config.in b/package/Config.in
index 0d31faf354..d9bbf64c95 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1223,6 +1223,7 @@ menu "External python modules"
 	source "package/python-parso/Config.in"
 	source "package/python-passlib/Config.in"
 	source "package/python-pathpy/Config.in"
+	source "package/python-pathspec/Config.in"
 	source "package/python-pathtools/Config.in"
 	source "package/python-pathvalidate/Config.in"
 	source "package/python-periphery/Config.in"
diff --git a/package/python-pathspec/Config.in b/package/python-pathspec/Config.in
new file mode 100644
index 0000000000..0453e70419
--- /dev/null
+++ b/package/python-pathspec/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_PYTHON_PATHSPEC
+	bool "python-pathspec"
+	help
+	  pathspec is a utility library for pattern matching of file
+	  paths.
+
+	  https://github.com/cpburnz/python-pathspec
diff --git a/package/python-pathspec/python-pathspec.mk b/package/python-pathspec/python-pathspec.mk
index c4cb34b4c3..b46dbef7ea 100644
--- a/package/python-pathspec/python-pathspec.mk
+++ b/package/python-pathspec/python-pathspec.mk
@@ -11,4 +11,5 @@ PYTHON_PATHSPEC_LICENSE = MPL-2.0
 PYTHON_PATHSPEC_LICENSE_FILES = LICENSE
 PYTHON_PATHSPEC_SETUP_TYPE = flit
 
+$(eval $(python-package))
 $(eval $(host-python-package))
diff --git a/support/testing/tests/package/sample_python_pathspec.py b/support/testing/tests/package/sample_python_pathspec.py
new file mode 100644
index 0000000000..1b5bf62ba2
--- /dev/null
+++ b/support/testing/tests/package/sample_python_pathspec.py
@@ -0,0 +1,36 @@
+# example from https://pypi.org/project/pathspec/
+
+import pathspec
+
+# The gitignore-style patterns for files to select, but we're including
+# instead of ignoring.
+spec_text = """
+
+# This is a comment because the line begins with a hash: "#"
+
+# Include several project directories (and all descendants) relative to
+# the current directory. To reference a directory you must end with a
+# slash: "/"
+/project-a/
+/project-b/
+/project-c/
+
+# Patterns can be negated by prefixing with exclamation mark: "!"
+
+# Ignore temporary files beginning or ending with "~" and ending with
+# ".swp".
+!~*
+!*~
+!*.swp
+
+# These are python projects so ignore compiled python files from
+# testing.
+!*.pyc
+
+# Ignore the build directories but only directly under the project
+# directories.
+!/*/build/
+
+"""
+
+spec = pathspec.PathSpec.from_lines('gitwildmatch', spec_text.splitlines())
diff --git a/support/testing/tests/package/test_python_pathspec.py b/support/testing/tests/package/test_python_pathspec.py
new file mode 100644
index 0000000000..4e4a992bb3
--- /dev/null
+++ b/support/testing/tests/package/test_python_pathspec.py
@@ -0,0 +1,11 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPathSpec(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_PATHSPEC=y
+        """
+    sample_scripts = ["tests/package/sample_python_pathspec.py"]



More information about the buildroot mailing list