pynie / setup.pir

#! /usr/local/bin/parrot
# Copyright (C) 2009, Parrot Foundation.

=head1 NAME

setup.pir - Python distutils style

=head1 DESCRIPTION

No Configure step, no Makefile generated.

See F<runtime/parrot/library/distutils.pir>.

=head1 USAGE

    $ parrot setup.pir build
    $ parrot setup.pir test
    $ sudo parrot setup.pir install
    $ parrot setup.pir sdist --version 0.1
    $ parrot setup.pir bdist --version 0.1 --release 1
    $ parrot setup.pir clean

=cut

.sub 'main' :main
    .param pmc args
    $S0 = shift args
    load_bytecode 'distutils.pbc'

    .const 'Sub' prebuild = 'prebuild'
    register_step_before('build', prebuild)

    .const 'Sub' clean = 'clean'
    register_step_before('clean', clean)

    .const 'Sub' runtests = 'runtests'
    register_step('test', runtests)

    $P0 = new 'Hash'
    $P0['name'] = 'pynie'
    $P0['abstract'] = 'A Python implementation targeting the Parrot VM'
    $P0['authority'] = 'http://code.google.com/u/allisonrandal/'
    $P0['description'] = 'Pynie is an implementation of the Python 2.5 specification that runs on the Parrot virtual machine.'
    $P1 = split ',', 'python'
    $P0['keywords'] = $P1
    $P0['license_type'] = 'Artistic License 2.0'
    $P0['license_uri'] = 'http://www.perlfoundation.org/artistic_license_2_0'
    $P0['copyright_holder'] = 'Parrot Foundation'
    $P0['checkout_uri'] = 'http://pynie.googlecode.com/svn/trunk'
    $P0['browser_uri'] = 'http://code.google.com/p/pynie/source/browse/'
    $P0['project_uri'] = 'http://code.google.com/p/pynie/'

    # build
    $P2 = new 'Hash'
    $P2['include/gen_grammar.pir'] = 'Grammar/Grammar.pg'
    $P0['pir_pge'] = $P2

    $P3 = new 'Hash'
    $P3['include/gen_actions.pir'] = 'Grammar/Actions.nqp'
    $P0['pir_nqp'] = $P3
    $P0['pir_nqp_flags'] = '--encoding=fixed_8'

    $P4 = new 'Hash'
    $P5 = split "\n", <<'SOURCES'
pynie.pir
include/gen_grammar.pir
include/gen_actions.pir
src/parser/indent.pir
include/gen_builtins.pir
SOURCES
    $S0 = pop $P5
    $P4['pynie.pbc'] = $P5
    $P0['pbc_pir'] = $P4

    $P6 = new 'Hash'
    $P6['parrot-pynie'] = 'pynie.pbc'
    $P0['exe_pbc'] = $P6
    $P0['installable_pbc'] = $P6

    # dist
    $P7 = glob('src/builtins/*.pir src/classes/*.pir runtest.py examples/*.py Lib/test/bootstrap/*.py subunit/*.py')
    $P0['manifest_includes'] = $P7
    $P0['manifest_excludes'] = 'include/gen_builtins.pir'
    $P8 = split ' ', 'CREDITS ChangeLog MAINTAINER README'
    $P0['doc_files'] = $P8

    .tailcall setup(args :flat, $P0 :flat :named)
.end

.sub 'prebuild' :anon
    .param pmc kv :slurpy :named
    mkpath('include', 1 :named('verbose'))
    $P0 = split "\n", <<'SOURCES'
src/builtins/funcs.pir
src/builtins/helper.pir
src/builtins/io.pir
src/builtins/lists.pir
src/builtins/oper.pir
src/classes/pynietype.pir
src/classes/pynielist.pir
src/classes/pyniestr.pir
SOURCES
    $S0 = pop $P0
    $I0 = newer('include/gen_builtins.pir', $P0)
    if $I0 goto L1
    $S0 = "# generated by setup.pir\n\n.include '"
    $S1 = join "'\n.include '", $P0
    $S0 .= $S1
    $S0 .= "'\n\n"
    spew('include/gen_builtins.pir', $S0, 1 :named('verbose'))
  L1:
.end

.sub 'clean' :anon
    .param pmc kv :slurpy :named
    unlink('include/gen_builtins.pir', 1 :named('verbose'))
.end

.sub 'runtests' :anon
    .param pmc kv :slurpy :named
    run_step('build', kv :flat :named)

    system("python runtests.py", 1 :named('verbose'))
.end

# Local Variables:
#   mode: pir
#   fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.