diff mbox series

[meta-python] python3-python-dotenv: new recipe (1.2.1)

Message ID 20251110172650.358256-1-jan.vermaete@gmail.com
State New
Headers show
Series [meta-python] python3-python-dotenv: new recipe (1.2.1) | expand

Commit Message

Jan Vermaete Nov. 10, 2025, 5:26 p.m. UTC
Moving the recipe from meta-homeassistant to meta-opemembedded.

+ version bump 1.1.1 -> 1.2.1
+ add ptest
  - exclude 2 tests (oe-specific)
  - added to PTESTS_FAST_META_PYTHON

Signed-off-by: Jan Vermaete <jan.vermaete@gmail.com>
---
 .../ptest-packagelists-meta-python.inc        |  1 +
 ...y-skip-two-test-when-running-as-root.patch | 39 +++++++++++++++++++
 .../python/python3-python-dotenv_1.2.1.bb     | 22 +++++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-python-dotenv/0001-test_main.py-skip-two-test-when-running-as-root.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-python-dotenv_1.2.1.bb

Comments

Gyorgy Sarvari Nov. 10, 2025, 5:31 p.m. UTC | #1
On 11/10/25 18:26, Jan Vermaete via lists.openembedded.org wrote:
> Moving the recipe from meta-homeassistant to meta-opemembedded.
>
> + version bump 1.1.1 -> 1.2.1
> + add ptest
>   - exclude 2 tests (oe-specific)
>   - added to PTESTS_FAST_META_PYTHON
>
> Signed-off-by: Jan Vermaete <jan.vermaete@gmail.com>
> ---
>  .../ptest-packagelists-meta-python.inc        |  1 +
>  ...y-skip-two-test-when-running-as-root.patch | 39 +++++++++++++++++++
>  .../python/python3-python-dotenv_1.2.1.bb     | 22 +++++++++++
>  3 files changed, 62 insertions(+)
>  create mode 100644 meta-python/recipes-devtools/python/python3-python-dotenv/0001-test_main.py-skip-two-test-when-running-as-root.patch
>  create mode 100644 meta-python/recipes-devtools/python/python3-python-dotenv_1.2.1.bb
>
> diff --git a/meta-python/conf/include/ptest-packagelists-meta-python.inc b/meta-python/conf/include/ptest-packagelists-meta-python.inc
> index f0411f269f..43518ea2c8 100644
> --- a/meta-python/conf/include/ptest-packagelists-meta-python.inc
> +++ b/meta-python/conf/include/ptest-packagelists-meta-python.inc
> @@ -65,6 +65,7 @@ PTESTS_FAST_META_PYTHON = "\
>      python3-pydantic \
>      python3-pydantic-core \
>      python3-pylint \
> +    python3-python-dotenv \
>      python3-python-multipart \
>      python3-ptyprocess \
>      python3-py-cpuinfo \
> diff --git a/meta-python/recipes-devtools/python/python3-python-dotenv/0001-test_main.py-skip-two-test-when-running-as-root.patch b/meta-python/recipes-devtools/python/python3-python-dotenv/0001-test_main.py-skip-two-test-when-running-as-root.patch
> new file mode 100644
> index 0000000000..154ab559a4
> --- /dev/null
> +++ b/meta-python/recipes-devtools/python/python3-python-dotenv/0001-test_main.py-skip-two-test-when-running-as-root.patch
> @@ -0,0 +1,39 @@
> +From 68e4f05ece6b20e8a7d914d047185483373db759 Mon Sep 17 00:00:00 2001
> +From: Jan Vermaete <jan.vermaete@gmail.com>
> +Date: Mon, 10 Nov 2025 18:04:27 +0100
> +Subject: [PATCH 1/1] test_main.py: skip two test when running as root
> +
> +Upstream-Status: Inappropriate [oe-specific]
> +
> +The patch will only work for Linux and not for Windows.
> +And it's not common to run the tests of a Python module as root in the
> +not Yocto world.
> +
> +Signed-off-by: Jan Vermaete <jan.vermaete@gmail.com>
> +---
> + tests/test_main.py | 2 ++
> + 1 file changed, 2 insertions(+)
> +
> +diff --git a/tests/test_main.py b/tests/test_main.py
> +index 4496111..182bc33 100644
> +--- a/tests/test_main.py
> ++++ b/tests/test_main.py
> +@@ -61,6 +61,7 @@ def test_set_key_encoding(dotenv_path):
> +     assert dotenv_path.read_text(encoding=encoding) == "a='é'\n"
> + 
> + 
> ++@pytest.mark.skipif(os.geteuid() == 0, reason="Skipping becuase user is root")
> + def test_set_key_permission_error(dotenv_path):
> +     dotenv_path.chmod(0o000)
> + 
> +@@ -167,6 +168,7 @@ def test_unset_encoding(dotenv_path):
> +     assert dotenv_path.read_text(encoding=encoding) == ""
> + 
> + 
> ++@pytest.mark.skipif(os.geteuid() == 0, reason="Skipping becuase user is root")
> + def test_set_key_unauthorized_file(dotenv_path):
> +     dotenv_path.chmod(0o000)
> + 
> +-- 
> +2.47.3
> +
> diff --git a/meta-python/recipes-devtools/python/python3-python-dotenv_1.2.1.bb b/meta-python/recipes-devtools/python/python3-python-dotenv_1.2.1.bb
> new file mode 100644
> index 0000000000..73af9c7906
> --- /dev/null
> +++ b/meta-python/recipes-devtools/python/python3-python-dotenv_1.2.1.bb
> @@ -0,0 +1,22 @@
> +SUMMARY = "Read key-value pairs from a .env file and set them as environment variables"
> +HOMEPAGE = "https://github.com/theskumar/python-dotenv"
> +LICENSE = "BSD-3-Clause"
> +LIC_FILES_CHKSUM = "file://LICENSE;md5=e914cdb773ae44a732b392532d88f072"
> +RECIPE_MAINTAINER = "Tom Geelen <t.f.g.geelen@gmail.com>"
> +
> +SRC_URI[sha256sum] = "42667e897e16ab0d66954af0e60a9caa94f0fd4ecf3aaf6d2d260eec1aa36ad6"
> +
> +SRC_URI += "file://0001-test_main.py-skip-two-test-when-running-as-root.patch"
> +
> +inherit pypi python_setuptools_build_meta ptest-python-pytest
> +
> +# Uncomment this line to enable all the optional features.
> +#PACKAGECONFIG ?= "cli"
> +PACKAGECONFIG[cli] = ",,,python3-click"
> +
> +PYPI_PACKAGE = "python_dotenv"
> +UPSTREAM_CHECK_PYPI_PACKAGE = "${PYPI_PACKAGE}"
> +
> +RDEPENDS:${PN}-ptest = "\

