Patch for to install contrib directory

Jonathan S. Shapiro shap at
Wed Aug 29 22:31:23 CDT 2007

This patch causes to install the contrib directory
under /usr/share/mercurial/contrib. It reflects a consensus discussion
on IRC earlier today, and was developed to correct a fairly significant
packaging deficiency in Fedora 7 (and probably others).

At the moment, it only implements the install for posix-ish systems. It
seems clear that this needs to be extended for Windows, but I do not
know what the appropriate path there would be. The current patch, at
least, is forward progress imposing no surprises for existing
installations. I would like to see it go into tip quickly, because of
the downstream packaging problems that it solves.

In hindsight, this patch is not quite right. I was racing to get
something done before the Fedora 0.9.4 package graduated out of test,
and I'm only realizing now that a slight tweak is appropriate.
Explanation will follow in my next email.

The underlying problem here is that the contrib/ stuff really shouldn't
go (for the most part) in the python path, but if it doesn't then we are
left with putting it in a system-dependent directory, and we need to
choose one.

Patch follows:

diff -ruN mercurial-0.9.4.orig/
--- mercurial-0.9.4.orig/	2007-06-25 22:18:18.000000000 -0400
+++	2007-08-29 19:17:36.000000000 -0400
@@ -54,6 +54,21 @@
 cmdclass = {'install_data': install_package_data}
+# We want to install the contrib/ directory, but it isn't immediately
+# clear where to do that on some platforms. As a temporary expedient,
+# assemble that part of the setup manifest only if we are running on
+# a posix platform. This is no worse than the current state, and people
+# who understand the respective target platforms can improve it over
+# time.
+contrib_files = []  # default
+if in ['posix']:
+    contrib_files = [(os.path.join('/usr/share/mercurial', root),
+                      [os.path.join(root, file_) for file_ in files])
+                     for root, dirs, files in os.walk('contrib')]
+    contrib_files = contrib_files + [('/usr/share/mercurial',
+                                      ['hgwebdir.cgi', 'hgweb.cgi'])]
       author='Matt Mackall',
@@ -67,7 +82,8 @@
       data_files=[(os.path.join('mercurial', root),
                    [os.path.join(root, file_) for file_ in files])
-                  for root, dirs, files in os.walk('templates')],
+                  for root, dirs, files in os.walk('templates')] +
+                 contrib_files,
       scripts=['hg', 'hgmerge'],

Jonathan S. Shapiro, Ph.D.
Managing Director
The EROS Group, LLC

More information about the Mercurial-devel mailing list