Anonymous committed 0b7e70a

[svn r3602] Always set distutils.cfg prefix setting

  • Participants
  • Parent commits a80d6ac

Comments (0)

Files changed (2)

File docs/index.txt

 * Sometimes Cygwin seems to leave ``.exe`` off ``sys.executable``; a
   workaround is added.
+* Always set ``[install] prefix`` in ``distutils.cfg`` -- previously
+  on some platforms where a system-wide ``distutils.cfg`` was present
+  with a ``prefix`` setting, packages would be installed globally
+  (usually in ``/usr/local/lib/pythonX.Y/site-packages``).


         logger.notify('Please make sure you remove any previous custom paths from '
                       'your %s file.' % pydistutils)
-    install_distutils(lib_dir)
+    install_distutils(lib_dir, home_dir)
     install_setuptools(py_executable, unzip=unzip_setuptools)
         content = content.replace('__BIN_NAME__', os.path.basename(bin_dir))
         writefile(os.path.join(bin_dir, name), content)
-def install_distutils(lib_dir):
+def install_distutils(lib_dir, home_dir):
     distutils_path = os.path.join(lib_dir, 'distutils')
+    distutils_cfg = DISTUTILS_CFG + "\n[install]\nprefix=%s\noptimize=0\n" % home_dir
     writefile(os.path.join(distutils_path, ''), DISTUTILS_INIT)
-    writefile(os.path.join(distutils_path, 'distutils.cfg'), DISTUTILS_CFG, overwrite=False)
+    writefile(os.path.join(distutils_path, 'distutils.cfg'), distutils_cfg, overwrite=False)
 def fix_lib64(lib_dir):