Mercurial 1.8.3 on Jython 2.5.2

Sébastien Deleuze seb at deleuze.fr
Wed May 11 20:56:51 UTC 2011


Hi,

I try to make Mercurial 1.8.3 working, even partially, with Jython
2.5.2. I am working on a Java based forge. We are currently running
native Mercurial commands and parsing the outpout, but it would be far
better for us to embed Mercurial in Jython like we have done for
Docutils recently.

With Jython 2.5.2, when I run "jython setup.py --pure", I get an error
during bz2 import. Thats normal since Jython does not support bz2 yet.
I have read on Jython bugtracker (http://bugs.jython.org/issue1445)
that bz2 is only used for bundles and archives, 2 functionnalities we
don't need, so I have commented bz2 check in setup.py.

Without bz2 check installation and byte compilation is fine, but I get
the following error when running "jython hg"
C:\mercurial-1.8.3>jython hg --help
Traceback (most recent call last):
  File "hg", line 36, in <module>
    mercurial.util.set_binary(fp)
  File "C:\mercurial-1.8.3\mercurial\demandimport.py", line 75, in __getattribut
e__
    self._load()
  File "C:\mercurial-1.8.3\mercurial\demandimport.py", line 47, in _load
    mod = _origimport(head, globals, locals)
  File "C:\mercurial-1.8.3\mercurial\util.py", line 578, in <module>
    from posix import *
  File "C:\mercurial-1.8.3\mercurial\demandimport.py", line 85, in _demandimport

    return _origimport(name, globals, locals, fromlist)
  File "C:\mercurial-1.8.3\mercurial\posix.py", line 10, in <module>
    import os, sys, errno, stat, getpass, pwd, grp
  File "C:\mercurial-1.8.3\mercurial\demandimport.py", line 85, in _demandimport

    return _origimport(name, globals, locals, fromlist)
  File "C:\jython2.5.2\Lib\pwd.py", line 17, in <module>
    raise ImportError, 'pwd module not supported on Windows'
ImportError: pwd module not supported on Windows

Does someone have some tips in order to avoid using pwd or at least to
add a fallback code that could allow me to run jython hg under Windows
?

Best regards,
Sébastien



More information about the Mercurial mailing list