Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils/pypi: allow only updating extra_packages #16753

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Library/Homebrew/utils/pypi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ def self.update_python_resources!(formula, version: nil, package_name: nil, extr

main_package = if package_name.present?
Package.new(package_name, python_name: python_name)
elsif package_name == ""
nil
else
stable = T.must(formula.stable)
url = if stable.specs[:tag].present?
Expand All @@ -250,7 +252,9 @@ def self.update_python_resources!(formula, version: nil, package_name: nil, extr
Package.new(url, is_url: true, python_name: python_name)
end

if version.present?
if main_package.nil?
odie "The main package was skipped but no PyPI `extra_packages` were provided." if extra_packages.blank?
elsif version.present?
if main_package.valid_pypi_package?
main_package.version = version
else
Expand All @@ -270,7 +274,7 @@ def self.update_python_resources!(formula, version: nil, package_name: nil, extr
# remove packages from the exclude list if we've explicitly requested them as an extra package
exclude_packages.delete_if { |package| extra_packages.include?(package) }

input_packages = [main_package]
input_packages = Array(main_package)
extra_packages.each do |extra_package|
if !extra_package.valid_pypi_package? && !ignore_non_pypi_packages
odie "\"#{extra_package}\" is not available on PyPI."
Expand Down Expand Up @@ -302,7 +306,7 @@ def self.update_python_resources!(formula, version: nil, package_name: nil, extr
exclude_packages.delete_if { |package| found_packages.exclude? package }
ohai "Retrieving PyPI dependencies for excluded \"#{exclude_packages.join(" ")}\"..." if show_info
exclude_packages = pip_report(exclude_packages, python_name: python_name, print_stderr: verbose && show_info)
exclude_packages += [Package.new(main_package.name)]
exclude_packages += [Package.new(main_package.name)] unless main_package.nil?

new_resource_blocks = ""
found_packages.sort.each do |package|
Expand Down
Loading