Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] package/python-diskcache: new package
@ 2025-02-26 12:20 Marcus Hoffmann via buildroot
  0 siblings, 0 replies; 7+ messages in thread
From: Marcus Hoffmann via buildroot @ 2025-02-26 12:20 UTC (permalink / raw)
  To: buildroot; +Cc: James Hilliard, Thomas Petazzoni, Marcus Hoffmann

The package imports itself in setup.py to get the package-name and
version number. This doesn't work during the buildroot build, so we
replace this by the hardcoded package-name and the version number stored
in buildroot.

Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
---

    Changes v2: remove accidentally commited .swp file

 DEVELOPERS                                    |  3 +++
 package/Config.in                             |  1 +
 package/python-diskcache/Config.in            |  8 ++++++++
 .../python-diskcache/python-diskcache.hash    |  5 +++++
 package/python-diskcache/python-diskcache.mk  | 20 +++++++++++++++++++
 .../tests/package/sample_python_diskcache.py  |  9 +++++++++
 .../tests/package/test_python_diskcache.py    | 12 +++++++++++
 7 files changed, 58 insertions(+)
 create mode 100644 package/python-diskcache/Config.in
 create mode 100644 package/python-diskcache/python-diskcache.hash
 create mode 100644 package/python-diskcache/python-diskcache.mk
 create mode 100644 support/testing/tests/package/sample_python_diskcache.py
 create mode 100644 support/testing/tests/package/test_python_diskcache.py

diff --git a/DEVELOPERS b/DEVELOPERS
index c07837e431..6676f2cf31 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2257,13 +2257,16 @@ N:	Marcus Hoffmann <bubu@bubu1.eu>
 F:	package/nethogs/
 F:	package/pico-sdk/
 F:	package/picotool/
+F:	package/python-diskcache/
 F:	package/python-immutabledict/
 F:	package/python-jc/
 F:	package/python-ruamel-yaml-clib/
 F:	package/python-waitress/
+F:	support/testing/tests/package/test_python_diskcache.py
 F:	support/testing/tests/package/test_python_fastapi.py
 F:	support/testing/tests/package/test_python_ruamel_yaml.py
 F:	support/testing/tests/package/test_python_waitress.py
+F:	support/testing/tests/package/sample_python_diskcache.py
 F:	support/testing/tests/package/sample_python_fastapi.py
 F:	support/testing/tests/package/sample_python_ruamel_yaml.py
 
diff --git a/package/Config.in b/package/Config.in
index 4a81a62ec4..7e9ba87e30 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1084,6 +1084,7 @@ menu "External python modules"
 	source "package/python-dictdiffer/Config.in"
 	source "package/python-dicttoxml/Config.in"
 	source "package/python-dicttoxml2/Config.in"
+	source "package/python-diskcache/Config.in"
 	source "package/python-distro/Config.in"
 	source "package/python-django/Config.in"
 	source "package/python-django-enumfields/Config.in"
