Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make panda work on windows. szabgab++ for supplying a windows machine
  • Loading branch information
Tadeusz Sośnierz committed Aug 18, 2012
1 parent 9c4e4cf commit 1d9a80a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 10 deletions.
5 changes: 5 additions & 0 deletions bootstrap.pl
Expand Up @@ -6,6 +6,11 @@
mkdir "$home/.panda" unless "$home/.panda".IO.d;
my $projects = slurp 'projects.json.bootstrap';
$projects ~~ s:g/_BASEDIR_/{cwd}\/ext/;

if $*OS eq 'MSWin32' {
$projects.=subst('\\', '/', :g);
}

given open "$home/.panda/projects.json", :w {
.say: $projects;
.close;
Expand Down
2 changes: 1 addition & 1 deletion lib/Panda/Installer.pm
Expand Up @@ -26,7 +26,7 @@ class Panda::Installer does Pies::Installer {
for find(dir => 'bin', type => 'file').list -> $bin {
mkpath "$!destdir/{$bin.dir}";
$bin.IO.copy("$!destdir/$bin");
"$!destdir/$bin".IO.chmod(0o755);
"$!destdir/$bin".IO.chmod(0o755) unless $*OS eq 'MSWin32';
}
}
if 'doc'.IO ~~ :d {
Expand Down
10 changes: 6 additions & 4 deletions rebootstrap.pl
@@ -1,13 +1,16 @@
#!/usr/bin/env perl6
use v6;
use lib 'ext/File__Tools/lib';
use Shell::Command;

# Find old state file
my $home = $*OS eq 'MSWin32' ?? %*ENV<HOMEDRIVE> ~ %*ENV<HOMEPATH> !! %*ENV<HOME>;
my $state-file = "$home/.panda/state";

if not $state-file.IO.e {
say "No need to rebootstrap, running normal bootstrap";
run 'perl6 bootstrap.pl';
shell 'perl6 bootstrap.pl';
exit 0;
}

# Save a copy of the old state file to be written *after* bootstrapping again
Expand All @@ -29,9 +32,8 @@

# Clean old directories, boostrap a fresh panda,
# and reinstall all manually-installed modules
# TODO: Make me cross-platform
shell 'rm -rf ~/.perl6/lib';
shell 'rm -rf ~/.panda';
rm_rf "$home/.perl6/lib";
rm_rf "$home/.panda";
shell 'perl6 bootstrap.pl';
shell "panda install @modules[]";

Expand Down
3 changes: 2 additions & 1 deletion t/panda/builder.t
@@ -1,6 +1,7 @@
use Test;
use Panda::Builder;
use Panda::Resources;
use Shell::Command;

plan 5;

Expand All @@ -19,6 +20,6 @@ ok "$srcdir/dummymodule/blib/lib/foo.pm".IO ~~ :f, 'and opied to blib';
ok "$srcdir/dummymodule/blib/lib/manual.pod".IO ~~ :f, 'pod copied too';
ok "$srcdir/dummymodule/blib/lib/bar.pir".IO !~~ :f, 'pod not compiled';

shell "rm -rf $srcdir/dummymodule/blib";
rm_rf "$srcdir/dummymodule/blib";

# vim: ft=perl6
4 changes: 2 additions & 2 deletions t/panda/ecosystem.t
Expand Up @@ -4,7 +4,7 @@ plan 10;

't/panda/fakestate'.IO.copy('REMOVEME');
my $a = Panda::Ecosystem.new(
statefile => 'REMOVEME',
statefile => "{cwd}/REMOVEME",
projectsfile => 't/panda/fakeprojects'
) but role {
method flush-states { }
Expand All @@ -31,6 +31,6 @@ is $b.dependencies[0], 'some', 'dependencies 1';
is $b.dependencies[1], 'thing', 'dependencies 2';
is $b.dependencies[2], 'else', 'dependencies 3';

unlink 'REMOVEME';
unlink "{cwd}/REMOVEME";

# vim: ft=perl6
3 changes: 2 additions & 1 deletion t/panda/fetcher.t
@@ -1,6 +1,7 @@
use Test;
use Panda::Fetcher;
use Panda::Resources;
use Shell::Command;

plan 4;

Expand Down Expand Up @@ -30,6 +31,6 @@ $p.metainfo<source-url> = 'testmodules/dummymodule';
lives_ok { $f.fetch($p) }, 'can fetch a local project';
ok "$srcdir/foobar/lib/foo.pm".IO ~~ :f, 'fetch ok';

shell "rm -r $srcdir";
rm_rf $srcdir;

# vim: ft=perl6
3 changes: 2 additions & 1 deletion t/panda/installer.t
@@ -1,6 +1,7 @@
use Test;
use Panda::Installer;
use Panda::Resources;
use Shell::Command;

plan 7;

Expand All @@ -27,6 +28,6 @@ file_exists_ok "$destdir/compiled/module/doc/foofile",
file_exists_ok "$destdir/compiled/module/doc/bardir/barfile",
'docs installed 2';

shell "rm -rf $destdir";
rm_rf $destdir;

# vim: ft=perl6

0 comments on commit 1d9a80a

Please sign in to comment.