From e909ea247198348966e1b9e182d091e32e86aaff Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 17 Aug 2020 19:01:02 +0200 Subject: [PATCH 1/2] Refactor and document `Language::Python`. --- Library/Homebrew/language/python.rb | 23 +++++++++++++++++-- .../language/python_virtualenv_constants.rb | 15 ------------ Library/Homebrew/sorbet/files.yaml | 1 - 3 files changed, 21 insertions(+), 18 deletions(-) delete mode 100644 Library/Homebrew/language/python_virtualenv_constants.rb diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb index 5842e3a55be51..de425575ea701 100644 --- a/Library/Homebrew/language/python.rb +++ b/Library/Homebrew/language/python.rb @@ -1,8 +1,9 @@ # frozen_string_literal: true -require "language/python_virtualenv_constants" - module Language + # Helper functions for Python formulae. + # + # @api public module Python def self.major_minor_version(python) version = /\d\.\d/.match `#{python} --version 2>&1` @@ -112,6 +113,24 @@ def detected_python_shebang(formula = self) # Mixin module for {Formula} adding virtualenv support features. module Virtualenv + PYTHON_VIRTUALENV_URL = + "https://files.pythonhosted.org/packages/11/74" \ + "/2c151a13ef41ab9fb43b3c4ff9e788e0496ed7923b2078d42cab30622bdf" \ + "/virtualenv-16.7.4.tar.gz" + private_constant :PYTHON_VIRTUALENV_URL + PYTHON_VIRTUALENV_SHA256 = + "94a6898293d07f84a98add34c4df900f8ec64a570292279f6d91c781d37fd305" + private_constant :PYTHON_VIRTUALENV_SHA256 + + PYTHON_VIRTUALENV_URL_MOJAVE = + "https://files.pythonhosted.org/packages/b1/72" \ + "/2d70c5a1de409ceb3a27ff2ec007ecdd5cc52239e7c74990e32af57affe9" \ + "/virtualenv-15.2.0.tar.gz" + private_constant :PYTHON_VIRTUALENV_URL_MOJAVE + PYTHON_VIRTUALENV_SHA256_MOJAVE = + "1d7e241b431e7afce47e77f8843a276f652699d1fa4f93b9d8ce0076fd7b0b54" + private_constant :PYTHON_VIRTUALENV_SHA256_MOJAVE + def self.included(base) base.class_eval do resource "homebrew-virtualenv" do diff --git a/Library/Homebrew/language/python_virtualenv_constants.rb b/Library/Homebrew/language/python_virtualenv_constants.rb deleted file mode 100644 index bb4a69df5ba2b..0000000000000 --- a/Library/Homebrew/language/python_virtualenv_constants.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -PYTHON_VIRTUALENV_URL = - "https://files.pythonhosted.org/packages/11/74" \ - "/2c151a13ef41ab9fb43b3c4ff9e788e0496ed7923b2078d42cab30622bdf" \ - "/virtualenv-16.7.4.tar.gz" -PYTHON_VIRTUALENV_SHA256 = - "94a6898293d07f84a98add34c4df900f8ec64a570292279f6d91c781d37fd305" - -PYTHON_VIRTUALENV_URL_MOJAVE = - "https://files.pythonhosted.org/packages/b1/72" \ - "/2d70c5a1de409ceb3a27ff2ec007ecdd5cc52239e7c74990e32af57affe9" \ - "/virtualenv-15.2.0.tar.gz" -PYTHON_VIRTUALENV_SHA256_MOJAVE = - "1d7e241b431e7afce47e77f8843a276f652699d1fa4f93b9d8ce0076fd7b0b54" diff --git a/Library/Homebrew/sorbet/files.yaml b/Library/Homebrew/sorbet/files.yaml index 444006e5f3d9d..f6a6896dc173d 100644 --- a/Library/Homebrew/sorbet/files.yaml +++ b/Library/Homebrew/sorbet/files.yaml @@ -951,7 +951,6 @@ strict: - ./extend/os/tap.rb - ./extend/os/utils/analytics.rb - ./language/haskell.rb - - ./language/python_virtualenv_constants.rb - ./os/global.rb - ./os/linux/diagnostic.rb - ./requirements.rb From da0ff4feb08b90a71fed58661f4067e493a651dc Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 19 Aug 2020 10:45:06 +0200 Subject: [PATCH 2/2] Remove `PYTHON_VIRTUALENV_*` constants. --- Library/Homebrew/language/python.rb | 28 ++----------------- .../sorbet/rbi/hidden-definitions/hidden.rbi | 4 --- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb index de425575ea701..cd9fa6db910ae 100644 --- a/Library/Homebrew/language/python.rb +++ b/Library/Homebrew/language/python.rb @@ -113,34 +113,12 @@ def detected_python_shebang(formula = self) # Mixin module for {Formula} adding virtualenv support features. module Virtualenv - PYTHON_VIRTUALENV_URL = - "https://files.pythonhosted.org/packages/11/74" \ - "/2c151a13ef41ab9fb43b3c4ff9e788e0496ed7923b2078d42cab30622bdf" \ - "/virtualenv-16.7.4.tar.gz" - private_constant :PYTHON_VIRTUALENV_URL - PYTHON_VIRTUALENV_SHA256 = - "94a6898293d07f84a98add34c4df900f8ec64a570292279f6d91c781d37fd305" - private_constant :PYTHON_VIRTUALENV_SHA256 - - PYTHON_VIRTUALENV_URL_MOJAVE = - "https://files.pythonhosted.org/packages/b1/72" \ - "/2d70c5a1de409ceb3a27ff2ec007ecdd5cc52239e7c74990e32af57affe9" \ - "/virtualenv-15.2.0.tar.gz" - private_constant :PYTHON_VIRTUALENV_URL_MOJAVE - PYTHON_VIRTUALENV_SHA256_MOJAVE = - "1d7e241b431e7afce47e77f8843a276f652699d1fa4f93b9d8ce0076fd7b0b54" - private_constant :PYTHON_VIRTUALENV_SHA256_MOJAVE - def self.included(base) base.class_eval do resource "homebrew-virtualenv" do - if MacOS.version > :mojave - url PYTHON_VIRTUALENV_URL - sha256 PYTHON_VIRTUALENV_SHA256 - else - url PYTHON_VIRTUALENV_URL_MOJAVE - sha256 PYTHON_VIRTUALENV_SHA256_MOJAVE - end + url "https://files.pythonhosted.org/packages/11/74" \ + "/2c151a13ef41ab9fb43b3c4ff9e788e0496ed7923b2078d42cab30622bdf/virtualenv-16.7.4.tar.gz" + sha256 "94a6898293d07f84a98add34c4df900f8ec64a570292279f6d91c781d37fd305" end end end diff --git a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi index ca6c39655c159..e6a89ae9af9d9 100644 --- a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi @@ -13394,10 +13394,6 @@ class Object OFFICIAL_CASK_TAPS = ::T.let(nil, ::T.untyped) OFFICIAL_CMD_TAPS = ::T.let(nil, ::T.untyped) OS_VERSION = ::T.let(nil, ::T.untyped) - PYTHON_VIRTUALENV_SHA256 = ::T.let(nil, ::T.untyped) - PYTHON_VIRTUALENV_SHA256_MOJAVE = ::T.let(nil, ::T.untyped) - PYTHON_VIRTUALENV_URL = ::T.let(nil, ::T.untyped) - PYTHON_VIRTUALENV_URL_MOJAVE = ::T.let(nil, ::T.untyped) RUBY_COPYRIGHT = ::T.let(nil, ::T.untyped) RUBY_DESCRIPTION = ::T.let(nil, ::T.untyped) RUBY_ENGINE = ::T.let(nil, ::T.untyped)