Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert language mixins back to module_function #15259

Merged
merged 1 commit into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Library/Homebrew/language/perl.rb
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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