[svn:parrot] r42838 - trunk/runtime/parrot/library
fperrad at svn.parrot.org
fperrad at svn.parrot.org
Tue Dec 1 20:49:09 UTC 2009
Author: fperrad
Date: Tue Dec 1 20:49:06 2009
New Revision: 42838
URL: https://trac.parrot.org/parrot/changeset/42838
Log:
[distutils] modify the semantic of manifest_includes & manifest_excludes
Modified:
trunk/runtime/parrot/library/distutils.pir
Modified: trunk/runtime/parrot/library/distutils.pir
==============================================================================
--- trunk/runtime/parrot/library/distutils.pir Tue Dec 1 18:20:11 2009 (r42837)
+++ trunk/runtime/parrot/library/distutils.pir Tue Dec 1 20:49:06 2009 (r42838)
@@ -2340,11 +2340,11 @@
=item manifest_includes
-array of pathname or a single pathname
+string with pathname or pattern separated by space
=item manifest_excludes
-array of pathname or a single pathname
+string with pathname or pattern separated by space
=item pbc_pir
@@ -2453,16 +2453,25 @@
$I0 = exists kv['manifest_includes']
unless $I0 goto L13
- $P1 = kv['manifest_includes']
- _manifest_add_array(needed, $P1)
+ $S1 = kv['manifest_includes']
+ _manifest_add_glob(needed, $S1)
L13:
+ generated = new 'Hash'
$I0 = exists kv['manifest_excludes']
unless $I0 goto L14
- $P1 = kv['manifest_excludes']
- _manifest_del_array(needed, $P1)
+ $S1 = kv['manifest_excludes']
+ _manifest_add_glob(generated, $S1)
L14:
+ $P0 = iter generated
+ L15:
+ unless $P0 goto L16
+ $S0 = shift $P0
+ delete needed[$S0]
+ goto L15
+ L16:
+
$P1 = iter needed
$I0 = elements $P1
inc $I0
@@ -2528,23 +2537,6 @@
L3:
.end
-.sub '_manifest_del_array' :anon
- .param pmc needed
- .param pmc array
- $I0 = does array, 'array'
- unless $I0 goto L1
- $P0 = iter array
- L2:
- unless $P0 goto L3
- $S0 = shift $P0
- delete needed[$S0]
- goto L2
- L1:
- $S0 = array
- delete needed[$S0]
- L3:
-.end
-
.sub '_manifest_add_glob' :anon
.param pmc needed
.param string str
@@ -2552,21 +2544,12 @@
L1:
unless $P0 goto L2
$S0 = shift $P0
- .local string cmd #
- cmd = 'perl -e "for (<' . $S0 # refactoring needed
- cmd .= '>) { print; print qq{\n};}"'# without perl
- $P1 = open cmd, 'rp' #
+ $P1 = glob($S0)
L3:
- $S0 = $P1.'readline'()
- if $S0 == '' goto L4
- $I0 = length $S0
- dec $I0
- $S0 = substr $S0, 0, $I0
- needed[$S0] = 1
+ unless $P1 goto L1
+ $S1 = shift $P1
+ needed[$S1] = 1
goto L3
- L4:
- $P1.'close'()
- goto L1
L2:
.end
@@ -3462,6 +3445,47 @@
$P0.'chdir'(dirname)
.end
+=item chomp
+
+=cut
+
+.include 'cclass.pasm'
+
+.sub 'chomp'
+ .param string str
+ $I0 = index str, "\r"
+ if $I0 < 0 goto L1
+ str = substr str, 0, $I0
+ L1:
+ $I1 = index str, "\n"
+ if $I1 < 0 goto L2
+ str = substr str, 0, $I1
+ L2:
+ .return (str)
+.end
+
+=item glob
+
+=cut
+
+.sub 'glob'
+ .param string pattern
+ $P0 = new 'ResizableStringArray'
+ .local string cmd #
+ cmd = 'perl -e "for (<' . pattern # refactoring needed
+ cmd .= '>) { print; print qq{\n};}"'# without perl
+ $P1 = open cmd, 'rp' #
+ L1:
+ $S0 = $P1.'readline'()
+ if $S0 == '' goto L2
+ $S0 = chomp($S0)
+ push $P0, $S0
+ goto L1
+ L2:
+ $P1.'close'()
+ .return ($P0)
+.end
+
=item getenv
=cut
More information about the parrot-commits
mailing list