Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/3] package/crudini: make it Python3 compatible
@ 2020-02-05 14:11 Titouan Christophe
  2020-02-05 14:11 ` [Buildroot] [PATCH 1/3] package/python-iniparse: bump to version 0.5 Titouan Christophe
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Titouan Christophe @ 2020-02-05 14:11 UTC (permalink / raw)
  To: buildroot

This small series bumps the version of crudini and its dependency iniparse,
such as it can now run on Python3 based systems.

It also adds a runtime test that performs a basic use-case run of the
crudini tool, for both Python2 and Python3.

Titouan Christophe (3):
  package/python-iniparse: bump to version 0.5
  package/crudini: bump to version 0.9.3
  support/testing: add runtime test for Crudini (py2 and py3)

 .gitlab-ci.yml                                |  2 +
 package/crudini/Config.in                     |  2 +-
 package/crudini/crudini.hash                  |  5 +--
 package/crudini/crudini.mk                    |  4 +-
 package/python-iniparse/Config.in             |  3 +-
 package/python-iniparse/python-iniparse.hash  |  6 +--
 package/python-iniparse/python-iniparse.mk    |  4 +-
 support/testing/tests/package/test_crudini.py | 40 +++++++++++++++++++
 8 files changed, 53 insertions(+), 13 deletions(-)
 create mode 100644 support/testing/tests/package/test_crudini.py

-- 
2.24.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/3] package/python-iniparse: bump to version 0.5
  2020-02-05 14:11 [Buildroot] [PATCH 0/3] package/crudini: make it Python3 compatible Titouan Christophe
@ 2020-02-05 14:11 ` Titouan Christophe
  2020-02-05 15:42   ` Thomas Petazzoni
  2020-02-05 14:11 ` [Buildroot] [PATCH 2/3] package/crudini: bump to version 0.9.3 Titouan Christophe
  2020-02-05 14:11 ` [Buildroot] [PATCH 3/3] support/testing: add runtime test for Crudini (py2 and py3) Titouan Christophe
  2 siblings, 1 reply; 7+ messages in thread
From: Titouan Christophe @ 2020-02-05 14:11 UTC (permalink / raw)
  To: buildroot

Also, iniparse now requires six.
This has been detected thanks to the runtime tests.

Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>
---
 package/python-iniparse/Config.in            | 3 ++-
 package/python-iniparse/python-iniparse.hash | 6 +++---
 package/python-iniparse/python-iniparse.mk   | 4 ++--
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/package/python-iniparse/Config.in b/package/python-iniparse/Config.in
index 65c1064927..8a9c5954c8 100644
--- a/package/python-iniparse/Config.in
+++ b/package/python-iniparse/Config.in
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_PYTHON_INIPARSE
 	bool "python-iniparse"
-	depends on BR2_PACKAGE_PYTHON
+	depends on BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON3
+	select BR2_PACKAGE_PYTHON_SIX # runtime
 	help
 	  iniparse is an INI parser for Python which is API compatible
 	  with the standard library's ConfigParser, preserves
diff --git a/package/python-iniparse/python-iniparse.hash b/package/python-iniparse/python-iniparse.hash
index b843025521..238d41e06d 100644
--- a/package/python-iniparse/python-iniparse.hash
+++ b/package/python-iniparse/python-iniparse.hash
@@ -1,7 +1,7 @@
-# md5 from https://pypi.python.org/pypi?:action=show_md5&digest=5e573e9e9733d97623881ce9bbe5eca6
-md5 5e573e9e9733d97623881ce9bbe5eca6 iniparse-0.4.tar.gz
+# From https://pypi.org/project/iniparse/#copy-hash-modal-5fdd923b-0592-4d2d-8b49-03472f948290
+md5 2054bab923df21107652d009f2373789 iniparse-0.5.tar.gz
+sha256  932e5239d526e7acb504017bb707be67019ac428a6932368e6851691093aa842  iniparse-0.5.tar.gz
 
 # sha256 locally computed
-sha256  abc1ee12d2cfb2506109072d6c21e40b6c75a3fe90a9c924327d80bc0d99c054  iniparse-0.4.tar.gz
 sha256  ff45637d8a96adc414179e502fbed40160e57205bf2e302140e79a0c71eceaa7  LICENSE
 sha256  9b02e3dfe433ccd2bd94636ef6eb08638b5a54deafe5f87a3d9d9104356c48e0  LICENSE-PSF
diff --git a/package/python-iniparse/python-iniparse.mk b/package/python-iniparse/python-iniparse.mk
index 5c4e03c88c..d31a490bd8 100644
--- a/package/python-iniparse/python-iniparse.mk
+++ b/package/python-iniparse/python-iniparse.mk
@@ -4,11 +4,11 @@
 #
 ################################################################################
 
-PYTHON_INIPARSE_VERSION = 0.4
+PYTHON_INIPARSE_VERSION = 0.5
 PYTHON_INIPARSE_SOURCE = iniparse-$(PYTHON_INIPARSE_VERSION).tar.gz
 PYTHON_INIPARSE_SITE = https://pypi.python.org/packages/source/i/iniparse
 PYTHON_INIPARSE_LICENSE = Python-2.0, MIT
 PYTHON_INIPARSE_LICENSE_FILES = LICENSE-PSF LICENSE
-PYTHON_INIPARSE_SETUP_TYPE = distutils
+PYTHON_INIPARSE_SETUP_TYPE = setuptools
 
 $(eval $(python-package))
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/3] package/crudini: bump to version 0.9.3
  2020-02-05 14:11 [Buildroot] [PATCH 0/3] package/crudini: make it Python3 compatible Titouan Christophe
  2020-02-05 14:11 ` [Buildroot] [PATCH 1/3] package/python-iniparse: bump to version 0.5 Titouan Christophe
