Mercurial 1.8.3 on Jython 2.5.2

Matt Mackall mpm at selenic.com
Thu May 12 14:26:06 UTC 2011


On Thu, 2011-05-12 at 10:02 +0200, Martin Geisler wrote:
> Sébastien Deleuze <seb at deleuze.fr> writes:
> 
> > OK, understood, I tried to import java module, wich has nothing to do
> > with posix ou windows modules.
> 
> Ah, so the java module is from Jython -- makes sense now that I think
> about it :)
> 
> > I also tried with import windows, but if I do I got error sine it uses
> > ctypes:
> >
> >     _kernel32 = ctypes.windll.kernel32
> >   File "C:\jython2.5.2\Lib\site-packages\mercurial\demandimport.py", line 76, in
> >  __getattribute__
> >     return getattr(self._module, attr)
> > AttributeError: 'module' object has no attribute 'windll'
> >
> > From what I understand, the only way to make it work is to write a
> > pure equivalent of posix.py or win32.py. Do you think it is technicaly
> > possible ?
> 
> That is what Matt commented on: we use ctypes to get access to low-level
> details like the number of hardlinks for a file. So I think you need to
> implement this in Java.
> 
> To get something running, then I think I would create a mercurial.java
> module with empty stub functions:
> 
>   def posixfile(name, mode='r', buffering=-1):
>       pass
> 
>   def openhardlinks():
>       pass
> 
>   ...
> 
> Then add a third branch to the if-statement in util.py so that java.py
> is imported in your environment.

..which will eventually get you a Mercurial that runs in Jython.. on
Windows. You're still going to need Unix and Windows variants.

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list