This should be "+=" - otherwise it won't install the main package when
you build a ptest image

> +    python3-sh \
> +"
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#121467): https://lists.openembedded.org/g/openembedded-devel/message/121467
> Mute This Topic: https://lists.openembedded.org/mt/116223370/6084445
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [skandigraun@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta-python/conf/include/ptest-packagelists-meta-python.inc b/meta-python/conf/include/ptest-packagelists-meta-python.inc
index f0411f269f..43518ea2c8 100644
--- a/meta-python/conf/include/ptest-packagelists-meta-python.inc
+++ b/meta-python/conf/include/ptest-packagelists-meta-python.inc
@@ -65,6 +65,7 @@  PTESTS_FAST_META_PYTHON = "\
     python3-pydantic \
     python3-pydantic-core \
     python3-pylint \
+    python3-python-dotenv \
     python3-python-multipart \
     python3-ptyprocess \
     python3-py-cpuinfo \
diff --git a/meta-python/recipes-devtools/python/python3-python-dotenv/0001-test_main.py-skip-two-test-when-running-as-root.patch b/meta-python/recipes-devtools/python/python3-python-dotenv/0001-test_main.py-skip-two-test-when-running-as-root.patch
new file mode 100644
index 0000000000..154ab559a4
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-python-dotenv/0001-test_main.py-skip-two-test-when-running-as-root.patch
@@ -0,0 +1,39 @@ 
+From 68e4f05ece6b20e8a7d914d047185483373db759 Mon Sep 17 00:00:00 2001
+From: Jan Vermaete <jan.vermaete@gmail.com>
+Date: Mon, 10 Nov 2025 18:04:27 +0100
+Subject: [PATCH 1/1] test_main.py: skip two test when running as root
+
+Upstream-Status: Inappropriate [oe-specific]
+
+The patch will only work for Linux and not for Windows.
+And it's not common to run the tests of a Python module as root in the
+not Yocto world.
+
+Signed-off-by: Jan Vermaete <jan.vermaete@gmail.com>
+---
+ tests/test_main.py | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/tests/test_main.py b/tests/test_main.py
+index 4496111..182bc33 100644
+--- a/tests/test_main.py
++++ b/tests/test_main.py
+@@ -61,6 +61,7 @@ def test_set_key_encoding(dotenv_path):
+     assert dotenv_path.read_text(encoding=encoding) == "a='é'\n"
+ 
+ 
++@pytest.mark.skipif(os.geteuid() == 0, reason="Skipping becuase user is root")
+ def test_set_key_permission_error(dotenv_path):
+     dotenv_path.chmod(0o000)
+ 
+@@ -167,6 +168,7 @@ def test_unset_encoding(dotenv_path):
+     assert dotenv_path.read_text(encoding=encoding) == ""
+ 
+ 
++@pytest.mark.skipif(os.geteuid() == 0, reason="Skipping becuase user is root")
+ def test_set_key_unauthorized_file(dotenv_path):
+     dotenv_path.chmod(0o000)
+ 
+-- 
+2.47.3
+
diff --git a/meta-python/recipes-devtools/python/python3-python-dotenv_1.2.1.bb b/meta-python/recipes-devtools/python/python3-python-dotenv_1.2.1.bb
new file mode 100644
index 0000000000..73af9c7906
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-python-dotenv_1.2.1.bb
@@ -0,0 +1,22 @@ 
+SUMMARY = "Read key-value pairs from a .env file and set them as environment variables"
+HOMEPAGE = "https://github.com/theskumar/python-dotenv"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=e914cdb773ae44a732b392532d88f072"
+RECIPE_MAINTAINER = "Tom Geelen <t.f.g.geelen@gmail.com>"
+
+SRC_URI[sha256sum] = "42667e897e16ab0d66954af0e60a9caa94f0fd4ecf3aaf6d2d260eec1aa36ad6"
+
+SRC_URI += "file://0001-test_main.py-skip-two-test-when-running-as-root.patch"
+
+inherit pypi python_setuptools_build_meta ptest-python-pytest
+
+# Uncomment this line to enable all the optional features.
+#PACKAGECONFIG ?= "cli"
+PACKAGECONFIG[cli] = ",,,python3-click"
+
+PYPI_PACKAGE = "python_dotenv"
+UPSTREAM_CHECK_PYPI_PACKAGE = "${PYPI_PACKAGE}"
+
+RDEPENDS:${PN}-ptest = "\
+    python3-sh \
+"