Monday, January 16, 2012

Closure as a property of a package management system

I filed a bug today for a simple OSX Homebrew recipe for git-hg. Basically, git-hg allows you to clone and work with mercurial repositories using a git repo.  Upon installing the recipe though, cloning resulted in an empty directory, and a fetch (performed out of curiosity) got:

Traceback (most recent call last):
  File "/usr/local/Cellar/git-hg/HEAD/bin/../fast-export/", line 6, in <module>
    from mercurial import repo,hg,cmdutil,util,ui,revlog,node
ImportError: No module named mercurial

Aha, so the immediate problem is that the Python mercurial module is missing.

The actual problem is a little more pervasive: the git-hg recipe didn't close over all of its environmental settings and software dependencies.

A further example of faulty closures was seen in the associated Python install.  Why was the module missing?  The first place to look is the Python distribution's site-packages folder ( /usr/local/lib/python2.7/site-packages for the Homebrew example).

This turned out to be a puzzler because OSX also comes with an older version of Python installed. Thus, as the Homebrew and Python page explains, you have some fiddling to do with your PATH and PYTHONPATH environmental settings.   While one cannot predict or completely automate environmental dependencies, it would have been very nice to be reminded of the potential conflict by the Python recipe.

The omission constitutes a lack of closure of the recipe over its dependencies.

1 comment:

Alex Stephen said...

Great Blog! Very informative, I appreciate all the information that you just shared with me very much and I also bookmarked this on dig too. Take care and I'll be back to read more in the future.
home management services