Issue1562575

classification
Title: yield keyword from Hg gives syntax error
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, jglick
Priority: normal Keywords:

Created on 2006-09-21.00:54:45 by jglick, last changed 2006-09-21.17:14:21 by jglick.

Messages
msg1239 (view) Author: Jesse Glick (jglick) Date: 2006-09-21.00:54:45
Using Jython 2.2a1, I tried to load Mercurial v. 0.9.1,
just enough to call --version. But I just get a parse
error:


$ /tmp/hjg --version
Traceback (innermost last):
  File "<stdin>", line 3, in ?
  File
"/usr/lib/python2.4/site-packages/mercurial/commands.py",
line 58
	            yield src, fn, util.pathto(repo.getcwd(),
fn), fn in exact
	                  ^
SyntaxError: invalid syntax


The wrapper script, FWIW (based on Linux FC5):


#!/bin/sh
/tmp/jythonRelease_2_2alpha1/jython - <<PYTHON
import sys
sys.path.append("/usr/lib/python2.4/site-packages")
from mercurial import commands
commands.run()
PYTHON


Sources:
http://www.selenic.com/mercurial/release/mercurial-0.9.1.tar.gz


Surrounding text (sorry if this gets reformatted):


def makewalk(repo, pats, opts, node=None, head='',
badmatch=None):
    files, matchfn, anypats = matchpats(repo, pats,
opts, head)
    exact = dict(zip(files, files))
    def walk():
        for src, fn in repo.walk(node=node,
files=files, match=matchfn,
                                 badmatch=badmatch):
            yield src, fn, util.pathto(repo.getcwd(),
fn), fn in exact
    return files, matchfn, walk()
msg1240 (view) Author: Charlie Groves (cgroves) Date: 2006-09-21.14:06:37
Logged In: YES 
user_id=1174327

yield doesn't appear by default until 2.3.  You can use it
in 2.2 by adding 'from __future__ import generators' to the
beginning of your wrapper script. 
msg1241 (view) Author: Jesse Glick (jglick) Date: 2006-09-21.17:14:21
Logged In: YES 
user_id=257383

Actually it needs to be placed inside each source file using
'yield', not in the wrapper script, but yes that solves the
syntax error problem.

Other errors still occur when trying to use Hg, so I guess
I'll just wait for a future Jython release before trying again.
History
Date User Action Args
2006-09-21 00:54:45jglickcreate