Skip to content

Commit

Permalink
utils/pypi: allow only updating extra_packages
Browse files Browse the repository at this point in the history
  • Loading branch information
cho-m committed Feb 27, 2024
1 parent 18571e8 commit 31533cf
Showing 1 changed file with 7 additions and 3 deletions.
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?

Check warning on line 255 in Library/Homebrew/utils/pypi.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/utils/pypi.rb#L255

Added line #L255 was not covered by tests
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 = main_package.nil? ? [] : [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

0 comments on commit 31533cf

Please sign in to comment.