mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-09 15:37:56 -05:00
Some pip refactoring... (#10463)
* Pip updates Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add wheel upload capability to crew. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * reupload i686 binary of py3_twine Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add :in_install. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Mention uri in uri download failed message. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Have gem maintenance use cleanup instead of pristine. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add binaries for py3_importlib_metadata Signed-off-by: Satadru Pramanik <satadru@gmail.com> * update scripts... Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Suggested changes. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * dogfooding build_updated_packages script to make more updates... Signed-off-by: Satadru Pramanik <satadru@gmail.com> * More changes to use CREW_GITLAB_PKG_REPO. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Suggested changes and tools updates. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Added a :prerelease property to buildsystems/pip because properties from package.rb are not seen by buildsystems/pip.rb Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add more binaries Signed-off-by: Satadru Pramanik <satadru@gmail.com> * update i686 hash Signed-off-by: Satadru Pramanik <satadru@gmail.com> * update last hash Signed-off-by: Satadru Pramanik <satadru@gmail.com> --------- Signed-off-by: Satadru Pramanik <satadru@gmail.com>
This commit is contained in:
committed by
GitHub
parent
b518445f04
commit
db0de20fc4
@@ -5,13 +5,16 @@ require 'package'
|
||||
require_relative '../const'
|
||||
|
||||
class Pip < Package
|
||||
property :pip_install_extras, :pre_configure_options
|
||||
property :pip_install_extras, :pre_configure_options, :prerelease
|
||||
|
||||
def self.install
|
||||
# Make sure Chromebrew pypi variables are set:
|
||||
Kernel.system 'pip config --user set local.index-url https://gitlab.com/api/v4/projects/26210301/packages/pypi/simple' unless `pip config get local.index-url`.chomp == 'https://gitlab.com/api/v4/projects/26210301/packages/pypi/simple'
|
||||
Kernel.system 'pip config --user set local.extra-index-url https://pypi.org/simple' unless `pip config get local.extra-index-url`.chomp == 'https://pypi.org/simple'
|
||||
Kernel.system 'pip config --user set local.trusted-host gitlab.com' unless `pip config get local.trusted-host`.chomp == 'gitlab.com'
|
||||
# Make sure Chromebrew pypi variables are set.
|
||||
# These need to be set as global or they don't work.
|
||||
pip_config = `pip config list`.chomp
|
||||
Kernel.system "pip config --user set global.index-url #{CREW_GITLAB_PKG_REPO}/pypi/simple", %i[err out] => File::NULL unless pip_config.include?("global.index-url='#{CREW_GITLAB_PKG_REPO}'")
|
||||
Kernel.system 'pip config --user set global.extra-index-url https://pypi.org/simple', %i[err out] => File::NULL unless pip_config.include?("global.extra-index-url='https://pypi.org/simple'")
|
||||
Kernel.system 'pip config --user set global.trusted-host gitlab.com', %i[err out] => File::NULL unless pip_config.include?("global.trusted-host='gitlab.com'")
|
||||
pip_cache_dir = `pip cache dir`.chomp
|
||||
|
||||
puts 'Checking for pip updates'.orange if CREW_VERBOSE
|
||||
system "python3 -s -m pip install -U pip | grep -v 'Requirement already satisfied'", exception: false
|
||||
@@ -37,7 +40,15 @@ class Pip < Package
|
||||
end
|
||||
puts "Installing #{@py_pkg} python module. This may take a while...".lightblue
|
||||
puts "Additional pre_configure_options being used: #{@pre_configure_options.nil? ? '<no pre_configure_options>' : @pre_configure_options}".orange
|
||||
puts "#{@py_pkg.capitalize} is configured to install a pre-release version." if prerelease
|
||||
system "MAKEFLAGS=-j#{CREW_NPROC} #{@pre_configure_options} python -s -m pip install --ignore-installed -U \"#{@py_pkg}==#{@py_pkg_chromebrew_version}\" | grep -v 'Requirement already satisfied'", exception: false
|
||||
|
||||
if @source_url == 'SKIP'
|
||||
system "pip wheel -w #{pip_cache_dir} #{@py_pkg}"
|
||||
else
|
||||
system "pip wheel -w #{pip_cache_dir} git+#{source_url}"
|
||||
end
|
||||
|
||||
@pip_files = `python3 -s -m pip show -f #{@py_pkg}`.chomp
|
||||
abort "pip install of #{@py_pkg} failed." if @pip_files.empty?
|
||||
@pip_files_base = @pip_files[/(?<=Location: ).*/, 0].concat('/')
|
||||
|
||||
Reference in New Issue
Block a user