diff mbox series

[v2] package/python-jc: new package

Message ID 20240213094015.2203982-1-buildroot@bubu1.eu
State Accepted
Headers show
Series [v2] package/python-jc: new package | expand

Commit Message

Marcus Hoffmann Feb. 13, 2024, 9:40 a.m. UTC
All dependencies are optional, and thus only mentioned in the package help text.

Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
---
Changes v1 -> v2:
  - update to 1.25.1
  - xmltodict and python xml module are now optional dependencies
  - rename test class to conform to naming scheme
---
 package/Config.in                             |  1 +
 package/python-jc/Config.in                   | 12 ++++++++++
 package/python-jc/python-jc.hash              |  5 +++++
 package/python-jc/python-jc.mk                | 14 ++++++++++++
 .../testing/tests/package/test_python_jc.py   | 22 +++++++++++++++++++
 5 files changed, 54 insertions(+)
 create mode 100644 package/python-jc/Config.in
 create mode 100644 package/python-jc/python-jc.hash
 create mode 100644 package/python-jc/python-jc.mk
 create mode 100644 support/testing/tests/package/test_python_jc.py

Comments

Arnout Vandecappelle March 3, 2024, 8:31 p.m. UTC | #1
On 13/02/2024 10:40, Marcus Hoffmann via buildroot wrote:
> All dependencies are optional, and thus only mentioned in the package help text.
> 
> Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>

  Applied to next, thanks, with two modifications:

      - add to DEVELOPERS;
      - add BSD-3-Clause license for vendored pbPlist.


  Regards,
  Arnout

> ---
> Changes v1 -> v2:
>    - update to 1.25.1
>    - xmltodict and python xml module are now optional dependencies
>    - rename test class to conform to naming scheme
> ---
>   package/Config.in                             |  1 +
>   package/python-jc/Config.in                   | 12 ++++++++++
>   package/python-jc/python-jc.hash              |  5 +++++
>   package/python-jc/python-jc.mk                | 14 ++++++++++++
>   .../testing/tests/package/test_python_jc.py   | 22 +++++++++++++++++++
>   5 files changed, 54 insertions(+)
>   create mode 100644 package/python-jc/Config.in
>   create mode 100644 package/python-jc/python-jc.hash
>   create mode 100644 package/python-jc/python-jc.mk
>   create mode 100644 support/testing/tests/package/test_python_jc.py
> 
> diff --git a/package/Config.in b/package/Config.in
> index 91a6f1de00..7f4d0740ac 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -1151,6 +1151,7 @@ menu "External python modules"
>   	source "package/python-janus/Config.in"
>   	source "package/python-jaraco-classes/Config.in"
>   	source "package/python-jaraco-functools/Config.in"
> +	source "package/python-jc/Config.in"
>   	source "package/python-jedi/Config.in"
>   	source "package/python-jeepney/Config.in"
>   	source "package/python-jinja2/Config.in"
> diff --git a/package/python-jc/Config.in b/package/python-jc/Config.in
> new file mode 100644
> index 0000000000..b88150e069
> --- /dev/null
> +++ b/package/python-jc/Config.in
> @@ -0,0 +1,12 @@
> +config BR2_PACKAGE_PYTHON_JC
> +	bool "python-jc"
> +	help
> +	  Converts the output of popular command-line tools and file-
> +	  types to JSON.
> +
> +	  Optionally requires python-pygments for syntax highlighting,
> +	  python-ruamel-yaml for yaml parsing and output and
> +	  python-xmltodict for xml parsing. PYTHON3_PYEXPAT is required
> +	  for xml and plist parsers.
> +
> +	  https://github.com/kellyjonbrazil/jc
> diff --git a/package/python-jc/python-jc.hash b/package/python-jc/python-jc.hash
> new file mode 100644
> index 0000000000..f54e69eaeb
> --- /dev/null
> +++ b/package/python-jc/python-jc.hash
> @@ -0,0 +1,5 @@
> +# md5, sha256 from https://pypi.org/pypi/jc/json
> +md5  80e4c7d46ec856255577c6b364e7f931  jc-1.25.1.tar.gz
> +sha256  683352e903ece9a86eae0c3232188e40178139e710c740a466ef91ed87c4cc7e  jc-1.25.1.tar.gz
> +# Locally computed sha256 checksums
> +sha256  6493f2db400f4166ca0956cf192a41aa092bd1396ff463e7fdaf51f257c10497  LICENSE.md
> diff --git a/package/python-jc/python-jc.mk b/package/python-jc/python-jc.mk
> new file mode 100644
> index 0000000000..bb5bd426ec
> --- /dev/null
> +++ b/package/python-jc/python-jc.mk
> @@ -0,0 +1,14 @@
> +################################################################################
> +#
> +# python-jc
> +#
> +################################################################################
> +
> +PYTHON_JC_VERSION = 1.25.1
> +PYTHON_JC_SOURCE = jc-$(PYTHON_JC_VERSION).tar.gz
> +PYTHON_JC_SITE = https://files.pythonhosted.org/packages/53/a6/065f0796a0a21bc040bc88c8a33410c12729a2a6f4c269d0349f685796da
> +PYTHON_JC_SETUP_TYPE = setuptools
> +PYTHON_JC_LICENSE = MIT
> +PYTHON_JC_LICENSE_FILES = LICENSE.md
> +
> +$(eval $(python-package))
> diff --git a/support/testing/tests/package/test_python_jc.py b/support/testing/tests/package/test_python_jc.py
> new file mode 100644
> index 0000000000..974ce0c4b0
> --- /dev/null
> +++ b/support/testing/tests/package/test_python_jc.py
> @@ -0,0 +1,22 @@
> +from tests.package.test_python import TestPythonPackageBase
> +
> +
> +class TestPythonPy3Jc(TestPythonPackageBase):
> +    __test__ = True
> +    # We deliberately run the test without the optional dependencies,
> +    # as this configuration is less tested upstream.
> +    config = TestPythonPackageBase.config + \
> +        """
> +        BR2_PACKAGE_PYTHON3=y
> +        BR2_PACKAGE_PYTHON_JC=y
> +        """
> +    timeout = 60
> +
> +    def test_run(self):
> +        self.login()
> +        cmd = "jc -h > /dev/null 2>&1"
> +        self.assertRunOk(cmd, timeout=self.timeout)
> +        cmd = "jc id | grep -q root"
> +        self.assertRunOk(cmd, timeout=self.timeout)
> +        cmd = "jc env | grep -q PATH"
> +        self.assertRunOk(cmd, self.timeout)
diff mbox series

