Change 29509 by [EMAIL PROTECTED] on 2006/12/11 13:21:28
First patch from:
Subject: [PATCH] Move Win32::* functions from win32/win32.c to
ext/Win32/Win32.xs
From: Jan Dubois <[EMAIL PROTECTED]>
Date: Fri, 08 Dec 2006 19:07:06 -0800
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/ext/SDBM_File/Makefile.PL#19 edit
... //depot/perl/lib/Cwd.pm#107 edit
... //depot/perl/lib/ExtUtils/MM.pm#8 edit
... //depot/perl/lib/File/CheckTree.t#5 edit
... //depot/perl/lib/File/Copy.pm#43 edit
... //depot/perl/t/op/fork.t#27 edit
... //depot/perl/win32/FindExt.pm#9 edit
... //depot/perl/win32/config_sh.PL#39 edit
... //depot/perl/win32/ext/Win32API/File/t/file.t#2 edit
Differences ...
==== //depot/perl/ext/SDBM_File/Makefile.PL#19 (text) ====
Index: perl/ext/SDBM_File/Makefile.PL
--- perl/ext/SDBM_File/Makefile.PL#18~27250~ 2006-02-20 12:03:37.000000000
-0800
+++ perl/ext/SDBM_File/Makefile.PL 2006-12-11 05:21:28.000000000 -0800
@@ -25,7 +25,7 @@
);
sub MY::postamble {
- if ($^O =~ /MSWin32/ && Win32::IsWin95()) {
+ if ($^O =~ /MSWin32/ && !defined($ENV{SYSTEMROOT})) {
if ($Config{'make'} =~ /dmake/i) {
# dmake-specific
return <<'EOT';
==== //depot/perl/lib/Cwd.pm#107 (text) ====
Index: perl/lib/Cwd.pm
--- perl/lib/Cwd.pm#106~29356~ 2006-11-22 19:09:08.000000000 -0800
+++ perl/lib/Cwd.pm 2006-12-11 05:21:28.000000000 -0800
@@ -660,7 +660,12 @@
}
sub _win32_cwd {
- $ENV{'PWD'} = Win32::GetCwd();
+ if (defined &DynaLoader::boot_DynaLoader) {
+ $ENV{'PWD'} = Win32::GetCwd();
+ }
+ else { # miniperl
+ chomp($ENV{'PWD'} = `cd`);
+ }
$ENV{'PWD'} =~ s:\\:/:g ;
return $ENV{'PWD'};
}
==== //depot/perl/lib/ExtUtils/MM.pm#8 (text) ====
Index: perl/lib/ExtUtils/MM.pm
--- perl/lib/ExtUtils/MM.pm#7~28984~ 2006-10-10 07:33:53.000000000 -0700
+++ perl/lib/ExtUtils/MM.pm 2006-12-11 05:21:28.000000000 -0800
@@ -48,7 +48,13 @@
$Is{OS2} = $^O eq 'os2';
$Is{MacOS} = $^O eq 'MacOS';
if( $^O eq 'MSWin32' ) {
- Win32::IsWin95() ? $Is{Win95} = 1 : $Is{Win32} = 1;
+ if (defined &DynaLoader::boot_DynaLoader) {
+ Win32::IsWin95() ? $Is{Win95} = 1 : $Is{Win32} = 1;
+ }
+ else {
+ # Can't use Win32::* with miniperl
+ !(defined $ENV{SYSTEMROOT}) ? $Is{Win95} = 1 : $Is{Win32} = 1;
+ }
}
$Is{UWIN} = $^O =~ /^uwin(-nt)?$/;
$Is{Cygwin} = $^O eq 'cygwin';
==== //depot/perl/lib/File/CheckTree.t#5 (xtext) ====
Index: perl/lib/File/CheckTree.t
--- perl/lib/File/CheckTree.t#4~15866~ 2002-04-11 11:40:55.000000000 -0700
+++ perl/lib/File/CheckTree.t 2006-12-11 05:21:28.000000000 -0800
@@ -11,6 +11,11 @@
use strict;
+# Cwd::cwd does an implicit "require Win32", but
+# the ../lib directory in @INC will no longer work once
+# we chdir() out of the "t" directory.
+use Win32;
+
use File::CheckTree;
use File::Spec; # used to get absolute paths
==== //depot/perl/lib/File/Copy.pm#43 (text) ====
Index: perl/lib/File/Copy.pm
--- perl/lib/File/Copy.pm#42~28659~ 2006-08-05 08:22:18.000000000 -0700
+++ perl/lib/File/Copy.pm 2006-12-11 05:21:28.000000000 -0800
@@ -258,7 +258,8 @@
# preserve MPE file attributes.
return system('/bin/cp', '-f', $_[0], $_[1]) == 0;
};
- } elsif ($^O eq 'MSWin32') {
+ } elsif ($^O eq 'MSWin32' && defined &DynaLoader::boot_DynaLoader) {
+ # Win32::CopyFile() fill only work if we can load Win32.xs
*syscopy = sub {
return 0 unless @_ == 2;
return Win32::CopyFile(@_, 1);
==== //depot/perl/t/op/fork.t#27 (xtext) ====
Index: perl/t/op/fork.t
--- perl/t/op/fork.t#26~29485~ 2006-12-07 04:34:10.000000000 -0800
+++ perl/t/op/fork.t 2006-12-11 05:21:28.000000000 -0800
@@ -245,6 +245,7 @@
########
$| = 1;
use Cwd;
+my $cwd = cwd(); # Make sure we load Win32.pm while "../lib" still works.
$\ = "\n";
my $dir;
if (fork) {
==== //depot/perl/win32/FindExt.pm#9 (text) ====
Index: perl/win32/FindExt.pm
--- perl/win32/FindExt.pm#8~24399~ 2005-05-05 08:17:23.000000000 -0700
+++ perl/win32/FindExt.pm 2006-12-11 05:21:28.000000000 -0800
@@ -14,9 +14,10 @@
my %static;
sub getcwd {
- $ENV{'PWD'} = Win32::GetCwd();
- $ENV{'PWD'} =~ s:\\:/:g ;
- return $ENV{'PWD'};
+ $_ = `cd`;
+ chomp;
+ s:\\:/:g ;
+ return $ENV{'PWD'} = $_;
}
sub set_static_extensions
==== //depot/perl/win32/config_sh.PL#39 (text) ====
Index: perl/win32/config_sh.PL
--- perl/win32/config_sh.PL#38~29470~ 2006-12-05 08:41:55.000000000 -0800
+++ perl/win32/config_sh.PL 2006-12-11 05:21:28.000000000 -0800
@@ -73,7 +73,8 @@
$opt{'version_patchlevel_string'} = "version $opt{PERL_VERSION} subversion
$opt{PERL_SUBVERSION}";
$opt{'version_patchlevel_string'} .= " patchlevel $opt{PERL_PATCHLEVEL}" if
exists $opt{PERL_PATCHLEVEL};
-$opt{'osvers'} = join '.', (Win32::GetOSVersion())[1,2];
+#$opt{'osvers'} = join '.', (Win32::GetOSVersion())[1,2];
+$opt{'osvers'} = "4.0";
if (exists $opt{cc}) {
# cl and bcc32 version detection borrowed from Test::Smoke's configsmoke.pl
@@ -99,7 +100,7 @@
$opt{incpath} = mungepath($opt{incpath}) if exists $opt{incpath};
# some functions are not available on Win9x
-if (defined(&Win32::IsWin95) && Win32::IsWin95()) {
+unless (defined $ENV{SYSTEMROOT}) { # SystemRoot has been introduced by WinNT
$opt{d_flock} = 'undef';
$opt{d_link} = 'undef';
}
==== //depot/perl/win32/ext/Win32API/File/t/file.t#2 (text) ====
Index: perl/win32/ext/Win32API/File/t/file.t
--- perl/win32/ext/Win32API/File/t/file.t#1~28460~ 2006-06-30
06:46:06.000000000 -0700
+++ perl/win32/ext/Win32API/File/t/file.t 2006-12-11 05:21:28.000000000
-0800
@@ -6,6 +6,12 @@
BEGIN { $|= 1; print "1..267\n"; }
END {print "not ok 1\n" unless $loaded;}
+
+# Win32API::File does an implicit "require Win32", but
+# the ../lib directory in @INC will no longer work once
+# we chdir() into the TEMP directory.
+use Win32;
+
use Win32API::File qw(:ALL);
$loaded = 1;
print "ok 1\n";
End of Patch.