~ubuntu-branches/ubuntu/karmic/pypy/karmic

« back to all changes in this revision

Viewing changes to pypy/bin/jscompile.py

  • Committer: Bazaar Package Importer
  • Author(s): Alexandre Fayolle
  • Date: 2007-04-13 09:33:09 UTC
  • Revision ID: james.westby@ubuntu.com-20070413093309-yoojh4jcoocu2krz
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
""" RPython to javascript compiler
 
3
Usage: jscompile module_to_compile [list of functions to export]
 
4
 
 
5
- or -
 
6
jscompile --help to show list of options
 
7
"""
 
8
 
 
9
import autopath
 
10
import sys, os
 
11
 
 
12
from pypy.translator.js.main import rpython2javascript_main, js_optiondescr
 
13
 
 
14
from pypy.config.config import Config, to_optparse
 
15
 
 
16
def process_options():
 
17
    jsconfig = Config(js_optiondescr)
 
18
    parser = to_optparse(jsconfig, parserkwargs={"usage": __doc__})
 
19
    parser.disable_interspersed_args()
 
20
    options, args = parser.parse_args()
 
21
    return args, jsconfig
 
22
 
 
23
if __name__ == '__main__':
 
24
    args, jsconfig = process_options()
 
25
    curdir = os.getcwd()
 
26
    if curdir not in sys.path:
 
27
        sys.path.insert(0, curdir)
 
28
    rpython2javascript_main(args, jsconfig)