Patch

diff --git a/package/Config.in b/package/Config.in
index 91a6f1de00..7f4d0740ac 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1151,6 +1151,7 @@  menu "External python modules"
 	source "package/python-janus/Config.in"
 	source "package/python-jaraco-classes/Config.in"
 	source "package/python-jaraco-functools/Config.in"
+	source "package/python-jc/Config.in"
 	source "package/python-jedi/Config.in"
 	source "package/python-jeepney/Config.in"
 	source "package/python-jinja2/Config.in"
diff --git a/package/python-jc/Config.in b/package/python-jc/Config.in
new file mode 100644
index 0000000000..b88150e069
--- /dev/null
+++ b/package/python-jc/Config.in
@@ -0,0 +1,12 @@ 
+config BR2_PACKAGE_PYTHON_JC
+	bool "python-jc"
+	help
+	  Converts the output of popular command-line tools and file-
+	  types to JSON.
+
+	  Optionally requires python-pygments for syntax highlighting,
+	  python-ruamel-yaml for yaml parsing and output and
+	  python-xmltodict for xml parsing. PYTHON3_PYEXPAT is required
+	  for xml and plist parsers.
+
+	  https://github.com/kellyjonbrazil/jc
diff --git a/package/python-jc/python-jc.hash b/package/python-jc/python-jc.hash
new file mode 100644
index 0000000000..f54e69eaeb
--- /dev/null
+++ b/package/python-jc/python-jc.hash
@@ -0,0 +1,5 @@ 
+# md5, sha256 from https://pypi.org/pypi/jc/json
+md5  80e4c7d46ec856255577c6b364e7f931  jc-1.25.1.tar.gz
+sha256  683352e903ece9a86eae0c3232188e40178139e710c740a466ef91ed87c4cc7e  jc-1.25.1.tar.gz
+# Locally computed sha256 checksums
+sha256  6493f2db400f4166ca0956cf192a41aa092bd1396ff463e7fdaf51f257c10497  LICENSE.md
diff --git a/package/python-jc/python-jc.mk b/package/python-jc/python-jc.mk
new file mode 100644
index 0000000000..bb5bd426ec
--- /dev/null
+++ b/package/python-jc/python-jc.mk
@@ -0,0 +1,14 @@ 
+################################################################################
+#
+# python-jc
+#
+################################################################################
+
+PYTHON_JC_VERSION = 1.25.1
+PYTHON_JC_SOURCE = jc-$(PYTHON_JC_VERSION).tar.gz
+PYTHON_JC_SITE = https://files.pythonhosted.org/packages/53/a6/065f0796a0a21bc040bc88c8a33410c12729a2a6f4c269d0349f685796da
+PYTHON_JC_SETUP_TYPE = setuptools
+PYTHON_JC_LICENSE = MIT
+PYTHON_JC_LICENSE_FILES = LICENSE.md
+
+$(eval $(python-package))
diff --git a/support/testing/tests/package/test_python_jc.py b/support/testing/tests/package/test_python_jc.py
new file mode 100644
index 0000000000..974ce0c4b0
--- /dev/null
+++ b/support/testing/tests/package/test_python_jc.py
@@ -0,0 +1,22 @@ 
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3Jc(TestPythonPackageBase):
+    __test__ = True
+    # We deliberately run the test without the optional dependencies,
+    # as this configuration is less tested upstream.
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_JC=y
+        """
+    timeout = 60
+
+    def test_run(self):
+        self.login()
+        cmd = "jc -h > /dev/null 2>&1"
+        self.assertRunOk(cmd, timeout=self.timeout)
+        cmd = "jc id | grep -q root"
+        self.assertRunOk(cmd, timeout=self.timeout)
+        cmd = "jc env | grep -q PATH"
+        self.assertRunOk(cmd, self.timeout)