@ 2020-02-05 14:11 ` Titouan Christophe
  2020-02-05 15:43   ` Thomas Petazzoni
  2020-02-05 14:11 ` [Buildroot] [PATCH 3/3] support/testing: add runtime test for Crudini (py2 and py3) Titouan Christophe
  2 siblings, 1 reply; 7+ messages in thread
From: Titouan Christophe @ 2020-02-05 14:11 UTC (permalink / raw)
  To: buildroot

This release hasn't been published to pypi, so we switch
to the Github release archive instead.

Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>
---
 package/crudini/Config.in    | 2 +-
 package/crudini/crudini.hash | 5 +----
 package/crudini/crudini.mk   | 4 ++--
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/package/crudini/Config.in b/package/crudini/Config.in
index e4e26e52da..240848dffc 100644
--- a/package/crudini/Config.in
+++ b/package/crudini/Config.in
@@ -1,6 +1,6 @@
 config BR2_PACKAGE_CRUDINI
 	bool "crudini"
-	depends on BR2_PACKAGE_PYTHON
+	depends on BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON3
 	select BR2_PACKAGE_PYTHON_INIPARSE # runtime
 	help
 	  A utility for handling ini files from the command line and
diff --git a/package/crudini/crudini.hash b/package/crudini/crudini.hash
index 6c08223b83..6f2563dfdd 100644
--- a/package/crudini/crudini.hash
+++ b/package/crudini/crudini.hash
@@ -1,6 +1,3 @@
-# md5 from https://pypi.python.org/pypi?:action=show_md5&digest=9b8500c90467f0a61c714fbe852c2a66
-md5    9b8500c90467f0a61c714fbe852c2a66 crudini-0.9.tar.gz
-
 # locally computed
-sha256  10512a5a2f7b54b42e48a1d00f0c6398947c2ba6c264b9fdef86677f0e949fd3  crudini-0.9.tar.gz
+sha256  e1b8125ac4373ece3bb0bb047ba9336e5bd55ed5d56b9729968058c9385ab546  crudini-0.9.3.tar.gz
 sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
diff --git a/package/crudini/crudini.mk b/package/crudini/crudini.mk
index c03f55c374..7141e2b2a0 100644
--- a/package/crudini/crudini.mk
+++ b/package/crudini/crudini.mk
@@ -4,8 +4,8 @@
 #
 ################################################################################
 
-CRUDINI_VERSION = 0.9
-CRUDINI_SITE = https://pypi.python.org/packages/b5/65/5588903472f30fa01ca4951be00c03a317b27bac4cd1e945bd16b2c1b6d3
+CRUDINI_VERSION = 0.9.3
+CRUDINI_SITE = $(call github,pixelb,crudini,$(CRUDINI_VERSION))
 CRUDINI_SETUP_TYPE = setuptools
 CRUDINI_LICENSE = GPL-2.0
 CRUDINI_LICENSE_FILES = COPYING
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 3/3] support/testing: add runtime test for Crudini (py2 and py3)
  2020-02-05 14:11 [Buildroot] [PATCH 0/3] package/crudini: make it Python3 compatible Titouan Christophe
  2020-02-05 14:11 ` [Buildroot] [PATCH 1/3] package/python-iniparse: bump to version 0.5 Titouan Christophe
  2020-02-05 14:11 ` [Buildroot] [PATCH 2/3] package/crudini: bump to version 0.9.3 Titouan Christophe
@ 2020-02-05 14:11 ` Titouan Christophe
  2020-02-05 15:44   ` Thomas Petazzoni
  2 siblings, 1 reply; 7+ messages in thread
From: Titouan Christophe @ 2020-02-05 14:11 UTC (permalink / raw)
  To: buildroot

This also adds the new tests to the gitlab CI configuration.

Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>
---
 .gitlab-ci.yml                                |  2 +
 support/testing/tests/package/test_crudini.py | 40 +++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 support/testing/tests/package/test_crudini.py

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c0140527db..aa64bb5fee 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -375,6 +375,8 @@ tests.init.test_systemd.TestInitSystemSystemdRwFull: { extends: .runtime_test }
 tests.init.test_systemd.TestInitSystemSystemdRwIfupdown: { extends: .runtime_test }
 tests.init.test_systemd.TestInitSystemSystemdRwNetworkd: { extends: .runtime_test }
 tests.package.test_atop.TestAtop: { extends: .runtime_test }
+tests.package.test_crudini.TestCrudiniPy2: {extends: .runtime_test}
+tests.package.test_crudini.TestCrudiniPy3: {extends: .runtime_test}
 tests.package.test_docker_compose.TestDockerCompose: { extends: .runtime_test }
 tests.package.test_dropbear.TestDropbear: { extends: .runtime_test }
 tests.package.test_glxinfo.TestGlxinfo: { extends: .runtime_test }
diff --git a/support/testing/tests/package/test_crudini.py b/support/testing/tests/package/test_crudini.py
new file mode 100644
index 0000000000..498c5982cc
--- /dev/null
+++ b/support/testing/tests/package/test_crudini.py
@@ -0,0 +1,40 @@
+import os
+from tests.package.test_python import TestPythonPackageBase
+
+
+INI_FILE_CONTENT = """
+[section]
+param = this-is-the-magic-value
+other = dont care
+"""
+
+
+class TestCrudiniBase(TestPythonPackageBase):
+    config = TestPythonPackageBase.config + "\nBR2_PACKAGE_CRUDINI=y"
+
+    def test_run(self):
+        img = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv5", kernel="builtin",
+                           options=["-initrd", img])
+
+        self.emulator.login()
+
+        # 1. Create some sample .ini file
+        cmd = "echo -e '%s' > config.ini" % INI_FILE_CONTENT
+        _, ret = self.emulator.run(cmd)
+        self.assertEqual(ret, 0)
+
+        # 2. Attempt to get the value
+        out, ret = self.emulator.run("crudini --get config.ini section param")
+        self.assertEqual(ret, 0)
+        self.assertEqual(out, ['this-is-the-magic-value'])
+
+
+class TestCrudiniPy2(TestCrudiniBase):
+    __test__ = True
+    config = TestCrudiniBase.config + "\nBR2_PACKAGE_PYTHON=y"
+
+
+class TestCrudiniPy3(TestCrudiniBase):
+    __test__ = True
+    config = TestCrudiniBase.config + "\nBR2_PACKAGE_PYTHON3=y"
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/3] package/python-iniparse: bump to version 0.5
  2020-02-05 14:11 ` [Buildroot] [PATCH 1/3] package/python-iniparse: bump to version 0.5 Titouan Christophe
