Skip to content

Commit

Permalink
Substitute pencode with valid Python syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
lordmauve committed Jul 15, 2017
1 parent 6a819aa commit 4e97136
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions chopsticks/bubble.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ def exec_(_code_, _globs_=None, _locs_=None):
import codecs


utf8_decode = codecs.getdecoder('utf8')

outqueue = Queue(maxsize=10)
tasks = Queue()
done = object()
Expand Down Expand Up @@ -348,7 +346,8 @@ def handle_start(req_id, host, path, depthlimit):
MSG_PACK = 2


<< PENCODE >>
# The source code from chopsticks.pencode will be substituted here
{{ PENCODE }}


def send_msg(op, req_id, data):
Expand Down
4 changes: 3 additions & 1 deletion chopsticks/tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@ class DepthLimitExceeded(Exception):
"""The recursive tunnel depth limit was hit."""


# Load/construct the bubble code
try:
# If this is the remote side, we have the bubble code in __main__.__bubble
bubble = sys.modules['__main__'].__bubble
except (AttributeError, KeyError):
pencode = pkgutil.get_data('chopsticks', 'pencode.py')
bubble = pkgutil.get_data('chopsticks', 'bubble.py')
bubble = bubble.replace(b'<< PENCODE >>', pencode)
bubble = bubble.replace(b'{{ PENCODE }}', pencode)
del pencode


Expand Down

0 comments on commit 4e97136

Please sign in to comment.