[PATCH 3 of 6] setup: add missing `share' directory to install_data on UNIX platforms
Dan Villiom Podlaski Christiansen
danchr at gmail.com
Thu Nov 26 13:48:04 CST 2009
# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1259264232 -3600
# Node ID 3aeda8897d6e60a74a403bda66d29fc0c40f30d6
# Parent aaed59f0dc70635e9d7ac6328a1ca11f76d724ba
setup: add missing `share' directory to install_data on UNIX platforms.
Technically, this is a hack; we modify a "constant" in
distutils. However, `install_data' incorrectly defaults to
e.g. "$base" in the `unix_home' and `unix_prefix' schemes, rather than
the proper "$base/share", so we fix it. The paths will not be modified
if they contain a `/' as it would indicate that the bug was fixed.
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -32,13 +32,21 @@ import tempfile
from distutils.core import setup, Extension
from distutils.dist import Distribution
-from distutils.command.install import install
+from distutils.command.install import install, INSTALL_SCHEMES
from distutils.command.install_data import install_data
from distutils.command.build import build
from distutils.command.build_py import build_py
from distutils.spawn import spawn, find_executable
from distutils.ccompiler import new_compiler
+# on UNIX-like systems, the distutils default is install data directly in
+# $PREFIX, $HOME or whatever the base is. In such cases, change the default
+# to the standard `share' directory.
+for platform, scheme in INSTALL_SCHEMES.iteritems():
+ if platform.startswith('unix_'):
+ if scheme['data'][0] == '$' and '/' not in scheme['data']:
+ scheme['data'] += '/share'
+
extra = {}
scripts = ['hg']
if os.name == 'nt':
More information about the Mercurial-devel
mailing list