Skip to content

Commit

Permalink
Merge pull request #15259 from dduugg/revert-mixin-changes
Browse files Browse the repository at this point in the history
Revert language mixins back to module_function
  • Loading branch information
Bo98 committed Apr 18, 2023
2 parents 4ef6a2c + d7d8f2c commit d039f46
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Library/Homebrew/language/perl.rb
Expand Up @@ -8,7 +8,9 @@ module Language
module Perl
# Helper module for replacing `perl` shebangs.
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"
Formula["perl"].opt_bin/"perl"
elsif formula.uses_from_macos_names.include? "perl"
Expand Down
9 changes: 9 additions & 0 deletions Library/Homebrew/language/perl.rbi
@@ -0,0 +1,9 @@
# typed: strict

module Language
module Perl
module Shebang
include Kernel
end
end
end
6 changes: 4 additions & 2 deletions Library/Homebrew/language/python.rb
Expand Up @@ -92,16 +92,18 @@ def self.setup_install_args(prefix, python = "python3")

# Mixin module for {Formula} adding shebang rewrite features.
module Shebang
module_function

# @private
def self.python_shebang_rewrite_info(python_path)
def python_shebang_rewrite_info(python_path)
Utils::Shebang::RewriteInfo.new(
%r{^#! ?/usr/bin/(?:env )?python(?:[23](?:\.\d{1,2})?)?( |$)},
28, # the length of "#! /usr/bin/env pythonx.yyy "
"#{python_path}\\1",
)
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
"/usr/bin/env python3"
else
Expand Down
10 changes: 8 additions & 2 deletions Library/Homebrew/language/python.rbi
@@ -1,5 +1,11 @@
# typed: strict

module Language::Python::Virtualenv
requires_ancestor { Formula }
module Language::Python
module Shebang
include Kernel
end

module Virtualenv
requires_ancestor { Formula }
end
end

0 comments on commit d039f46

Please sign in to comment.