diff --git a/package/python-diskcache/Config.in b/package/python-diskcache/Config.in
new file mode 100644
index 0000000000..4bf6c57406
--- /dev/null
+++ b/package/python-diskcache/Config.in
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_PYTHON_DISKCACHE
+	bool "python-diskcache"
+	select BR2_PACKAGE_PYTHON3_SQLITE # runtime
+	select BR2_PACKAGE_PYTHON3_ZLIB # runtime
+	help
+	  Disk Cache -- Disk and file backed persistent cache.
+
+	  http://www.grantjenks.com/docs/diskcache/
diff --git a/package/python-diskcache/python-diskcache.hash b/package/python-diskcache/python-diskcache.hash
new file mode 100644
index 0000000000..4befb40a4e
--- /dev/null
+++ b/package/python-diskcache/python-diskcache.hash
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/diskcache/json
+md5  d92b4afa944bb70ed38c84a622f7abb5  diskcache-5.6.3.tar.gz
+sha256  2c3a3fa2743d8535d832ec61c2054a1641f41775aa7c556758a109941e33e4fc  diskcache-5.6.3.tar.gz
+# Locally computed sha256 checksums
+sha256  583546baa3fd93607d845126570677a401f508e228b5044fefbc3949af179672  LICENSE
diff --git a/package/python-diskcache/python-diskcache.mk b/package/python-diskcache/python-diskcache.mk
new file mode 100644
index 0000000000..676508857e
--- /dev/null
+++ b/package/python-diskcache/python-diskcache.mk
@@ -0,0 +1,20 @@
+################################################################################
+#
+# python-diskcache
+#
+################################################################################
+
+PYTHON_DISKCACHE_VERSION = 5.6.3
+PYTHON_DISKCACHE_SOURCE = diskcache-$(PYTHON_DISKCACHE_VERSION).tar.gz
+PYTHON_DISKCACHE_SITE = https://files.pythonhosted.org/packages/3f/21/1c1ffc1a039ddcc459db43cc108658f32c57d271d7289a2794e401d0fdb6
+PYTHON_DISKCACHE_SETUP_TYPE = setuptools
+PYTHON_DISKCACHE_LICENSE = Apache-2.0
+PYTHON_DISKCACHE_LICENSE_FILES = LICENSE
+
+define PYTHON_DISKCACHE_REMOVE_SELF_IMPORT
+        sed -i -e '/import diskcache/d' -e 's/diskcache.__title__/"diskcache"/' -e 's/diskcache.__version__/"${PYTHON_DISKCACHE_VERSION}"/' $(@D)/setup.py
+endef
+
+PYTHON_DISKCACHE_POST_PATCH_HOOKS += PYTHON_DISKCACHE_REMOVE_SELF_IMPORT
+
+$(eval $(python-package))
diff --git a/support/testing/tests/package/sample_python_diskcache.py b/support/testing/tests/package/sample_python_diskcache.py
new file mode 100644
index 0000000000..8ba34daf6e
--- /dev/null
+++ b/support/testing/tests/package/sample_python_diskcache.py
@@ -0,0 +1,9 @@
+from diskcache import Cache
+
+cache = Cache()
+
+cache['test'] = 123
+assert cache['test'] == 123
+del cache['test']
+assert 'test' not in cache
+cache.close()
diff --git a/support/testing/tests/package/test_python_diskcache.py b/support/testing/tests/package/test_python_diskcache.py
new file mode 100644
index 0000000000..d8618c1681
--- /dev/null
+++ b/support/testing/tests/package/test_python_diskcache.py
@@ -0,0 +1,12 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3DiskCache(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_DISKCACHE=y
+        """
+    sample_scripts = ["tests/package/sample_python_diskcache.py"]
+    timeout = 10
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2] package/python-diskcache: new package
@ 2025-10-21  9:35 Marcus Hoffmann via buildroot
  2025-10-21  9:40 ` Marcus Hoffmann via buildroot
  2025-10-21 10:16 ` Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 7+ messages in thread
From: Marcus Hoffmann via buildroot @ 2025-10-21  9:35 UTC (permalink / raw)
  To: buildroot; +Cc: James Hilliard, Thomas Petazzoni, Marcus Hoffmann

The package imports itself in setup.py to get the package-name and
version number. This doesn't work during the buildroot build, so we
replace this by the hardcoded package-name and the version number stored
in buildroot.

Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
---
Changes v1 -> v2:
  - Rebase on current master
---
 DEVELOPERS                                    |  3 +++
 package/Config.in                             |  1 +
 package/python-diskcache/Config.in            |  8 ++++++++
 .../python-diskcache/python-diskcache.hash    |  5 +++++
 package/python-diskcache/python-diskcache.mk  | 20 +++++++++++++++++++
 .../tests/package/sample_python_diskcache.py  |  9 +++++++++
 .../tests/package/test_python_diskcache.py    | 12 +++++++++++
 7 files changed, 58 insertions(+)
 create mode 100644 package/python-diskcache/Config.in
 create mode 100644 package/python-diskcache/python-diskcache.hash
 create mode 100644 package/python-diskcache/python-diskcache.mk
 create mode 100644 support/testing/tests/package/sample_python_diskcache.py
 create mode 100644 support/testing/tests/package/test_python_diskcache.py

diff --git a/DEVELOPERS b/DEVELOPERS
index 66199a5b72..15266b4583 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2272,6 +2272,7 @@ F:	package/pico-sdk/
 F:	package/picotool/
 F:	package/python-apscheduler/
 F:	package/python-crc/
+F:	package/python-diskcache/
 F:	package/python-django/
 F:	package/python-immutabledict/
 F:	package/python-jc/
@@ -2287,6 +2288,7 @@ F:	package/python-waitress/
 F:	package/python-whitenoise/
 F:	support/testing/tests/package/test_python_apscheduler.py
 F:	support/testing/tests/package/test_python_crc.py
+F:	support/testing/tests/package/test_python_diskcache.py
 F:	support/testing/tests/package/test_python_django.py
 F:	support/testing/tests/package/test_python_fastapi.py
 F:	support/testing/tests/package/test_python_pydantic.py
@@ -2298,6 +2300,7 @@ F:	support/testing/tests/package/test_python_waitress.py
 F:	support/testing/tests/package/test_python_whitenoise.py
 F:	support/testing/tests/package/sample_python_apscheduler.py
 F:	support/testing/tests/package/sample_python_crc.py
+F:	support/testing/tests/package/sample_python_diskcache.py
 F:	support/testing/tests/package/sample_python_django.py
 F:	support/testing/tests/package/sample_python_fastapi.py
 F:	support/testing/tests/package/sample_python_pydantic.py
diff --git a/package/Config.in b/package/Config.in
index 161d61728b..d8d5007186 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1089,6 +1089,7 @@ menu "External python modules"
 	source "package/python-dictdiffer/Config.in"
 	source "package/python-dicttoxml/Config.in"
 	source "package/python-dicttoxml2/Config.in"
+	source "package/python-diskcache/Config.in"
 	source "package/python-distro/Config.in"
 	source "package/python-django/Config.in"
 	source "package/python-django-enumfields/Config.in"
diff --git a/package/python-diskcache/Config.in b/package/python-diskcache/Config.in
new file mode 100644
index 0000000000..4bf6c57406
--- /dev/null
+++ b/package/python-diskcache/Config.in
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_PYTHON_DISKCACHE
+	bool "python-diskcache"
+	select BR2_PACKAGE_PYTHON3_SQLITE # runtime
+	select BR2_PACKAGE_PYTHON3_ZLIB # runtime
+	help
+	  Disk Cache -- Disk and file backed persistent cache.
+
+	  http://www.grantjenks.com/docs/diskcache/
diff --git a/package/python-diskcache/python-diskcache.hash b/package/python-diskcache/python-diskcache.hash
new file mode 100644
index 0000000000..4befb40a4e
--- /dev/null
+++ b/package/python-diskcache/python-diskcache.hash
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/diskcache/json
+md5  d92b4afa944bb70ed38c84a622f7abb5  diskcache-5.6.3.tar.gz
+sha256  2c3a3fa2743d8535d832ec61c2054a1641f41775aa7c556758a109941e33e4fc  diskcache-5.6.3.tar.gz
+# Locally computed sha256 checksums
+sha256  583546baa3fd93607d845126570677a401f508e228b5044fefbc3949af179672  LICENSE
diff --git a/package/python-diskcache/python-diskcache.mk b/package/python-diskcache/python-diskcache.mk
new file mode 100644
index 0000000000..327d076779
--- /dev/null
+++ b/package/python-diskcache/python-diskcache.mk
@@ -0,0 +1,20 @@
+################################################################################
+#
+# python-diskcache
+#
+################################################################################
+
+PYTHON_DISKCACHE_VERSION = 5.6.3
+PYTHON_DISKCACHE_SOURCE = diskcache-$(PYTHON_DISKCACHE_VERSION).tar.gz
+PYTHON_DISKCACHE_SITE = https://files.pythonhosted.org/packages/3f/21/1c1ffc1a039ddcc459db43cc108658f32c57d271d7289a2794e401d0fdb6
+PYTHON_DISKCACHE_SETUP_TYPE = setuptools
+PYTHON_DISKCACHE_LICENSE = Apache-2.0
+PYTHON_DISKCACHE_LICENSE_FILES = LICENSE
+
+define PYTHON_DISKCACHE_REMOVE_SELF_IMPORT
+	sed -i -e '/import diskcache/d' -e 's/diskcache.__title__/"diskcache"/' -e 's/diskcache.__version__/"$(PYTHON_DISKCACHE_VERSION)"/' $(@D)/setup.py
+endef
+
+PYTHON_DISKCACHE_POST_PATCH_HOOKS += PYTHON_DISKCACHE_REMOVE_SELF_IMPORT
+
+$(eval $(python-package))
diff --git a/support/testing/tests/package/sample_python_diskcache.py b/support/testing/tests/package/sample_python_diskcache.py
new file mode 100644
index 0000000000..8ba34daf6e
--- /dev/null
+++ b/support/testing/tests/package/sample_python_diskcache.py
@@ -0,0 +1,9 @@
+from diskcache import Cache
+
+cache = Cache()
+
+cache['test'] = 123
+assert cache['test'] == 123
+del cache['test']
+assert 'test' not in cache
+cache.close()
diff --git a/support/testing/tests/package/test_python_diskcache.py b/support/testing/tests/package/test_python_diskcache.py
new file mode 100644
index 0000000000..d8618c1681
--- /dev/null
+++ b/support/testing/tests/package/test_python_diskcache.py
@@ -0,0 +1,12 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3DiskCache(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_DISKCACHE=y
+        """
+    sample_scripts = ["tests/package/sample_python_diskcache.py"]
+    timeout = 10
-- 
2.51.1.dirty

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v2] package/python-diskcache: new package
  2025-10-21  9:35 [Buildroot] [PATCH v2] package/python-diskcache: new package Marcus Hoffmann via buildroot
