Merge pull request #15259 from dduugg/revert-mixin-changes

Revert language mixins back to module_function
This commit is contained in:
Bo Anderson 2023-04-18 14:30:50 +01:00 committed by GitHub
commit d039f46faa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 5 deletions

View File

@ -8,7 +8,9 @@ module Language
module Perl module Perl
# Helper module for replacing `perl` shebangs. # Helper module for replacing `perl` shebangs.
module Shebang module Shebang
def self.detected_perl_shebang(formula = self) module_function
def detected_perl_shebang(formula = self)
perl_path = if formula.deps.map(&:name).include? "perl" perl_path = if formula.deps.map(&:name).include? "perl"
Formula["perl"].opt_bin/"perl" Formula["perl"].opt_bin/"perl"
elsif formula.uses_from_macos_names.include? "perl" elsif formula.uses_from_macos_names.include? "perl"

View File

@ -0,0 +1,9 @@
# typed: strict
module Language
module Perl
module Shebang
include Kernel
end
end
end

View File

@ -92,8 +92,10 @@ module Language
# Mixin module for {Formula} adding shebang rewrite features. # Mixin module for {Formula} adding shebang rewrite features.
module Shebang module Shebang
module_function
# @private # @private
def self.python_shebang_rewrite_info(python_path) def python_shebang_rewrite_info(python_path)
Utils::Shebang::RewriteInfo.new( Utils::Shebang::RewriteInfo.new(
%r{^#! ?/usr/bin/(?:env )?python(?:[23](?:\.\d{1,2})?)?( |$)}, %r{^#! ?/usr/bin/(?:env )?python(?:[23](?:\.\d{1,2})?)?( |$)},
28, # the length of "#! /usr/bin/env pythonx.yyy " 28, # the length of "#! /usr/bin/env pythonx.yyy "
@ -101,7 +103,7 @@ module Language
) )
end end
def self.detected_python_shebang(formula = self, use_python_from_path: false) def detected_python_shebang(formula = self, use_python_from_path: false)
python_path = if use_python_from_path python_path = if use_python_from_path
"/usr/bin/env python3" "/usr/bin/env python3"
else else

View File

@ -1,5 +1,11 @@
# typed: strict # typed: strict
module Language::Python::Virtualenv module Language::Python
requires_ancestor { Formula } module Shebang
include Kernel
end
module Virtualenv
requires_ancestor { Formula }
end
end end