[svn:parrot] r45156 - trunk/runtime/parrot/library

fperrad at svn.parrot.org fperrad at svn.parrot.org
Wed Mar 24 16:56:15 UTC 2010


Author: fperrad
Date: Wed Mar 24 16:56:13 2010
New Revision: 45156
URL: https://trac.parrot.org/parrot/changeset/45156

Log:
[distutils] add item inc_pir
generation of a pir file which includes many others

Modified:
   trunk/runtime/parrot/library/distutils.pir

Modified: trunk/runtime/parrot/library/distutils.pir
==============================================================================
--- trunk/runtime/parrot/library/distutils.pir	Wed Mar 24 16:23:48 2010	(r45155)
+++ trunk/runtime/parrot/library/distutils.pir	Wed Mar 24 16:56:13 2010	(r45156)
@@ -214,6 +214,8 @@
     register_step_after('build', _build_pir_nqp)
     .const 'Sub' _build_pir_nqp_rx = '_build_pir_nqp_rx'
     register_step_after('build', _build_pir_nqp_rx)
+    .const 'Sub' _build_inc_pir = '_build_inc_pir'
+    register_step_after('build', _build_inc_pir)
     .const 'Sub' _build_pir_pir = '_build_pir_pir'
     register_step_after('build', _build_pir_pir)
     .const 'Sub' _build_pbc_pir = '_build_pbc_pir'
@@ -239,6 +241,8 @@
     register_step_after('clean', _clean_pir_nqp)
     .const 'Sub' _clean_pir_nqp_rx = '_clean_pir_nqp_rx'
     register_step_after('clean', _clean_pir_nqp_rx)
+    .const 'Sub' _clean_inc_pir = '_clean_inc_pir'
+    register_step_after('clean', _clean_inc_pir)
     .const 'Sub' _clean_pir_pir = '_clean_pir_pir'
     register_step_after('clean', _clean_pir_pir)
     .const 'Sub' _clean_pbc_pir = '_clean_pbc_pir'
@@ -807,6 +811,47 @@
     .tailcall run_jobs(jobs)
 .end
 
+=item inc_pir (include)
+
+hash
+
+the key is the PIR pathname
+
+the value is an array of PIR pathname
+
+=cut
+
+.sub '_build_inc_pir' :anon
+    .param pmc kv :slurpy :named
+    $I0 = exists kv['inc_pir']
+    unless $I0 goto L1
+    $P0 = kv['inc_pir']
+    build_inc_pir($P0)
+  L1:
+.end
+
+.sub 'build_inc_pir'
+    .param pmc hash
+    $P0 = iter hash
+  L1:
+    unless $P0 goto L2
+    .local string inc
+    inc = shift $P0
+    .local pmc srcs
+    srcs = hash[inc]
+    $I0 = newer(inc, srcs)
+    if $I0 goto L1
+    $S0 = dirname(inc)
+    mkpath($S0, 1 :named('verbose'))
+    $S0 = "# generated by distutils\n\n.include '"
+    $S1 = join "'\n.include '", srcs
+    $S0 .= $S1
+    $S0 .= "'\n\n"
+    spew(inc, $S0, 1 :named('verbose'))
+    goto L1
+  L2:
+.end
+
 =item pir_pir (concat)
 
 hash
@@ -831,7 +876,7 @@
     $P0 = iter hash
   L1:
     unless $P0 goto L2
-    .local string pir, src
+    .local string pir
     pir = shift $P0
     .local pmc srcs
     srcs = hash[pir]
@@ -1562,6 +1607,19 @@
   L2:
 .end
 
+=item inc_pir
+
+=cut
+
+.sub '_clean_inc_pir' :anon
+    .param pmc kv :slurpy :named
+    $I0 = exists kv['inc_pir']
+    unless $I0 goto L1
+    $P0 = kv['inc_pir']
+    clean_key($P0)
+  L1:
+.end
+
 =item pir_pir
 
 =cut
@@ -2824,7 +2882,7 @@
 
 array of pathname or a single pathname
 
-=item pbc_pir, pir_pge, pir_tge, pir_nqp, pir_nqp-rx, pir_nqprx, pir_pir
+=item pbc_pir, pir_pge, pir_tge, pir_nqp, pir_nqp-rx, pir_nqprx, inc_pir, pir_pir
 pbc_pbc, exe_pbc, installable_pbc, dynops, dynpmc, html_pod
 
 =item inst_bin, inst_data, inst_dynext, inst_inc, inst_lang, inst_lib
@@ -2860,7 +2918,7 @@
     needed = new 'Hash'
     generated = new 'Hash'
 
-    $P0 = split ' ', 'pbc_pir pir_pge pir_tge pir_nqp pir_nqp-rx pir_nqprx pir_pir pbc_pbc exe_pbc installable_pbc dynops dynpmc html_pod'
+    $P0 = split ' ', 'pbc_pir pir_pge pir_tge pir_nqp pir_nqp-rx pir_nqprx inc_pir pir_pir pbc_pbc exe_pbc installable_pbc dynops dynpmc html_pod'
   L1:
     unless $P0 goto L2
     $S0 = shift $P0


More information about the parrot-commits mailing list