@ 2025-10-21  9:40 ` Marcus Hoffmann via buildroot
  2025-10-21 10:16 ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 7+ messages in thread
From: Marcus Hoffmann via buildroot @ 2025-10-21  9:40 UTC (permalink / raw)
  To: buildroot; +Cc: James Hilliard, Thomas Petazzoni, Marcus Hoffmann

Hi,

On 10/21/25 11:35, Marcus Hoffmann via buildroot wrote:
> The package imports itself in setup.py to get the package-name and
> version number. This doesn't work during the buildroot build, so we
> replace this by the hardcoded package-name and the version number stored
> in buildroot.
> 
> Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
> ---
> Changes v1 -> v2:
>    - Rebase on current master

This is actually v4 already, I just found out, previous changelog:

Changes v2: remove accidentally commited .swp file
Changes v3: fix python-diskcache.mk lint errors

> ---
[...]

Marcus
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v2] package/python-diskcache: new package
  2025-10-21  9:35 [Buildroot] [PATCH v2] package/python-diskcache: new package Marcus Hoffmann via buildroot
  2025-10-21  9:40 ` Marcus Hoffmann via buildroot
@ 2025-10-21 10:16 ` Thomas Petazzoni via buildroot
  2025-10-21 11:31   ` Marcus Hoffmann via buildroot
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-10-21 10:16 UTC (permalink / raw)
  To: Marcus Hoffmann; +Cc: James Hilliard, Marcus Hoffmann, buildroot

