Skip to content

Commit

Permalink
Option to strip filenames to base names in compiler
Browse files Browse the repository at this point in the history
Console now reacts on key down instead of keyup this makes it look like more responsive


git-svn-id: svn://svn.gafol.net/pyzza/trunk@83 3ab322cd-34a9-de11-922a-001d7d91e118
  • Loading branch information
pc committed Jul 23, 2010
1 parent 6f2d2be commit c898971
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions examples/Cookfile
Expand Up @@ -8,6 +8,7 @@ Global:
- graph
- debuginfo
- ../lib
debug-filename: basename

Targets:
layout.swf:
Expand Down
Binary file modified examples/arkanoid.swf
Binary file not shown.
Binary file modified examples/charts.swf
Binary file not shown.
Binary file modified examples/graph.swf
Binary file not shown.
Binary file modified examples/layout.swf
Binary file not shown.
Binary file modified examples/pacman.swf
Binary file not shown.
13 changes: 11 additions & 2 deletions pyzza/compile.py
Expand Up @@ -4,6 +4,7 @@
from contextlib import contextmanager
import copy
import sys
import os.path

from . import parser, library, swf, bytecode, abc, tags

Expand Down Expand Up @@ -1626,6 +1627,10 @@ def get_options():
op.add_option('-f', '--frame-rate', metavar="FPS",
help="Frame rate of output flash movie",
dest="frame_rate", default=15, type="int")
op.add_option('--debug-filename', metavar="MODE",
help="How to put filename into debugging info. `full` - full path, "
" `basename` - filename without path",
dest="frame_rate", default=15, type="int")
return op

def print_error(e):
Expand Down Expand Up @@ -1659,7 +1664,7 @@ def make_globals(lib, std_globals=True):
return glob

def compile(files, lib, glob, output, main_class,
width=500, height=375, frame_rate=15):
width=500, height=375, frame_rate=15, filename='full'):
code_tags = []
try:
for file in files:
Expand All @@ -1669,7 +1674,11 @@ def compile(files, lib, glob, output, main_class,
ast = parser.parser().parse_file(file)
code_header = CodeHeader(file)
NameCheck(ast) # fills closure variable names
frag = CodeFragment(ast, lib, code_header, filename=file,
if filename == 'basename':
fname = os.path.basename(file)
else:
fname = file
frag = CodeFragment(ast, lib, code_header, filename=fname,
parent_namespaces=(glob,))
code_header.add_method_body('', frag)
code_header.add_main_script(frag)
Expand Down
4 changes: 3 additions & 1 deletion pyzza/cook.py
Expand Up @@ -220,11 +220,13 @@ def build(files, output, recipe, info):
lib = library.Library()
for fname in recipe['Global'].get('libraries', ()):
lib.add_file(fname)
filename_mode = recipe['Global'].get('debug-filename', 'full')
compile.compile((f for f in files if f.endswith('.py')),
lib, compile.make_globals(lib), output,
width=info.get('width', 500), height=info.get('height', 375),
frame_rate=info.get('frame-rate', 15),
main_class=info.get('main-class', 'Main'))
main_class=info.get('main-class', 'Main'),
filename=filename_mode)

def files(src, dependencies):
all = [src]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -3,7 +3,7 @@

setup(
name = "pyzza",
version = "0.2.5",
version = "0.2.6",

packages = ['pyzza'],
scripts = [
Expand Down

0 comments on commit c898971

Please sign in to comment.