Make the cpanm version a variant

Rather than hard-coding the verison of `cpanm` that's [optionally]
installed into the core, make it a variant with a default value of
'1.7042'.

Also discovered that `prefix + 'bin'` is the same as `prefix.bin`, so
embetter that bit of code.
This commit is contained in:
George Hartzell 2016-07-22 17:55:57 -04:00
parent a5a4525bed
commit 4d72e0fb9d

View File

@ -26,6 +26,8 @@ class Perl(Package):
# things cleanly.
variant('cpanm', default=True,
description='Having cpanm in core simplifies adding modules.')
variant('cpanm_version', default='1.7042',
description='Version of cpanm to install into core if +cpanm.')
def install(self, spec, prefix):
configure = Executable('./Configure')
@ -35,8 +37,9 @@ def install(self, spec, prefix):
make("install")
if '+cpanm' in spec:
perl_exe = join_path(prefix, 'bin', 'perl')
perl_exe = join_path(prefix.bin, 'perl')
perl = Executable(perl_exe)
cpanm_installer = join_path(self.package_dir, 'cpanm-installer.pl')
cpanm_package_spec = 'App::cpanminus' + '@' + '1.7042'
cpanm_version = spec.variants['cpanm_version'].value
cpanm_package_spec = 'App::cpanminus' + '@' + cpanm_version
perl(cpanm_installer, cpanm_package_spec)