views:

540

answers:

4

I have Mercurial 1.3 installed on my Windows 7 machine. I don't have python installed, but Mercurial seems to be OK with that.

How does it work?

Also, is it possible to force Mercurial run on IronPython and will it be compatible?

Thank you.

+3  A: 

Mercurial bundles the necessary python binaries within it, I believe.

Amber
I wasn't able to find any python binaries there. Also, Mercurial should use (I presume) Python standard library, so it should be present there as well, but I didn't find it either.
Valentin Vasiliev
Sorry, when I said "within", I didn't mean "in the directory", I meant that the executable(s) for Mercurial actually bundle the Python engine within the executable, it's built-in.
Amber
the hg.exe is only 17KB, but there is a library.zip (9MB), which can't be opened by WinZip, can all the prereqs be there?
Valentin Vasiliev
Look for a pythonXX.dll in the same directory as library.zip (where XX are numbers).
Amber
There is no such DLL
Valentin Vasiliev
+5  A: 

Since there is a "library.zip"(9MB), Mercurial's Windows binary package maybe made by py2exe, py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.

sunqiang
+10  A: 

The Mercurial windows installer is packaged using py2exe. This places the python interpreter as a DLL inside of a file called "library.zip".

On my machine, it is placed in "C:\Program Files\TortoiseHg\library.zip"

This zip file also contains the python libraries that are required by mercurial.

For a detailed description of how mercurial is packaged for windows, see the developer page describing building windows installer.

John Mulder
+1  A: 

Others have answered the first question -- let me give a guess about the second part.

Mercurial will normally use some C extensions for speed. You cannot use those with IronPython.

But we also ship pure Python versions of these modules, and depending on how much IronPython implements of a standard Python 2.4 environment, those modules could be compatible. I have seen reports on IRC about Jython (the Java port of Python) being able to do a few operations using the pure modules. You should download Mercurial and take a look at the mercurial/pure folder. These modules simply has to be moved up one directory level to be found, the setup.py script can do this if you pass the --pure flag. Please see its source or come talk with us on the Mercurial mailinglist/IRC.

Martin Geisler
Thanks, Martin, I've already tried it, and found that Mercurial does not work with IronPython. It fails somewhere in OS interaction files.
Valentin Vasiliev
Valentin: The most recent discussion on the IronPython list on this topic is from May. They report several features working, but not quite all of them: http://lists.ironpython.com/pipermail/users-ironpython.com/2009-May/010200.html. Notably this is with the *development* IronPython 2.6.
quark