Skip to contentSkip to conversation

package/pkg-python.mk: remove hardcoded paths for host Python

PATCH In review Роман Донченко 3 participants 4 messages Apr 5, 2022 – Apr 6, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/pkg-python.mk: remove hardcoded paths for host Python

When installer is used to install packages for host Python, it can figure out by itself which paths to use. We just need to use the installer CLI instead of our wrapper script.

---
 package/pkg-python.mk | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
package/pkg-python.mk +1 -9
index 867341fc7b..acd5628f3b 100644
@@ -146,14 +146,6 @@ HOST_PKG_PYTHON_PEP517_ENV = \
 	PYTHONNOUSERSITE=1 \
 	$(HOST_CONFIGURE_OPTS)
 
-HOST_PKG_PYTHON_PEP517_INSTALL_OPTS = \
-	--interpreter=/bin/python \
-	--script-kind=posix \
-	--purelib=$(HOST_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages \
-	--headers=$(HOST_DIR)/include/python$(PYTHON3_VERSION_MAJOR) \
-	--scripts=$(HOST_DIR)/bin \
-	--data=$(HOST_DIR)
-
 ################################################################################
 # inner-python-package -- defines how the configuration, compilation
 # and installation of a Python package should be done, implements a
@@ -212,7 +204,7 @@ $(2)_BASE_INSTALL_STAGING_CMD = $(TOPDIR)/support/scripts/pyinstaller.py dist/*
 else
 $(2)_BASE_ENV = $$(HOST_PKG_PYTHON_PEP517_ENV)
 $(2)_BASE_BUILD_CMD = -m build -n -w
-$(2)_BASE_INSTALL_CMD = $(TOPDIR)/support/scripts/pyinstaller.py dist/* $$(HOST_PKG_PYTHON_PEP517_INSTALL_OPTS)
+$(2)_BASE_INSTALL_CMD = -m installer dist/*
 endif
 else
 $$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'distutils', 'setuptools', 'pep517' or 'flit'.")
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 3 lines · Роман Донченко

When installer is used to install packages for host Python, it can figure out by itself which paths to use. We just need to use the installer CLI instead of our wrapper script.

James, could you have a look at this and add it to your series that reworks
the pep517 infra? Because I think it'll create conflicts.

Also, can the installer be used for target install as well?

Regards,
Arnout

Quoted 26 lines
---
  package/pkg-python.mk | 10 +---------
  1 file changed, 1 insertion(+), 9 deletions(-)
package/pkg-python.mk +0 -8
index 867341fc7b..acd5628f3b 100644
@@ -146,14 +146,6 @@ HOST_PKG_PYTHON_PEP517_ENV = \
  	PYTHONNOUSERSITE=1 \
  	$(HOST_CONFIGURE_OPTS)
 
-HOST_PKG_PYTHON_PEP517_INSTALL_OPTS = \
-	--interpreter=/bin/python \
-	--script-kind=posix \
-	--purelib=$(HOST_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages \
-	--headers=$(HOST_DIR)/include/python$(PYTHON3_VERSION_MAJOR) \
-	--scripts=$(HOST_DIR)/bin \
-	--data=$(HOST_DIR)
-
  ################################################################################
  # inner-python-package -- defines how the configuration, compilation
  # and installation of a Python package should be done, implements a

package/pkg-python.mk $(2)_BASE_INSTALL_STAGING_CMD = $(TOPDIR)/support/scripts/pyinstaller.py dist/* · line 210

Quoted 8 lines
package/pkg-python.mk +1 -1
@@ -212,7 +204,7 @@ $(2)_BASE_INSTALL_STAGING_CMD = $(TOPDIR)/support/scripts/pyinstaller.py dist/*
  else
  $(2)_BASE_ENV = $$(HOST_PKG_PYTHON_PEP517_ENV)
  $(2)_BASE_BUILD_CMD = -m build -n -w
-$(2)_BASE_INSTALL_CMD = $(TOPDIR)/support/scripts/pyinstaller.py dist/* $$(HOST_PKG_PYTHON_PEP517_INSTALL_OPTS)
+$(2)_BASE_INSTALL_CMD = -m installer dist/*
  endif
  else
  $$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'distutils', 'setuptools', 'pep517' or 'flit'.")

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

#2 lore raw

06.04.2022 17:24, Arnout Vandecappelle пишет:

Quoted 9 lines · Роман Донченко
Quoted 3 lines

When installer is used to install packages for host Python, it can figure out by itself which paths to use. We just need to use the installer CLI instead of our wrapper script.

 James, could you have a look at this and add it to your series that
reworks the pep517 infra? Because I think it'll create conflicts.

 Also, can the installer be used for target install as well?

No, installer doesn't know the settings for the target Python, and the installer CLI isn't flexible enough to configure these settings. So a custom script is required.

Quoted 29 lines

 Regards,
 Arnout

Quoted 25 lines

---
  package/pkg-python.mk | 10 +---------

  1 file changed, 1 insertion(+), 9 deletions(-)
package/pkg-python.mk +0 -9
index 867341fc7b..acd5628f3b 100644
@@ -146,14 +146,6 @@ HOST_PKG_PYTHON_PEP517_ENV = \
       PYTHONNOUSERSITE=1 \
       $(HOST_CONFIGURE_OPTS)
-HOST_PKG_PYTHON_PEP517_INSTALL_OPTS = \
-    --interpreter=/bin/python \
-    --script-kind=posix \
-    
--purelib=$(HOST_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages \
-    --headers=$(HOST_DIR)/include/python$(PYTHON3_VERSION_MAJOR) \
-    --scripts=$(HOST_DIR)/bin \
-    --data=$(HOST_DIR)
-
 
 ################################################################################ 
 
Quoted 13 lines
Quoted 5 lines
  # inner-python-package -- defines how the configuration, compilation
  # and installation of a Python package should be done, implements a
package/pkg-python.mk +0 -0
@@ -212,7 +204,7 @@ $(2)_BASE_INSTALL_STAGING_CMD = 

$(TOPDIR)/support/scripts/pyinstaller.py dist/*
  else

Quoted 8 lines

  $(2)_BASE_ENV = $$(HOST_PKG_PYTHON_PEP517_ENV)
  $(2)_BASE_BUILD_CMD = -m build -n -w
-$(2)_BASE_INSTALL_CMD = $(TOPDIR)/support/scripts/pyinstaller.py
dist/* $$(HOST_PKG_PYTHON_PEP517_INSTALL_OPTS)
+$(2)_BASE_INSTALL_CMD = -m installer dist/*
  endif
  else
  $$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'distutils', 'setuptools', 'pep517' or 'flit'.")

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

#3 lore raw
Quoted 9 lines · Роман Донченко

06.04.2022 17:24, Arnout Vandecappelle пишет:

Quoted 7 lines · Роман Донченко
Quoted 3 lines

When installer is used to install packages for host Python, it can figure out by itself which paths to use. We just need to use the installer CLI instead of our wrapper script.

James, could you have a look at this and add it to your series that
reworks the pep517 infra? Because I think it'll create conflicts.

Rebased it on my flit bootstrap migration patch:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Quoted 6 lines
Quoted 2 lines

Also, can the installer be used for target install as well?

No, installer doesn't know the settings for the target Python, and the installer CLI isn't flexible enough to configure these settings. So a custom script is required.

Yeah, unfortunately upstream installer has been somewhat resistant to adding this sort of customization functionality to the CLI.

Quoted 30 lines
Quoted 30 lines

Regards,
Arnout

Quoted 25 lines
---
  package/pkg-python.mk | 10 +---------
  1 file changed, 1 insertion(+), 9 deletions(-)
package/pkg-python.mk +0 -9
index 867341fc7b..acd5628f3b 100644
@@ -146,14 +146,6 @@ HOST_PKG_PYTHON_PEP517_ENV = \
      PYTHONNOUSERSITE=1 \
      $(HOST_CONFIGURE_OPTS)
-HOST_PKG_PYTHON_PEP517_INSTALL_OPTS = \
-    --interpreter=/bin/python \
-    --script-kind=posix \
-
--purelib=$(HOST_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages \
-    --headers=$(HOST_DIR)/include/python$(PYTHON3_VERSION_MAJOR) \
-    --scripts=$(HOST_DIR)/bin \
-    --data=$(HOST_DIR)
-
 
 ################################################################################
 
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
package/pkg-python.mk +0 -0
  # inner-python-package -- defines how the configuration, compilation
  # and installation of a Python package should be done, implements a
@@ -212,7 +204,7 @@ $(2)_BASE_INSTALL_STAGING_CMD =

$(TOPDIR)/support/scripts/pyinstaller.py dist/*
else
$(2)_BASE_ENV = $$(HOST_PKG_PYTHON_PEP517_ENV)

Quoted 8 lines
Quoted 8 lines

$(2)_BASE_BUILD_CMD = -m build -n -w
-$(2)_BASE_INSTALL_CMD = $(TOPDIR)/support/scripts/pyinstaller.py dist/* $$(HOST_PKG_PYTHON_PEP517_INSTALL_OPTS) +$(2)_BASE_INSTALL_CMD = -m installer dist/*
endif
else
$$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'distutils',
'setuptools', 'pep517' or 'flit'.")

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