Hello Marcus,

On Tue, 21 Oct 2025 11:35:00 +0200
Marcus Hoffmann <buildroot@bubu1.eu> wrote:

> The package imports itself in setup.py to get the package-name and
> version number. This doesn't work during the buildroot build, so we
> replace this by the hardcoded package-name and the version number stored
> in buildroot.
> 
> Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>

Sounds good overall. One question below.


> diff --git a/package/python-diskcache/python-diskcache.mk b/package/python-diskcache/python-diskcache.mk
> new file mode 100644
> index 0000000000..327d076779
> --- /dev/null
> +++ b/package/python-diskcache/python-diskcache.mk
> @@ -0,0 +1,20 @@
> +################################################################################
> +#
> +# python-diskcache
> +#
> +################################################################################
> +
> +PYTHON_DISKCACHE_VERSION = 5.6.3
> +PYTHON_DISKCACHE_SOURCE = diskcache-$(PYTHON_DISKCACHE_VERSION).tar.gz
> +PYTHON_DISKCACHE_SITE = https://files.pythonhosted.org/packages/3f/21/1c1ffc1a039ddcc459db43cc108658f32c57d271d7289a2794e401d0fdb6
> +PYTHON_DISKCACHE_SETUP_TYPE = setuptools
> +PYTHON_DISKCACHE_LICENSE = Apache-2.0

License is OK, checked here.

> +PYTHON_DISKCACHE_LICENSE_FILES = LICENSE
> +
> +define PYTHON_DISKCACHE_REMOVE_SELF_IMPORT
> +	sed -i -e '/import diskcache/d' -e 's/diskcache.__title__/"diskcache"/' -e 's/diskcache.__version__/"$(PYTHON_DISKCACHE_VERSION)"/' $(@D)/setup.py
> +endef

