Mercurial extensions not working in Windows 7 x64?

Posted by Samuel Meacham on Stack Overflow See other posts from Stack Overflow or by Samuel Meacham
Published on 2010-04-02T00:10:09Z Indexed on 2010/04/02 0:13 UTC
Read the original article Hit count: 844

Filed under:
|
|
|
|

We are test driving Mercurial at work. We don't want to have to enter our user/pass each time we interact with a repository, so we set up the mercurial_keyring extension. We:

  • Installed Python 2.6.5 (32 or 64 bit, depending on the system)
  • Installed setuptools (for easy_install.exe)
  • easy_install keyring
  • easy_install mercurial_keyring

And then made the appropriate changes to %userprofile%/mercurial.ini in the [auth] section. It works fine on my colleague's computer (32bit xp sp3), but it does not work on my machine (Windows 7 Ultimate x64). Also noteworthy, the setuptools had to be built from source on Win 7 x64 (python setup.py bdist_wininst, then run the resulting setuptools-0.6c11.win-amd64.exe).

Using just hg.exe from the Mercurial 1.5 binary installation (the .msi), I get this error when I run hg.exe:

* failed to import extension mercurial_keyring: No module named mercurial_keyring

I tried to change my mercurial.ini, to specify the path to the mercurial_keyring.py file, instead of having mercurial find it (since it's in the PYTHONPATH).

Old:

[extensions]
mercurial_keyring =

New:

[extensions] mercurial_keyring =
c:/mercurial/extensions/mercurial_keyring.py

The error changes to:

abort: could not import module keyring!

So while providing the path to the mercurial_keyring extension works, the dependent keyring module still cannot be found.

After further investigation, it appears that NO extensions work. They all produce the error:

* failed to import extension [extension name]: No module named [module name]

It appears that when running hg.exe, it is not aware of PYTHONPATH. I have tried:

  • Python 2.6.5 32 bit
  • Python 2.6.5 64 bit
  • Building Mercurial 1.5 from source with MinGW
  • Building Mercurial 1.5 from source with MSVC9
  • Using hg.exe from the 1.5 binary dist (.msi)
  • Using the hg.py in c:\python26\scripts when building from source
  • Various configurations in %userprofile%/mercurial.ini
  • Using setuptools (easy_install.exe) to install keyring and mercurial_keyring
  • Building keyring and mercurial_keyring from source (python setup.py bdist_wininst)

Nothing works. The closest I've got is using hg.py when building from source. It at least doesn't give me errors, and actually creates %userprofile%/wincrypto_pass.cfg when I enter my credentials. But on subsequent requests, it doesn't enter the credentials automatically. It prompts me for them again.

Interestingly, TortoiseHG is using the keyring. I just can't get it to work on the command line. I think something is going on with Win 7 x64 that is preventing mercurial (hg.exe) from seeing the PYTHONPATH, so it can't find any of the installed modules.

Does anyone have extensions working in Win 7 x64? Specifically with the binary installation of mercurial (not hg.py)?

© Stack Overflow or respective owner

Related posts about windows7

Related posts about mercurial