Permalink
Browse files

./smoke.sh compile-osh-tree now finishes.

  • Loading branch information...
Andy Chu
Andy Chu committed Feb 24, 2018
1 parent 69c0a07 commit 14e088c133dd8c9615b6e847a1958b4db5373c1c
Showing with 36 additions and 32 deletions.
  1. +7 −6 native/fastlex_test.py
  2. +5 −4 opy/smoke.sh
  3. +2 −1 tools/deps.py
  4. +22 −21 web/table/csv2html.py
View
@@ -5,6 +5,7 @@
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
from __future__ import print_function
"""
libc_test.py: Tests for libc.py
"""
@@ -39,8 +40,8 @@ class LexTest(unittest.TestCase):
def testMatchToken(self):
print(dir(fastlex))
print MatchToken(lex_mode_e.COMMENT, 'line', 3)
print
print(MatchToken(lex_mode_e.COMMENT, 'line', 3))
print()
# Need to be able to pass NUL bytes for EOF.
line = 'end of line\n'
@@ -49,19 +50,19 @@ def testMatchToken(self):
TokenizeLineOuter(line)
def testOutOfBounds(self):
print MatchToken(lex_mode_e.OUTER, 'line', 3)
print(MatchToken(lex_mode_e.OUTER, 'line', 3))
# It's an error to point to the end of the buffer! Have to be one behind
# it.
return
print MatchToken(lex_mode_e.OUTER, 'line', 4)
print MatchToken(lex_mode_e.OUTER, 'line', 5)
print(MatchToken(lex_mode_e.OUTER, 'line', 4))
print(MatchToken(lex_mode_e.OUTER, 'line', 5))
def testBug(self):
code_str = '-n'
expected = Id.BoolUnary_n
tok_type, end_pos = MatchToken(lex_mode_e.DBRACKET, code_str, 0)
print '---', 'expected', expected.enum_value, 'got', tok_type.enum_value
print('---', 'expected', expected.enum_value, 'got', tok_type.enum_value)
self.assertEqual(expected, tok_type)
View
@@ -81,18 +81,19 @@ _fill-osh-tree() {
ln -v -s -f $PWD/../core/libc.so $dir/core
}
# Hm should we support Python 2 print? It will be useful for converting
# many old files. Otherwise, we need a quick '2to3' alias that only does
# the conversion.
# TODO: This could be part of the Travis build. It will ensure no Python 2
# print statements sneak in.
compile-osh-tree() {
local src=$(cd .. && echo $PWD)
local files=( $(find $src \
-name _tmp -a -prune -o \
-name _chroot -a -prune -o \
-name _devbuild -a -prune -o \
-name _deps -a -prune -o \
-name Python-2.7.13 -a -prune -o \
-name opy -a -prune -o \
-name tests -a -prune -o \
-name 'test' -a -prune -o \
-name '*.py' -a -printf '%P\n') )
_compile-tree $src _tmp/osh-ccompile/ ccompile "${files[@]}"
View
@@ -1,4 +1,5 @@
#!/usr/bin/python
from __future__ import print_function
"""
deps.py
"""
@@ -147,7 +148,7 @@ def Done(self):
# TODO: Use self.Emit(), make it TSV.
for name in self.progs_used:
if name not in self.funcs_defined:
print name
print(name)
def Deps(node):
View
@@ -1,4 +1,5 @@
#!/usr/bin/env python
from __future__ import print_function
"""
csv2html.py
@@ -46,7 +47,7 @@
def log(msg, *args):
if args:
msg = msg % args
print >>sys.stderr, msg
print(msg, file=sys.stderr)
class NullSchema:
@@ -189,9 +190,9 @@ def PrintRow(row, schema):
css_classes.append('na') # make it red
if css_classes:
print ' <td class="{}">'.format(' '.join(css_classes)),
print(' <td class="{}">'.format(' '.join(css_classes)), end=' ')
else:
print ' <td>',
print(' <td>', end=' ')
# Advance to next row if it's an _HREF.
if schema.ColumnIndexHasHref(i):
@@ -201,15 +202,15 @@ def PrintRow(row, schema):
else:
s = cgi.escape(cell_str)
print s,
print '</td>'
print(s, end=' ')
print('</td>')
i += 1
def PrintColGroup(col_names, schema):
"""Print HTML colgroup element, used for JavaScript sorting."""
print ' <colgroup>'
print(' <colgroup>')
for i, col in enumerate(col_names):
if col.endswith('_HREF'):
continue
@@ -221,8 +222,8 @@ def PrintColGroup(col_names, schema):
css_class = 'case-insensitive'
# NOTE: id is a comment only; not used
print ' <col id="{}" type="{}" />'.format(col, css_class)
print ' </colgroup>'
print(' <col id="{}" type="{}" />'.format(col, css_class))
print(' </colgroup>')
def PrintTable(css_id, schema, col_names, rows, css_class_pattern):
@@ -233,21 +234,21 @@ def PrintTable(css_id, schema, col_names, rows, css_class_pattern):
css_class = None
cell_regex = None
print '<table id="%s">' % css_id
print ' <thead>'
print ' <tr>'
print('<table id="%s">' % css_id)
print(' <thead>')
print(' <tr>')
for i, col in enumerate(col_names):
if col.endswith('_HREF'):
continue
heading_str = cgi.escape(col.replace('_', ' '))
if schema.ColumnIndexIsNumeric(i):
print ' <td class="num">%s</td>' % heading_str
print(' <td class="num">%s</td>' % heading_str)
else:
print ' <td>%s</td>' % heading_str
print ' </tr>'
print ' </thead>'
print(' <td>%s</td>' % heading_str)
print(' </tr>')
print(' </thead>')
print ' <tbody>'
print(' <tbody>')
for row in rows:
# TODO: There should be a special column called CSS_CLASS. Output that
@@ -259,15 +260,15 @@ def PrintTable(css_id, schema, col_names, rows, css_class_pattern):
row_class = 'class="%s"' % css_class
break
print ' <tr {}>'.format(row_class)
print(' <tr {}>'.format(row_class))
PrintRow(row, schema)
print ' </tr>'
print ' </tbody>'
print(' </tr>')
print(' </tbody>')
PrintColGroup(col_names, schema)
print '</table>'
print('</table>')
def ReadFile(f, tsv=False):
@@ -364,5 +365,5 @@ def main(argv):
try:
main(sys.argv)
except RuntimeError as e:
print >>sys.stderr, 'FATAL: %s' % e
print('FATAL: %s' % e, file=sys.stderr)
sys.exit(1)

0 comments on commit 14e088c

Please sign in to comment.