@ 2020-02-05 15:42   ` Thomas Petazzoni
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2020-02-05 15:42 UTC (permalink / raw)
  To: buildroot

On Wed,  5 Feb 2020 15:11:47 +0100
Titouan Christophe <titouan.christophe@railnova.eu> wrote:

> Also, iniparse now requires six.
> This has been detected thanks to the runtime tests.

It would have been good to mention in the commit log that it now supports Python 3.

>  config BR2_PACKAGE_PYTHON_INIPARSE
>  	bool "python-iniparse"
> -	depends on BR2_PACKAGE_PYTHON
> +	depends on BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON3

This is not needed when both are supported, since Python modules
Config.in files are only included when python || python3, from
package/Config.in.

Applied with the above issues fixed. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/3] package/crudini: bump to version 0.9.3
  2020-02-05 14:11 ` [Buildroot] [PATCH 2/3] package/crudini: bump to version 0.9.3 Titouan Christophe
@ 2020-02-05 15:43   ` Thomas Petazzoni
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2020-02-05 15:43 UTC (permalink / raw)
  To: buildroot

On Wed,  5 Feb 2020 15:11:48 +0100
Titouan Christophe <titouan.christophe@railnova.eu> wrote:

> This release hasn't been published to pypi, so we switch
> to the Github release archive instead.
> 
> Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>

I've amended the commit log to mention that it now supports Python 3.x
and applied.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 3/3] support/testing: add runtime test for Crudini (py2 and py3)
  2020-02-05 14:11 ` [Buildroot] [PATCH 3/3] support/testing: add runtime test for Crudini (py2 and py3) Titouan Christophe
