perl: remove self references (#49560)
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
parent
ecf414ed07
commit
31fa12ebd3
@ -458,17 +458,15 @@ def symlink_windows(self):
|
|||||||
|
|
||||||
@run_after("install")
|
@run_after("install")
|
||||||
def install_cpanm(self):
|
def install_cpanm(self):
|
||||||
spec = self.spec
|
|
||||||
maker = make
|
maker = make
|
||||||
cpan_dir = join_path("cpanm", "cpanm")
|
cpan_dir = join_path("cpanm", "cpanm")
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
maker = nmake
|
maker = nmake
|
||||||
cpan_dir = join_path(self.stage.source_path, cpan_dir)
|
cpan_dir = join_path(self.stage.source_path, cpan_dir)
|
||||||
cpan_dir = windows_sfn(cpan_dir)
|
cpan_dir = windows_sfn(cpan_dir)
|
||||||
if "+cpanm" in spec:
|
if "+cpanm" in self.spec:
|
||||||
with working_dir(cpan_dir):
|
with working_dir(cpan_dir):
|
||||||
perl = spec["perl"].command
|
self.command("Makefile.PL")
|
||||||
perl("Makefile.PL")
|
|
||||||
maker()
|
maker()
|
||||||
maker("install")
|
maker("install")
|
||||||
|
|
||||||
@ -502,7 +500,7 @@ def setup_dependent_package(self, module, dependent_spec):
|
|||||||
if dependent_spec.package.is_extension:
|
if dependent_spec.package.is_extension:
|
||||||
# perl extension builds can have a global perl
|
# perl extension builds can have a global perl
|
||||||
# executable function
|
# executable function
|
||||||
module.perl = self.spec["perl"].command
|
module.perl = self.command
|
||||||
|
|
||||||
# Add variables for library directory
|
# Add variables for library directory
|
||||||
module.perl_lib_dir = dependent_spec.prefix.lib.perl5
|
module.perl_lib_dir = dependent_spec.prefix.lib.perl5
|
||||||
@ -541,8 +539,7 @@ def filter_config_dot_pm(self):
|
|||||||
kwargs = {"ignore_absent": True, "backup": False, "string": False}
|
kwargs = {"ignore_absent": True, "backup": False, "string": False}
|
||||||
|
|
||||||
# Find the actual path to the installed Config.pm file.
|
# Find the actual path to the installed Config.pm file.
|
||||||
perl = self.spec["perl"].command
|
config_dot_pm = self.command(
|
||||||
config_dot_pm = perl(
|
|
||||||
"-MModule::Loaded", "-MConfig", "-e", "print is_loaded(Config)", output=str
|
"-MModule::Loaded", "-MConfig", "-e", "print is_loaded(Config)", output=str
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -606,17 +603,15 @@ def command(self):
|
|||||||
ext = ""
|
ext = ""
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
ext = ".exe"
|
ext = ".exe"
|
||||||
path = os.path.join(self.prefix.bin, "{0}{1}{2}".format(self.spec.name, ver, ext))
|
path = os.path.join(self.prefix.bin, f"{self.spec.name}{ver}{ext}")
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
return Executable(path)
|
return Executable(path)
|
||||||
else:
|
else:
|
||||||
msg = "Unable to locate {0} command in {1}"
|
raise RuntimeError(f"Unable to locate {self.spec.name} command in {self.prefix.bin}")
|
||||||
raise RuntimeError(msg.format(self.spec.name, self.prefix.bin))
|
|
||||||
|
|
||||||
def test_version(self):
|
def test_version(self):
|
||||||
"""check version"""
|
"""check version"""
|
||||||
perl = self.spec["perl"].command
|
out = self.command("--version", output=str.split, error=str.split)
|
||||||
out = perl("--version", output=str.split, error=str.split)
|
|
||||||
expected = ["perl", str(self.spec.version)]
|
expected = ["perl", str(self.spec.version)]
|
||||||
for expect in expected:
|
for expect in expected:
|
||||||
assert expect in out
|
assert expect in out
|
||||||
@ -626,6 +621,5 @@ def test_hello(self):
|
|||||||
msg = "Hello, World!"
|
msg = "Hello, World!"
|
||||||
options = ["-e", "use warnings; use strict;\nprint('%s\n');" % msg]
|
options = ["-e", "use warnings; use strict;\nprint('%s\n');" % msg]
|
||||||
|
|
||||||
perl = self.spec["perl"].command
|
out = self.command(*options, output=str.split, error=str.split)
|
||||||
out = perl(*options, output=str.split, error=str.split)
|
|
||||||
assert msg in out
|
assert msg in out
|
||||||
|
Loading…
Reference in New Issue
Block a user