Skip to content

Commit 643441e

Browse files
author
Ahmad Shahba
committed
Made Makefile.PL extract package version from HDF5.pm
1 parent 4afd390 commit 643441e

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

Makefile.PL

+18-3
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,21 @@ $LIBS .= " -lz" if($zLib);
115115
$LIBS .= " -ljpeg" if($jpegLib);
116116
$LIBS .= " -lm";
117117

118+
# Extract package version from HDF5.pm
119+
my $packageVersion;
120+
{
121+
open my $fh, '<', 'HDF5.pm' or die 'Could not open HDF5.pm for reading';
122+
while (<$fh>) {
123+
if(/\$PDL::IO::HDF5::VERSION\h*=\h*('|")([\d.]+)\g1/) {
124+
$packageVersion = $2;
125+
last;
126+
}
127+
}
128+
close $fh
129+
}
130+
die "Could not extract package version from HDF5.pm" unless defined $packageVersion;
131+
132+
118133
my $package = ["hdf5.pd",'HDF5','PDL::IO::HDF5'];
119134
my $meta_merge = {
120135
'name' => 'PDL-IO-HDF5',
@@ -125,7 +140,7 @@ my $meta_merge = {
125140
'Andrew Benson <abenson AT obs.carnegiescience.edu>',
126141
],
127142
'license' => [ 'perl_5' ],
128-
'version' => '0.73',
143+
'version' => $packageVersion,
129144
'meta_spec' => {
130145
'version' => '2',
131146
'url' => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec',
@@ -155,7 +170,7 @@ my $meta_merge = {
155170
},
156171
},
157172
resources => {
158-
license => [ 'http://cpansearch.perl.org/src/CHM/PDL-IO-HDF5-0.73/COPYRIGHT' ],
173+
license => [ "http://cpansearch.perl.org/src/CHM/PDL-IO-HDF5-$packageVersion/COPYRIGHT" ],
159174
homepage => 'http://pdl.perl.org/',
160175
bugtracker => {
161176
web => 'https://github.com/PDLPorters/pdl-io-hdf5/issues',
@@ -199,4 +214,4 @@ WriteMakefile(
199214
'dist' => { COMPRESS => 'gzip', SUFFIX => 'gz', PREOP => $preop },
200215
);
201216

202-
sub MY::postamble { pdlpp_postamble($package); }
217+
sub MY::postamble { pdlpp_postamble($package); }

0 commit comments

Comments
 (0)