Skip to content

Commit f11f02f

Browse files
committed
Merge pull request #9 from awwaiid/resources-lib
Further use of RESOURCES Thank you very much! I'd have copied just the same :)
2 parents 22b5fc9 + 18f0c88 commit f11f02f

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

Build.pm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ class Build is Panda::Builder {
1010
}
1111

1212
method build($dir) {
13-
mkdir "$dir/resources" unless "$dir/resources".IO.e;
14-
1513
my %vars = get-vars($dir);
1614
%vars<INCLUDEPY> = get_config_var('INCLUDEPY');
1715
my $library = get_config_var('LIBRARY');
1816
$library ~~ s/\.a$//;
1917
$library ~~ s/^lib//;
2018
%vars<LIBRARYPY> = $library;
2119
%vars<LIBPLPY> = get_config_var('LIBPL');
22-
process-makefile($dir, %vars);
20+
%vars<pyhelper> = $*VM.platform-library-name('pyhelper'.IO);
21+
mkdir "$dir/resources" unless "$dir/resources".IO.e;
22+
mkdir "$dir/resources/libraries" unless "$dir/resources/libraries".IO.e;
23+
process-makefile('.', %vars);
2324

2425
my $goback = $*CWD;
2526
chdir($dir);

META.info

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name" : "Inline::Python",
3-
"version" : "*",
3+
"version" : "0.1",
44
"author" : "github:niner",
55
"description" : "Use Python code and libraries in a Perl 6 program",
66
"depends" : [ "LibraryMake" ],
77
"provides" : {
88
"Inline::Python" : "lib/Inline/Python.pm6"
99
},
10+
"resources" : [ "libraries/pyhelper" ],
1011
"source-url" : "git://github.com/niner/Inline-Python.git"
1112
}

Makefile.in

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
.PHONY: clean test
2-
all: %DESTDIR%/resources/pyhelper%SO%
2+
3+
all: %DESTDIR%/resources/libraries/%pyhelper%
4+
35
clean:
4-
rm %DESTDIR%/resources/pyhelper%SO%
5-
%DESTDIR%/resources/pyhelper%SO%: pyhelper.c
6-
%CC% pyhelper.c -Wall -I"%INCLUDEPY%" -L"%LIBPLPY%" -l%LIBRARYPY% -shared -o %DESTDIR%/resources/pyhelper%SO% %CCSHARED% -g
6+
rm %DESTDIR%/resources/libraries/%pyhelper%
7+
8+
%DESTDIR%/resources/libraries/%pyhelper%: pyhelper.c
9+
%CC% pyhelper.c -Wall -I"%INCLUDEPY%" -L"%LIBPLPY%" -l%LIBRARYPY% -shared -o %DESTDIR%/resources/libraries/%pyhelper% %CCSHARED% -g
10+
711
test: all
812
prove -e 'perl6 -Ilib' t

configure.pl6

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ $library ~~ s/\.a$//;
1313
$library ~~ s/^lib//;
1414
%vars<LIBRARYPY> = $library;
1515
%vars<LIBPLPY> = get_config_var('LIBPL');
16+
%vars<pyhelper> = $*VM.platform-library-name('pyhelper'.IO);
1617
mkdir 'resources' unless 'resources'.IO.e;
18+
mkdir 'resources/libraries' unless 'resources/libraries'.IO.e;
1719
process-makefile('.', %vars);
1820
shell(%vars<MAKE>);
1921

lib/Inline/Python.pm6

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@ has &!call_method;
88
use NativeCall;
99

1010
sub native(Sub $sub) {
11-
my $so = $*VM.config<dll>;
12-
$so ~~ s!^.*\%s!pyhelper!;
13-
14-
my Str $path = %?RESOURCES{$so}.Str;
11+
my Str $path = %?RESOURCES<libraries/pyhelper>.Str;
1512
unless $path {
16-
die "unable to find $so";
13+
die "unable to find pyhelper library";
1714
}
1815
trait_mod:<is>($sub, :native($path));
1916
}

0 commit comments

Comments
 (0)