[svn:languages] r91 - in lolcode/trunk: . config src src/builtins t
fperrad at svn.parrot.org
fperrad at svn.parrot.org
Sun Nov 22 16:57:43 UTC 2009
Author: fperrad
Date: Sun Nov 22 16:57:42 2009
New Revision: 91
URL: https://trac.parrot.org/languages/changeset/91
Log:
[lolcode] modernize infrastructure with setup.pir (distutils)
Added:
lolcode/trunk/setup.pir (contents, props changed)
lolcode/trunk/src/builtins.pir (contents, props changed)
Deleted:
lolcode/trunk/Configure.pl
lolcode/trunk/config/
lolcode/trunk/t/harness
Modified:
lolcode/trunk/ (props changed)
lolcode/trunk/lolcode.pir
lolcode/trunk/src/ (props changed)
lolcode/trunk/src/builtins/cmp.pir
lolcode/trunk/src/builtins/math.pir
Deleted: lolcode/trunk/Configure.pl
==============================================================================
--- lolcode/trunk/Configure.pl Sun Nov 22 16:57:42 2009 (r90)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,66 +0,0 @@
-# Copyright (C) 2009, Parrot Foundation.
-# $Id$
-
-use strict;
-use warnings;
-use 5.008;
-
-# Get a list of parrot-configs to invoke.
-my @parrot_config_exe = (
- 'parrot/parrot_config',
- '../../parrot_config',
- 'parrot_config',
-);
-
-# Get configuration information from parrot_config
-my %config = read_parrot_config(@parrot_config_exe);
-unless (%config) {
- die "Unable to locate parrot_config.";
-}
-
-# Create the Makefile using the information we just got
-create_makefiles(%config);
-
-sub read_parrot_config {
- my @parrot_config_exe = @_;
- my %config = ();
- for my $exe (@parrot_config_exe) {
- no warnings;
- if (open my $PARROT_CONFIG, '-|', "$exe --dump") {
- print "Reading configuration information from $exe\n";
- while (<$PARROT_CONFIG>) {
- $config{$1} = $2 if (/(\w+) => '(.*)'/);
- }
- close $PARROT_CONFIG;
- last if %config;
- }
- }
- %config;
-}
-
-
-# Generate Makefiles from a configuration
-sub create_makefiles {
- my %config = @_;
- my %makefiles = (
- 'config/makefiles/root.in' => 'Makefile',
-# 'config/makefiles/pmc.in' => 'src/pmc/Makefile',
-# 'config/makefiles/ops.in' => 'src/ops/Makefile',
- );
- my $build_tool = $config{libdir} . $config{versiondir}
- . '/tools/dev/gen_makefile.pl';
-
- foreach my $template (keys %makefiles) {
- my $makefile = $makefiles{$template};
- print "Creating $makefile\n";
- system($config{perl}, $build_tool, $template, $makefile);
- }
-}
-
-# Local Variables:
-# mode: cperl
-# cperl-indent-level: 4
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:
-
Modified: lolcode/trunk/lolcode.pir
==============================================================================
--- lolcode/trunk/lolcode.pir Sun Nov 22 16:12:06 2009 (r90)
+++ lolcode/trunk/lolcode.pir Sun Nov 22 16:57:42 2009 (r91)
@@ -25,8 +25,6 @@
.namespace [ 'lolcode';'Compiler' ]
-.loadlib 'lolcode_group'
-
.sub '' :anon :load :init
load_bytecode 'PCT.pbc'
.local pmc parrotns, lolns, exports
@@ -36,7 +34,7 @@
parrotns.'export_to'(lolns, exports)
.end
-.include 'src/gen_builtins.pir'
+.include 'src/builtins.pir'
.include 'src/gen_grammar.pir'
.include 'src/parser/yarn_literal.pir'
.include 'src/gen_actions.pir'
Added: lolcode/trunk/setup.pir
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ lolcode/trunk/setup.pir Sun Nov 22 16:57:42 2009 (r91)
@@ -0,0 +1,78 @@
+#! /usr/local/bin/parrot
+# Copyright (C) 2009, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+setup.pir - Python distutils style
+
+=head1 DESCRIPTION
+
+No Configure step, no Makefile generated.
+
+=head1 USAGE
+
+ $ parrot setup.pir build
+ $ parrot setup.pir test
+ $ sudo parrot setup.pir install
+
+=cut
+
+.sub 'main' :main
+ .param pmc args
+ $S0 = shift args
+ load_bytecode 'distutils.pbc'
+
+ $P0 = new 'Hash'
+ $P0['name'] = 'Lolcode'
+ $P0['abstract'] = 'Lolcode'
+ $P0['description'] = 'Lolcode'
+ $P0['license_type'] = 'Artistic License 2.0'
+ $P0['license_uri'] = 'http://www.perlfoundation.org/artistic_license_2_0'
+ $P0['copyright_holder'] = 'Parrot Foundation'
+ $P0['generated_by'] = 'Francois Perrad <francois.perrad at gadz.org>'
+ $P0['checkout_uri'] = 'https://svn.parrot.org/languages/lolcode/trunk'
+ $P0['browser_uri'] = 'https://trac.parrot.org/languages/browser/lolcode'
+ $P0['project_uri'] = 'https://trac.parrot.org/parrot/wiki/Languages'
+
+ # build
+ $P1 = new 'Hash'
+ $P1['src/gen_grammar.pir'] = 'src/parser/grammar.pg'
+ $P0['pir_pge'] = $P1
+
+ $P2 = new 'Hash'
+ $P2['src/gen_actions.pir'] = 'src/parser/actions.pm'
+ $P0['pir_nqp'] = $P2
+
+ $P3 = new 'Hash'
+ $P4 = split "\n", <<'SOURCES'
+lolcode.pir
+src/gen_grammar.pir
+src/parser/yarn_literal.pir
+src/gen_actions.pir
+src/builtins.pir
+src/builtins/cmp.pir
+src/builtins/expr_parse.pir
+src/builtins/math.pir
+src/builtins/say.pir
+SOURCES
+ $P3['lolcode.pbc'] = $P4
+ $P0['pbc_pir'] = $P3
+
+ $P5 = new 'Hash'
+ $P5['parrot-lolcode'] = 'lolcode.pbc'
+ $P0['installable_pbc'] = $P5
+
+ # test
+ $S0 = get_parrot()
+ $S0 .= ' lolcode.pbc'
+ $P0['prove_exec'] = $S0
+
+ .tailcall setup(args :flat, $P0 :flat :named)
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
Added: lolcode/trunk/src/builtins.pir
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ lolcode/trunk/src/builtins.pir Sun Nov 22 16:57:42 2009 (r91)
@@ -0,0 +1,13 @@
+# $Id$
+
+.include 'src/builtins/cmp.pir'
+.include 'src/builtins/expr_parse.pir'
+.include 'src/builtins/math.pir'
+.include 'src/builtins/say.pir'
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+
Modified: lolcode/trunk/src/builtins/cmp.pir
==============================================================================
--- lolcode/trunk/src/builtins/cmp.pir Sun Nov 22 16:12:06 2009 (r90)
+++ lolcode/trunk/src/builtins/cmp.pir Sun Nov 22 16:57:42 2009 (r91)
@@ -1,3 +1,6 @@
+
+.namespace []
+
.sub 'BOTH SAEM'
.param pmc x
.param pmc y
Modified: lolcode/trunk/src/builtins/math.pir
==============================================================================
--- lolcode/trunk/src/builtins/math.pir Sun Nov 22 16:12:06 2009 (r90)
+++ lolcode/trunk/src/builtins/math.pir Sun Nov 22 16:57:42 2009 (r91)
@@ -1,3 +1,6 @@
+
+.namespace []
+
.sub 'SUM OF'
.param pmc x
.param pmc y
Deleted: lolcode/trunk/t/harness
==============================================================================
--- lolcode/trunk/t/harness Sun Nov 22 16:57:42 2009 (r90)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,95 +0,0 @@
-#! perl
-
-# $Id$
-
-use strict;
-use warnings;
-
-use FindBin;
-use File::Spec;
-use Getopt::Long qw(:config pass_through);
-
-$ENV{'HARNESS_PERL'} = './lolcode';
-use Test::Harness;
-$Test::Harness::switches = '';
-
-GetOptions(
- 'tests-from-file=s' => \my $list_file,
- 'verbosity=i' => \$Test::Harness::verbose,
- 'jobs:3' => \my $jobs,
- 'icu:1' => \my $do_icu,
-);
-
-my @pass_through_options = grep m/^--?[^-]/, @ARGV;
-my @files = grep m/^[^-]/, @ARGV;
-
-my $slash = $^O eq 'MSWin32' ? '\\' : '/';
-
-if ($list_file) {
- open(my $f, '<', $list_file)
- or die "Can't open file '$list_file' for reading: $!";
- while (<$f>) {
- next if m/^\s*#/;
- next unless m/\S/;
- chomp;
- my ($fn, $flags) = split /\s+#\s*/;
- next if ($flags && ($flags =~ m/icu/) && !$do_icu);
- $fn = "t/spec/$fn" unless $fn =~ m/^t\Q$slash\Espec\Q$slash\E/;
- $fn =~ s{/}{$slash}g;
- if ( -r $fn ) {
- push @files, $fn;
- }
- else {
- warn "Missing test file: $fn\n";
- }
- }
- close $f or die $!;
-}
-
-my @tfiles = map { all_in($_) } sort @files;
-
-if (eval { require TAP::Harness; 1 }) {
- my %harness_options = (
- exec => ['./lolcode'],
- verbosity => 0+$Test::Harness::verbose,
- jobs => $jobs || 1,
- );
- TAP::Harness->new( \%harness_options )->runtests(@tfiles);
-}
-else {
- runtests(@tfiles);
-}
-
-# adapted to return only files ending in '.t'
-sub all_in {
- my $start = shift;
-
- return $start unless -d $start;
-
- my @skip = ( File::Spec->updir, File::Spec->curdir, qw( .svn CVS .git ) );
- my %skip = map {($_,1)} @skip;
-
- my @hits = ();
-
- if ( opendir( my $dh, $start ) ) {
- my @files = sort readdir $dh;
- closedir $dh or die $!;
- for my $file ( @files ) {
- next if $skip{$file};
-
- my $currfile = File::Spec->catfile( $start, $file );
- if ( -d $currfile ) {
- push( @hits, all_in( $currfile ) );
- }
- else {
- push( @hits, $currfile ) if $currfile =~ /\.t$/;
- }
- }
- }
- else {
- warn "$start: $!\n";
- }
-
- return @hits;
-}
-
More information about the parrot-commits
mailing list