This could use some splitting:

	sed -i -e '/import diskcache/d' \
		-e 's/diskcache.__title__/"diskcache"/' \
		-e 's/diskcache.__version__/"$(PYTHON_DISKCACHE_VERSION)"/' \
		$(@D)/setup.py

but perhaps more importantly, has this been reported upstream? How can
this even work? You need the thing installed... before you install it?

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v2] package/python-diskcache: new package
  2025-10-21 10:16 ` Thomas Petazzoni via buildroot
@ 2025-10-21 11:31   ` Marcus Hoffmann via buildroot
  2025-10-21 11:41     ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 7+ messages in thread
From: Marcus Hoffmann via buildroot @ 2025-10-21 11:31 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: James Hilliard, Marcus Hoffmann, buildroot

Hi Thomas,
thanks for the review!

On 10/21/25 12:16, Thomas Petazzoni wrote:
> Hello Marcus,
> 
> On Tue, 21 Oct 2025 11:35:00 +0200
> Marcus Hoffmann <buildroot@bubu1.eu> wrote:
> 
>> The package imports itself in setup.py to get the package-name and
>> version number. This doesn't work during the buildroot build, so we
>> replace this by the hardcoded package-name and the version number stored
>> in buildroot.
>>
>> Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
> 
> Sounds good overall. One question below.
> 
> 
>> diff --git a/package/python-diskcache/python-diskcache.mk b/package/python-diskcache/python-diskcache.mk
>> new file mode 100644
>> index 0000000000..327d076779
>> --- /dev/null
>> +++ b/package/python-diskcache/python-diskcache.mk
>> @@ -0,0 +1,20 @@
>> +################################################################################
>> +#
>> +# python-diskcache
>> +#
>> +################################################################################
>> +
>> +PYTHON_DISKCACHE_VERSION = 5.6.3
>> +PYTHON_DISKCACHE_SOURCE = diskcache-$(PYTHON_DISKCACHE_VERSION).tar.gz
>> +PYTHON_DISKCACHE_SITE = https://files.pythonhosted.org/packages/3f/21/1c1ffc1a039ddcc459db43cc108658f32c57d271d7289a2794e401d0fdb6
>> +PYTHON_DISKCACHE_SETUP_TYPE = setuptools
>> +PYTHON_DISKCACHE_LICENSE = Apache-2.0
> 
> License is OK, checked here.
> 
>> +PYTHON_DISKCACHE_LICENSE_FILES = LICENSE
>> +
>> +define PYTHON_DISKCACHE_REMOVE_SELF_IMPORT
>> +	sed -i -e '/import diskcache/d' -e 's/diskcache.__title__/"diskcache"/' -e 's/diskcache.__version__/"$(PYTHON_DISKCACHE_VERSION)"/' $(@D)/setup.py
>> +endef
> 
> This could use some splitting:
> 
> 	sed -i -e '/import diskcache/d' \
> 		-e 's/diskcache.__title__/"diskcache"/' \
> 		-e 's/diskcache.__version__/"$(PYTHON_DISKCACHE_VERSION)"/' \
> 		$(@D)/setup.py
> 
> but perhaps more importantly, has this been reported upstream? How can
> this even work? You need the thing installed... before you install it?

This was, unfortunately, a very common pattern in setup.py builds but 
it's going away with projects switching to declarative build definitions 
via pyproject.toml. (Which diskcache hasn't done yet, but I assume will 
do eventually, maintenance is a bit slow currently). setup.py is just a 
python script and python allows importing modules from $CWD, even if 
they are not installed. That's how that works in general.

Now I was confused why past me claimed that the same doesn't work inside 
the buildroot build and the reason for that is that host-python3 doesn't 
build with sqlite support, so the diskcache import (at build-time) fails.

Perhaps a less hacky, but also more wasteful, approach to solving this 
is enforcing host-python sqlite support is built when diskcache is 
selected. I just tested that and it works, unsure what approach to chose 
now. WDYT?


> 
> Thomas

