resource: automatic determine mirrors for PyPI resources
This commit is contained in:
parent
46b3d24dd3
commit
d3093cd260
@ -318,6 +318,10 @@ module Homebrew
|
||||
"outdated.",
|
||||
boolean: true,
|
||||
},
|
||||
HOMEBREW_PIP_INDEX_URL: {
|
||||
description: "If set, `brew install <formula>` will use this URL to download PyPI package resources.",
|
||||
default_text: "`https://pypi.org/simple`.",
|
||||
},
|
||||
HOMEBREW_PRY: {
|
||||
description: "If set, use Pry for the `brew irb` command.",
|
||||
boolean: true,
|
||||
|
||||
@ -294,6 +294,14 @@ class Resource
|
||||
end
|
||||
end
|
||||
|
||||
# PyPI packages: PEP 503 – Simple Repository API <https://peps.python.org/pep-0503>
|
||||
if Homebrew::EnvConfig.pip_index_url.present?
|
||||
pip_index_base_url = Homebrew::EnvConfig.pip_index_url.chomp("/").chomp("/simple")
|
||||
%w[https://files.pythonhosted.org https://pypi.org].each do |base_url|
|
||||
extra_urls << url.sub(base_url, pip_index_base_url) if url.start_with?("#{base_url}/packages")
|
||||
end
|
||||
end
|
||||
|
||||
[*extra_urls, url, *mirrors].uniq
|
||||
end
|
||||
|
||||
|
||||
@ -2655,6 +2655,8 @@ module Homebrew::EnvConfig
|
||||
|
||||
def self.no_proxy(); end
|
||||
|
||||
def self.pip_index_url(); end
|
||||
|
||||
def self.pry?(); end
|
||||
|
||||
def self.simulate_macos_on_linux?(); end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user