Permalink
Browse files

Fix the bin/opypy-osh entry point, and add a demo.

scripts/opy.sh opypy-demo
  • Loading branch information...
Andy Chu
Andy Chu committed Apr 8, 2018
1 parent 68f403c commit 94749beb4c486b54e23c7b882052ede953a7815a
Showing with 23 additions and 3 deletions.
  1. +1 −2 bin/opypy-osh
  2. +4 −1 opy/opy_main.py
  3. +18 −0 scripts/opy.sh
View
@@ -7,5 +7,4 @@ readonly OIL_DIR=$THIS_DIR/..
# Don't need PYTHONPATH because oil.py sets it
#export PYTHONPATH=$OIL_DIR/opy/_tmp/osh-opy
$OIL_DIR/opy/opy_main.py $OIL_DIR/opy/py27.grammar run \
$OIL_DIR/opy/_tmp/osh-opy/bin/oil.pyc osh "$@"
$OIL_DIR/bin/opyc run $OIL_DIR/opy/_tmp/oil-opy/bin/oil.pyc osh "$@"
View
@@ -111,6 +111,9 @@ def Options():
p = optparse.OptionParser()
# NOTE: default command is None because empty string is valid.
# NOTE: In 'opy run oil.pyc -c', -c is an arg to opy, and not a flag.
p.add_option(
'-c', dest='command', default=None,
help='Python command to run')
@@ -127,7 +130,7 @@ def OpyCommandMain(argv):
"""Dispatch to the right action."""
# TODO: Use core/args.
opts, argv = Options().parse_args(argv)
#opts, argv = Options().parse_args(argv)
try:
action = argv[0]
View
@@ -0,0 +1,18 @@
#!/bin/bash
#
# Usage:
# ./opy.sh <function name>
set -o nounset
set -o pipefail
set -o errexit
# Show the difference between OSH running under CPython and OSH running under
# byterun.
opypy-demo() {
local prog='for i in $(seq 10); do echo $i; done'
time bin/osh -c "$prog"
time bin/opypy-osh -c "$prog"
}
"$@"

0 comments on commit 94749be

Please sign in to comment.