Marcus
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v2] package/python-diskcache: new package
  2025-10-21 11:31   ` Marcus Hoffmann via buildroot
@ 2025-10-21 11:41     ` Thomas Petazzoni via buildroot
  2025-10-21 12:07       ` Marcus Hoffmann via buildroot
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-10-21 11:41 UTC (permalink / raw)
  To: Marcus Hoffmann; +Cc: James Hilliard, Marcus Hoffmann, buildroot

On Tue, 21 Oct 2025 13:31:14 +0200
Marcus Hoffmann <buildroot@bubu1.eu> wrote:

> This was, unfortunately, a very common pattern in setup.py builds but 
> it's going away with projects switching to declarative build definitions 
> via pyproject.toml. (Which diskcache hasn't done yet, but I assume will 
> do eventually, maintenance is a bit slow currently). setup.py is just a 
> python script and python allows importing modules from $CWD, even if 
> they are not installed. That's how that works in general.
> 
> Now I was confused why past me claimed that the same doesn't work inside 
> the buildroot build and the reason for that is that host-python3 doesn't 
> build with sqlite support, so the diskcache import (at build-time) fails.
> 
> Perhaps a less hacky, but also more wasteful, approach to solving this 
> is enforcing host-python sqlite support is built when diskcache is 
> selected. I just tested that and it works, unsure what approach to chose 
> now. WDYT?

Sounds "meh" to me, because important diskcache during the build is
actually... useless, it's just used to retrieve the version number,
which certainly could be done another way. Having to build host-sqlite,
and sqlite support in host-python just for the sake of doing this seems
really wasteful, and is generally not a approach that would work well:
imagine something more complex than diskcache, that has more
dependencies. It means we would have not only to package these
dependencies for the target, but also for the host, just for the sake
of being able to retrieve <foo>.version? Seems not very efficient to me.

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v2] package/python-diskcache: new package
  2025-10-21 11:41     ` Thomas Petazzoni via buildroot
@ 2025-10-21 12:07       ` Marcus Hoffmann via buildroot
  0 siblings, 0 replies; 7+ messages in thread
From: Marcus Hoffmann via buildroot @ 2025-10-21 12:07 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: James Hilliard, Marcus Hoffmann, buildroot



On 10/21/25 13:41, Thomas Petazzoni wrote:
> On Tue, 21 Oct 2025 13:31:14 +0200
> Marcus Hoffmann <buildroot@bubu1.eu> wrote:
> 
>> This was, unfortunately, a very common pattern in setup.py builds but
>> it's going away with projects switching to declarative build definitions
>> via pyproject.toml. (Which diskcache hasn't done yet, but I assume will
>> do eventually, maintenance is a bit slow currently). setup.py is just a
>> python script and python allows importing modules from $CWD, even if
>> they are not installed. That's how that works in general.
>>
>> Now I was confused why past me claimed that the same doesn't work inside
>> the buildroot build and the reason for that is that host-python3 doesn't
>> build with sqlite support, so the diskcache import (at build-time) fails.
>>
>> Perhaps a less hacky, but also more wasteful, approach to solving this
>> is enforcing host-python sqlite support is built when diskcache is
>> selected. I just tested that and it works, unsure what approach to chose
>> now. WDYT?
> 
> Sounds "meh" to me, because important diskcache during the build is
> actually... useless, it's just used to retrieve the version number,
> which certainly could be done another way. Having to build host-sqlite,
> and sqlite support in host-python just for the sake of doing this seems
> really wasteful, and is generally not a approach that would work well:
> imagine something more complex than diskcache, that has more
> dependencies. It means we would have not only to package these
> dependencies for the target, but also for the host, just for the sake
> of being able to retrieve <foo>.version? Seems not very efficient to me.

Alright, I sent a new version that keeps the current approach and just 
explains why we do that in a bit more detail.
Like I said, I expect the package to switch to not using setup.py 
eventually as well, which makes this problem go away then.

> 
> Thomas

Marcus
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2025-10-21 12:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-21  9:35 [Buildroot] [PATCH v2] package/python-diskcache: new package Marcus Hoffmann via buildroot
2025-10-21  9:40 ` Marcus Hoffmann via buildroot
2025-10-21 10:16 ` Thomas Petazzoni via buildroot
2025-10-21 11:31   ` Marcus Hoffmann via buildroot
2025-10-21 11:41     ` Thomas Petazzoni via buildroot
2025-10-21 12:07       ` Marcus Hoffmann via buildroot
  -- strict thread matches above, loose matches on Subject: below --
2025-02-26 12:20 Marcus Hoffmann via buildroot

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