Imported Upstream version 0.307
Florian Schlichting
10 years ago
0 | 0 | Revision history for Perl extension ExtUtils::Depends. |
1 | ||
2 | 0.307 Mon Apr 28 22:04:38 PDT 2014 | |
3 | - $Data::Dumper::Terse set to 1 broke save_config | |
4 | - Document API expected by ::load function | |
1 | 5 | |
2 | 6 | 0.306 Mon Sep 28 22:04:38 PDT 2013 |
3 | 7 | - Fixed typo in RT queue URL; fixes RT#88960 |
3 | 3 | "Gtk2-Perl Team <gtk-perl-list at gnome dot org>" |
4 | 4 | ], |
5 | 5 | "dynamic_config" : 1, |
6 | "generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921", | |
6 | "generated_by" : "ExtUtils::MakeMaker version 6.86, CPAN::Meta::Converter version 2.133380", | |
7 | 7 | "keywords" : [ |
8 | 8 | "XS", |
9 | 9 | "XS extensions", |
29 | 29 | "prereqs" : { |
30 | 30 | "build" : { |
31 | 31 | "requires" : { |
32 | "ExtUtils::MakeMaker" : "0", | |
32 | 33 | "Test::More" : "0" |
33 | 34 | } |
34 | 35 | }, |
35 | 36 | "configure" : { |
36 | 37 | "requires" : { |
37 | 38 | "Data::Dumper" : "0", |
39 | "ExtUtils::MakeMaker" : "0", | |
38 | 40 | "File::Spec" : "0", |
39 | 41 | "IO::File" : "0" |
42 | } | |
43 | }, | |
44 | "runtime" : { | |
45 | "requires" : { | |
46 | "Data::Dumper" : "0", | |
47 | "File::Spec" : "0", | |
48 | "IO::File" : "0", | |
49 | "perl" : "5.006" | |
40 | 50 | } |
41 | 51 | }, |
42 | 52 | "test" : { |
62 | 72 | }, |
63 | 73 | "x_MailingList" : "https://mail.gnome.org/mailman/listinfo/gtk-perl-list" |
64 | 74 | }, |
65 | "version" : "0.306" | |
75 | "version" : "0.307" | |
66 | 76 | } |
2 | 2 | author: |
3 | 3 | - 'Gtk2-Perl Team <gtk-perl-list at gnome dot org>' |
4 | 4 | build_requires: |
5 | ExtUtils::MakeMaker: 0 | |
5 | 6 | Test::More: 0 |
6 | 7 | configure_requires: |
7 | 8 | Data::Dumper: 0 |
9 | ExtUtils::MakeMaker: 0 | |
8 | 10 | File::Spec: 0 |
9 | 11 | IO::File: 0 |
10 | 12 | dynamic_config: 1 |
11 | generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921' | |
13 | generated_by: 'ExtUtils::MakeMaker version 6.86, CPAN::Meta::Converter version 2.133380' | |
12 | 14 | keywords: |
13 | 15 | - XS |
14 | 16 | - 'XS extensions' |
24 | 26 | - inc |
25 | 27 | package: |
26 | 28 | - ExtUtils::MM |
29 | requires: | |
30 | Data::Dumper: 0 | |
31 | File::Spec: 0 | |
32 | IO::File: 0 | |
33 | perl: 5.006 | |
27 | 34 | resources: |
35 | MailingList: https://mail.gnome.org/mailman/listinfo/gtk-perl-list | |
28 | 36 | bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=ExtUtils-Depends |
29 | 37 | homepage: http://gtk2-perl.sourceforge.net |
30 | 38 | license: http://dev.perl.org/licenses/ |
31 | 39 | repository: git://git.gnome.org/perl-ExtUtils-Depends |
32 | x_MailingList: https://mail.gnome.org/mailman/listinfo/gtk-perl-list | |
33 | version: 0.306 | |
40 | version: 0.307 |
3 | 3 | "Gtk2-Perl Team <gtk-perl-list at gnome dot org>" |
4 | 4 | ], |
5 | 5 | "dynamic_config" : 0, |
6 | "generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921", | |
6 | "generated_by" : "ExtUtils::MakeMaker version 6.86, CPAN::Meta::Converter version 2.133380", | |
7 | 7 | "keywords" : [ |
8 | 8 | "XS", |
9 | 9 | "XS extensions", |
29 | 29 | "prereqs" : { |
30 | 30 | "build" : { |
31 | 31 | "requires" : { |
32 | "ExtUtils::MakeMaker" : "0", | |
32 | 33 | "Test::More" : "0" |
33 | 34 | } |
34 | 35 | }, |
35 | 36 | "configure" : { |
36 | 37 | "requires" : { |
37 | 38 | "Data::Dumper" : "0", |
39 | "ExtUtils::MakeMaker" : "0", | |
38 | 40 | "File::Spec" : "0", |
39 | 41 | "IO::File" : "0" |
42 | } | |
43 | }, | |
44 | "runtime" : { | |
45 | "requires" : { | |
46 | "Data::Dumper" : "0", | |
47 | "File::Spec" : "0", | |
48 | "IO::File" : "0", | |
49 | "perl" : "5.006" | |
40 | 50 | } |
41 | 51 | }, |
42 | 52 | "test" : { |
62 | 72 | }, |
63 | 73 | "x_MailingList" : "https://mail.gnome.org/mailman/listinfo/gtk-perl-list" |
64 | 74 | }, |
65 | "version" : "0.306" | |
75 | "version" : "0.307" | |
66 | 76 | } |
2 | 2 | author: |
3 | 3 | - 'Gtk2-Perl Team <gtk-perl-list at gnome dot org>' |
4 | 4 | build_requires: |
5 | ExtUtils::MakeMaker: 0 | |
5 | 6 | Test::More: 0 |
6 | 7 | configure_requires: |
7 | 8 | Data::Dumper: 0 |
9 | ExtUtils::MakeMaker: 0 | |
8 | 10 | File::Spec: 0 |
9 | 11 | IO::File: 0 |
10 | 12 | dynamic_config: 0 |
11 | generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921' | |
13 | generated_by: 'ExtUtils::MakeMaker version 6.86, CPAN::Meta::Converter version 2.133380' | |
12 | 14 | keywords: |
13 | 15 | - XS |
14 | 16 | - 'XS extensions' |
24 | 26 | - inc |
25 | 27 | package: |
26 | 28 | - ExtUtils::MM |
29 | requires: | |
30 | Data::Dumper: 0 | |
31 | File::Spec: 0 | |
32 | IO::File: 0 | |
33 | perl: 5.006 | |
27 | 34 | resources: |
35 | MailingList: https://mail.gnome.org/mailman/listinfo/gtk-perl-list | |
28 | 36 | bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=ExtUtils-Depends |
29 | 37 | homepage: http://gtk2-perl.sourceforge.net |
30 | 38 | license: http://dev.perl.org/licenses/ |
31 | 39 | repository: git://git.gnome.org/perl-ExtUtils-Depends |
32 | x_MailingList: https://mail.gnome.org/mailman/listinfo/gtk-perl-list | |
33 | version: 0.306 | |
40 | version: 0.307 |
42 | 42 | into the data structures required by ExtUtils::MakeMaker's WriteMakefile |
43 | 43 | function. |
44 | 44 | |
45 | For information on how to make your module fit into this scheme, see | |
46 | "hashref = ExtUtils::Depends::load (name)". | |
47 | ||
45 | 48 | When creating a new Depends object, you give it a name, which is the |
46 | 49 | name of the module you are building. You can also specify the names of |
47 | 50 | modules on which this module depends. These dependencies will be loaded |
148 | 151 | exist when loading files created by old versions of |
149 | 152 | ExtUtils::Depends. |
150 | 153 | |
154 | If you want to make module *name* support this, you must provide a | |
155 | module *name*::Install::Files, which on loading will provide the | |
156 | following package variables: @typemaps, $inc, $libs, $deps, with the | |
157 | same contents as above (not coincidentally). The "load" function | |
158 | will supply the "instpath". An easy way to achieve this is to use | |
159 | the method "$depends->save_config ($filename)", but your package may | |
160 | have different facilities already. | |
161 | ||
151 | 162 | $depends->load_deps |
152 | 163 | Load *$depends* dependencies, by calling "load" on each dependency |
153 | 164 | module. This is usually done for you, and should only be needed if |
10 | 10 | use File::Spec; |
11 | 11 | use Data::Dumper; |
12 | 12 | |
13 | our $VERSION = '0.306'; | |
13 | our $VERSION = '0.307'; | |
14 | 14 | |
15 | 15 | sub import { |
16 | 16 | my $class = shift; |
111 | 111 | |
112 | 112 | sub save_config { |
113 | 113 | use Data::Dumper; |
114 | local $Data::Dumper::Terse = 0; | |
114 | 115 | use IO::File; |
115 | 116 | |
116 | 117 | my ($self, $filename) = @_; |
119 | 120 | or croak "can't open '$filename' for writing: $!\n"; |
120 | 121 | |
121 | 122 | print $file "package $self->{name}\::Install::Files;\n\n"; |
122 | # for modern stuff | |
123 | 123 | print $file "".Data::Dumper->Dump([{ |
124 | 124 | inc => join (" ", @{ $self->{inc} }), |
125 | 125 | libs => $self->{libs}, |
126 | 126 | typemaps => [ map { basename $_ } @{ $self->{typemaps} } ], |
127 | 127 | deps => [keys %{ $self->{deps} }], |
128 | 128 | }], ['self']); |
129 | # for ancient stuff | |
130 | print $file "\n\n# this is for backwards compatiblity\n"; | |
131 | print $file "\@deps = \@{ \$self->{deps} };\n"; | |
129 | print $file "\n\n\@deps = \@{ \$self->{deps} };\n"; | |
132 | 130 | print $file "\@typemaps = \@{ \$self->{typemaps} };\n"; |
133 | 131 | print $file "\$libs = \$self->{libs};\n"; |
134 | 132 | print $file "\$inc = \$self->{inc};\n"; |
413 | 411 | into the data structures required by ExtUtils::MakeMaker's WriteMakefile |
414 | 412 | function. |
415 | 413 | |
414 | For information on how to make your module fit into this scheme, see | |
415 | L</"hashref = ExtUtils::Depends::load (name)">. | |
416 | ||
416 | 417 | When creating a new Depends object, you give it a name, which is the name |
417 | 418 | of the module you are building. You can also specify the names of modules |
418 | 419 | on which this module depends. These dependencies will be loaded |
545 | 546 | |
546 | 547 | =back |
547 | 548 | |
549 | If you want to make module I<name> support this, you must provide | |
550 | a module I<name>::Install::Files, which on loading will provide the | |
551 | following package variables: C<@typemaps>, C<$inc>, C<$libs>, C<$deps>, | |
552 | with the same contents as above (not coincidentally). The C<load> | |
553 | function will supply the C<instpath>. An easy way to achieve this is | |
554 | to use the method L</"$depends-E<gt>save_config ($filename)">, but your | |
555 | package may have different facilities already. | |
556 | ||
548 | 557 | =item $depends->load_deps |
549 | 558 | |
550 | 559 | Load I<$depends> dependencies, by calling C<load> on each dependency module. |
1 | 1 | use strict; |
2 | 2 | use warnings; |
3 | 3 | |
4 | use Test::More tests => 24; | |
4 | use Test::More tests => 28; | |
5 | 5 | |
6 | 6 | use FindBin; |
7 | 7 | use lib "$FindBin::Bin/lib"; |
39 | 39 | dep-private.h); |
40 | 40 | $dep_info->install (@installed_files); |
41 | 41 | |
42 | use Data::Dumper; | |
43 | $Data::Dumper::Terse = 1; | |
42 | 44 | $dep_info->save_config (catfile $tmp_inc, qw(DepTest Install Files.pm)); |
43 | 45 | |
44 | 46 | # --------------------------------------------------------------------------- # |
74 | 76 | |
75 | 77 | my $install_part = qr|DepTest.Install|; |
76 | 78 | like ($info->{inc}, $install_part); |
77 | ok (-1 != index $info->{inc}, $inc); | |
79 | isnt (index($info->{inc}, $inc), -1); | |
78 | 80 | |
79 | isa_ok ($info->{typemaps}, 'ARRAY'); | |
81 | my @typemaps_expected = map { my $t = $_; $t =~ s#build/##; $t } @typemaps; | |
82 | sub strip_typemap { my $t = $_; $t =~ s#.*DepTest/Install/##; $t } | |
83 | is_deeply ( | |
84 | [ map { strip_typemap($_) } @{$info->{typemaps}} ], | |
85 | \@typemaps_expected, | |
86 | 'check typemaps actually saved/loaded' | |
87 | ); | |
80 | 88 | |
81 | 89 | like ($info->{instpath}, $install_part); |
82 | 90 | |
84 | 92 | |
85 | 93 | is ($info->{libs}, $libs); |
86 | 94 | |
95 | # now check package vars are set, per the ::load doc! | |
96 | { | |
97 | no warnings qw(once); | |
98 | is ($DepTest::Install::Files::inc, $inc); | |
99 | is_deeply ( | |
100 | [ map { strip_typemap($_) } @DepTest::Install::Files::typemaps ], | |
101 | \@typemaps_expected, | |
102 | 'api check typemaps' | |
103 | ); | |
104 | is_deeply (\@DepTest::Install::Files::deps, []); | |
105 | is ($DepTest::Install::Files::libs, $libs); | |
106 | } | |
107 | ||
87 | 108 | # --------------------------------------------------------------------------- # |