Skip to contentSkip to conversation

package/python-numpy: simplify PYTHON_NUMPY_FIXUP_NPY_PKG_CONFIG_FILES

PATCH Applied Thomas Petazzoni 2 participants 2 messages Jan 7, 2022 – Jan 8, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/python-numpy: simplify PYTHON_NUMPY_FIXUP_NPY_PKG_CONFIG_FILES

The PYTHON_NUMPY_FIXUP_NPY_PKG_CONFIG_FILES macro was introduced in commit
2426002d6fc81d0b023e3f3b3ee4e94ab29438cb ("package/python-numpy: fixup npymath.ini for numpy extensions").

However, it turns out that by using $(PYTHON3_PATH), we can simplify the intermediate variables, to the point where they are no longer needed. Not having the intermediate variables makes the logic a bit easier to understand.

Also, the logic is changed to use a single sed expression, which we pass to $(SED).

---
 package/python-numpy/python-numpy.mk | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
package/python-numpy/python-numpy.mk +2 -5
index f367b556ef..9e8b032b78 100644
@@ -40,12 +40,9 @@ endef
 # it uses host libraries (like libnpymath.a).
 # So, the numpy distutils extension packages would explicitly link this
 # config path for their package environment.
-PYTHON_NUMPY_STAGING_DIR = $(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/numpy
-PYTHON_NUMPY_NPY_PKG_CONFIG_PATH=$(PYTHON_NUMPY_STAGING_DIR)/core/lib/npy-pkg-config
 define PYTHON_NUMPY_FIXUP_NPY_PKG_CONFIG_FILES
-	sed -e '/^pkgdir=/d' \
-	    -e '/^prefix=/i pkgdir=$(PYTHON_NUMPY_STAGING_DIR)/core' \
-	    -i $(PYTHON_NUMPY_NPY_PKG_CONFIG_PATH)/npymath.ini
+	$(SED) '/^pkgdir=/d;/^prefix=/i pkgdir=$(PYTHON3_PATH)/site-packages/numpy/core' \
+		$(PYTHON3_PATH)/site-packages/numpy/core/lib/npy-pkg-config/npymath.ini
 endef
 PYTHON_NUMPY_POST_INSTALL_STAGING_HOOKS += PYTHON_NUMPY_FIXUP_NPY_PKG_CONFIG_FILES
 
Signature · 6 lines
2.33.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 10 lines · Thomas Petazzoni

The PYTHON_NUMPY_FIXUP_NPY_PKG_CONFIG_FILES macro was introduced in commit
2426002d6fc81d0b023e3f3b3ee4e94ab29438cb ("package/python-numpy: fixup npymath.ini for numpy extensions").

However, it turns out that by using $(PYTHON3_PATH), we can simplify the intermediate variables, to the point where they are no longer needed. Not having the intermediate variables makes the logic a bit easier to understand.

Quoted 4 lines

Also, the logic is changed to use a single sed expression, which we pass to $(SED).

Applied to master, thanks.

Regards,
Arnout

Quoted 14 lines
---
  package/python-numpy/python-numpy.mk | 7 ++-----
  1 file changed, 2 insertions(+), 5 deletions(-)
package/python-numpy/python-numpy.mk +0 -1
index f367b556ef..9e8b032b78 100644
@@ -40,12 +40,9 @@ endef
  # it uses host libraries (like libnpymath.a).
  # So, the numpy distutils extension packages would explicitly link this
  # config path for their package environment.
-PYTHON_NUMPY_STAGING_DIR = $(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/numpy

package/python-numpy/python-numpy.mk endef · line 48

Quoted 10 lines
package/python-numpy/python-numpy.mk +2 -4
-PYTHON_NUMPY_NPY_PKG_CONFIG_PATH=$(PYTHON_NUMPY_STAGING_DIR)/core/lib/npy-pkg-config
  define PYTHON_NUMPY_FIXUP_NPY_PKG_CONFIG_FILES
-	sed -e '/^pkgdir=/d' \
-	    -e '/^prefix=/i pkgdir=$(PYTHON_NUMPY_STAGING_DIR)/core' \
-	    -i $(PYTHON_NUMPY_NPY_PKG_CONFIG_PATH)/npymath.ini
+	$(SED) '/^pkgdir=/d;/^prefix=/i pkgdir=$(PYTHON3_PATH)/site-packages/numpy/core' \
+		$(PYTHON3_PATH)/site-packages/numpy/core/lib/npy-pkg-config/npymath.ini
  endef
  PYTHON_NUMPY_POST_INSTALL_STAGING_HOOKS += PYTHON_NUMPY_FIXUP_NPY_PKG_CONFIG_FILES
 

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot