[PATCH] distutils: Monkeypatch distutils.commands.sdist to respect built MANIFEST

Stephen Thorne stephen at thorne.id.au
Sat Jun 4 05:12:13 CDT 2011


# HG changeset patch
# User Stephen Thorne <stephen at thorne.id.au>
# Date 1307182328 -36000
# Node ID 086af4bc94ebac43a78f35cbeb36c7b75524b2f1
# Parent  b4175b72bbd888c8f2bc9d9d6034d5f7bfbbeaba
distutils: Monkeypatch distutils.commands.sdist to respect built MANIFEST

When running 'python2.7 setup.py sdist' many files were omitted from the
resulting tarball that are required for a complete build, including the .h file
for the inotify extension.

By changing the 'write_manifest' to be 'read_manifest', MANIFEST will be read
properly and the build will succeed correctly.

Unfortunately, this is due to Issue11104 <http://bugs.python.org/issue11104>
in the core python distribution. I have written a patch to fix the problem in
python core, but anyone who is running 2.7.1 will be affected.

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -388,6 +388,12 @@ if sys.platform == 'darwin' and os.path.
         StrictVersion(version.split()[1]) >= StrictVersion('4.0')):
         os.environ['ARCHFLAGS'] = ''
 
+if (2, 7, 0) <= sys.version_info <= (2, 7, 2):
+    # Python 2.7 and 2.7.1 will not respect the MANIFEST built by the Makefile
+    # this monkeypatch will cause it to be read.
+    from distutils.command.sdist import sdist
+    sdist.write_manifest = sdist.read_manifest
+
 setup(name='mercurial',
       version=setupversion,
       author='Matt Mackall',


More information about the Mercurial-devel mailing list