Refactor and document Language::Python.

This commit is contained in:
Markus Reiter 2020-08-17 19:01:02 +02:00
parent 9a63811e8f
commit e909ea2471
3 changed files with 21 additions and 18 deletions

View File

@ -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 @@ module Language
# 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

View File

@ -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"

View File

@ -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