@ 2020-02-05 15:44   ` Thomas Petazzoni
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2020-02-05 15:44 UTC (permalink / raw)
  To: buildroot

On Wed,  5 Feb 2020 15:11:49 +0100
Titouan Christophe <titouan.christophe@railnova.eu> wrote:

> This also adds the new tests to the gitlab CI configuration.
> 
> Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>
> ---
>  .gitlab-ci.yml                                |  2 +
>  support/testing/tests/package/test_crudini.py | 40 +++++++++++++++++++
>  2 files changed, 42 insertions(+)
>  create mode 100644 support/testing/tests/package/test_crudini.py

We like to have an entry in the DEVELOPERS file for tests so that you
receive an e-mail notification when the test fails in our CI.

> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index c0140527db..aa64bb5fee 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -375,6 +375,8 @@ tests.init.test_systemd.TestInitSystemSystemdRwFull: { extends: .runtime_test }
>  tests.init.test_systemd.TestInitSystemSystemdRwIfupdown: { extends: .runtime_test }
>  tests.init.test_systemd.TestInitSystemSystemdRwNetworkd: { extends: .runtime_test }
>  tests.package.test_atop.TestAtop: { extends: .runtime_test }
> +tests.package.test_crudini.TestCrudiniPy2: {extends: .runtime_test}
> +tests.package.test_crudini.TestCrudiniPy3: {extends: .runtime_test}

You wrote this by hand, but it is auto-generated by "make
.gitlab-ci.yml", with a slightly different formatting.

> +class TestCrudiniBase(TestPythonPackageBase):
> +    config = TestPythonPackageBase.config + "\nBR2_PACKAGE_CRUDINI=y"

We like to use multiline strings to add config options.

I've fixed the above issues and applied to master.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-02-05 15:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-05 14:11 [Buildroot] [PATCH 0/3] package/crudini: make it Python3 compatible Titouan Christophe
2020-02-05 14:11 ` [Buildroot] [PATCH 1/3] package/python-iniparse: bump to version 0.5 Titouan Christophe
2020-02-05 15:42   ` Thomas Petazzoni
2020-02-05 14:11 ` [Buildroot] [PATCH 2/3] package/crudini: bump to version 0.9.3 Titouan Christophe
2020-02-05 15:43   ` Thomas Petazzoni
2020-02-05 14:11 ` [Buildroot] [PATCH 3/3] support/testing: add runtime test for Crudini (py2 and py3) Titouan Christophe
2020-02-05 15:44   ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox