Last active
December 11, 2015 07:18
-
-
Save camillol/4565288 to your computer and use it in GitHub Desktop.
A better way to get packages built against a homebrew-build Python to put their scripts where we want them. Mimics the approach used by the system python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py | |
index f1f3bd5..a094030 100644 | |
--- a/Lib/distutils/command/install.py | |
+++ b/Lib/distutils/command/install.py | |
@@ -12,7 +12,7 @@ import sys, os, string | |
from types import * | |
from distutils.core import Command | |
from distutils.debug import DEBUG | |
-from distutils.sysconfig import get_config_vars | |
+from distutils.sysconfig import get_config_vars, get_config_var | |
from distutils.errors import DistutilsPlatformError | |
from distutils.file_util import write_file | |
from distutils.util import convert_path, subst_vars, change_root | |
@@ -331,6 +331,18 @@ class install (Command): | |
self.dump_dirs("post-expand_dirs()") | |
+ # This patch is modeled after the one in the system Python | |
+ if sys.platform == "darwin": | |
+ brewsite = get_config_var('BREWSITEDIR') | |
+ if brewsite: # we only activate this later in the installation | |
+ sitepkg = os.path.join(sys.prefix, 'lib', 'python' + sys.version[:3], 'site-packages') | |
+ if self.install_platlib == sitepkg: | |
+ self.install_platlib = brewsite | |
+ if self.install_purelib == sitepkg: | |
+ self.install_purelib = brewsite | |
+ if self.install_scripts == os.path.join(sys.prefix, 'bin'): | |
+ self.install_scripts = get_config_var('BINDIR') | |
+ | |
# Create directories in the home dir: | |
if self.user: | |
self.create_home_path() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment