[PATCH 3 of 5] setup: add missing `share' directory to install_data on UNIX platforms

Dan Villiom Podlaski Christiansen danchr at gmail.com
Tue Nov 24 11:43:35 CST 2009


# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1259083818 -3600
# Node ID 7510086cbb46fc54f8894ece7687459f3bf6de34
# Parent  ffeb6ac880dcb02cd3727acbd8382d68fd734e78
setup: add missing `share' directory to install_data on UNIX platforms.

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -34,9 +34,18 @@ from distutils.dist import Distribution
 from distutils.command.install_data import install_data
 from distutils.command.build import build
 from distutils.command.build_py import build_py
+from distutils.command.install import INSTALL_SCHEMES
 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