Carrying on from where I left off , my problems with python modules continue. After some conversations with djc, bsmedberg, ted and jorendorff it seems that Mercurial is using an entirely different python interpreter and that is why even though my 2 modules are installed properly hg serve is still throwing me an error.
I installed my Mercurial using a windows binary and it seems that it is based on py2exe, which zips up its own libraries and installs them separately along with a separate Python interpreter. Now, this is quite a pain since now I have to install Mercurial from source so that it installs in my pythonscripts folder. Why doesn’t the windows binary just install Mercurial directly to the Python folder on my machine? If py2exe is trying to do its own thing and using a separate Python interpret then maybe it shouldn’t be used because what if you want to add more modules that you need (which is exact my problem)? Then you have to bite the bullet and build from source. I’m sorry to say but that’s not very developer friendly. I mean there should be an easier way to add more modules to Mercurial
Building Mercurial from Source
I used the python setup.py method to build Mercurial. I followed the instructions here. So I downloaded the source and installed Visual C++ 9 (python extensions require a C compiler). Then I ran python setup.py build from the top level directory of the Mercurial Source. Text rushed through my console and BAAM! An error!
Turns out you need to use the same C compiler to build python extensions as the one you used to build python itself. Awesome, well my particular python build used Visual Studio 2003 (I just installed it from an exe, I didn’t build it myself). I can’t use that so I need to find another way. Well the documentation that I was using provided some help as to how I could use another C compiler.
After spending hours trying to get Mercurial to build with Visual C++, cygwin and then with mingw I somehow finally got it to work with mingw with the help of my friend, Tiago Moreira. This was a very tedious and unpleasant experience. My problems with Mingw were happening because I wasn’t installing it in my C: drive (since I have no available space) but it turns out that Mingw doesn’t like being installed in any drive that isn’t C: for whatever reason. Now after I miraclously cleared up space on my C: drive and snuck Mingw in there and then set the path in the windows environment variables my installation still didn’t work. Well, it turns out the path needs to be explicitly set on the command line for the build to work.
This experience hasn’t been very pleasant and I definitely think that python needs to figure out a better way to install extensions. I mean I should be able to use any C compiler I want with relative ease. Right now one has to go through a tedious process of configuring python to use the right compiler. If anyone out there can explain to me why that is, I’m all ears. The way that the documentation is written doesn’t help either. There is definate room for improvement when it comes to the clarity and detail of the document.
I know what some of you might be thinking at this moment. Why is this guy complaining about user friendliness and ease of use when talking about developer tools? They are not meant to be user friendly. Well, I say why not? I mean I am not asking for the program to hold my hand here but I would prefer if it didn’t work against me. I know some, maybe most of these troubles have croped up because of my inexperience with these technologies but that’s exactly my point. How can you get new people involved in your open source projects if there are frustrating road blocks in the way from the very beginning?
See, what I’m wondering is whats stopping Mozilla or the developers of Mercurial from making an installation bundle, which makes it easier to get a hold of all the dependencies. I know the Microsoft SDKs that Firefox needs to perform a build are proprietary. However, that could easily be handled if the installation bundle somehow pointed you to the download page and once the setup file is downloaded the bundle could then run the installation for you. I haven’t looked into the technical details of doing this but I would think that this would be possible. Maybe the developers have thought about this but haven’t had the time or the resources to implement it, I don’t know. I think creating an installation bundle would be a good idea, especially for beginners like myself. But nonetheless, enough of my ranting. I am not one to give up once I decide to take something on. I will continue working and putting in effort into these projects but I don’t know whether others will do the same.
All the troubles aside I finally got my installation working and ready to roll. I ran hg serve from the hgpoller repo and VOILA! No more errors, pushloghtml was FINALLY up and running. Now I can actually start working on my project
![hg serve hg serve, no errors!](http://sidkalra.com/files/mercurial/hgserve.png)
hg serve, no errors!