From e95b82f3c7448c7ee688ebfbb8593f66ec138e41 Mon Sep 17 00:00:00 2001 From: Fabian Maas Date: Wed, 10 Nov 2021 09:55:26 +0100 Subject: [PATCH 1/2] upgrade pip during setup --- rock/python.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rock/python.rb b/rock/python.rb index 5f5e387..f23460e 100644 --- a/rock/python.rb +++ b/rock/python.rb @@ -231,6 +231,13 @@ def self.rewrite_pip_shims(python_executable, root_dir) pip_path end + def self.upgrade_pip(ws: Autoproj.workspace) + python_executable = ws.config.get("python_executable", nil) + unless python_executable.nil? + Open3.popen3("#{python_executable} -m pip install --upgrade pip") + end + end + # Activate configuration for python in the autoproj configuration # @return [String,String] python path and python version def self.activate_python(ws: Autoproj.workspace, @@ -244,6 +251,7 @@ def self.activate_python(ws: Autoproj.workspace, rewrite_python_shims(bin, ws.root_dir) rewrite_pip_shims(bin, ws.root_dir) + upgrade_pip(ws: ws) [bin, version] end From 529e7d9ee1092fe1f809a47b71808f825f38b3e2 Mon Sep 17 00:00:00 2001 From: Fabian Maas Date: Wed, 10 Nov 2021 10:45:54 +0100 Subject: [PATCH 2/2] also upgrade setuptools and wheel because it seems useful: https://packaging.python.org/tutorials/installing-packages/#ensure-pip-setuptools-and-wheel-are-up-to-date --- rock/python.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rock/python.rb b/rock/python.rb index f23460e..e60eaf8 100644 --- a/rock/python.rb +++ b/rock/python.rb @@ -234,7 +234,7 @@ def self.rewrite_pip_shims(python_executable, root_dir) def self.upgrade_pip(ws: Autoproj.workspace) python_executable = ws.config.get("python_executable", nil) unless python_executable.nil? - Open3.popen3("#{python_executable} -m pip install --upgrade pip") + Open3.popen3("#{python_executable} -m pip install --upgrade pip setuptools wheel") end end