Skip to content

Commit

Permalink
Experimental macOS workaround for pip
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLastProject committed Mar 23, 2017
1 parent 59de61f commit 08d52a8
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions pext/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import getopt
import json
import os
import platform
import signal
import sys
import threading
Expand Down Expand Up @@ -487,12 +488,25 @@ def _pip_install(self, module_dir_name: str) -> int:
'-r',
module_requirements_path]

returncode = 0

# Cheap macOS workaround, part 1
# See https://github.com/pypa/pip/pull/4111#issuecomment-280616124
if platform.system() == "Darwin":
with open(os.path.expanduser('~/.pydistutils.cfg'), 'w') as macos_workaround:
macos_workaround.write('[install]\nprefix=')

# Actually run the pip command
try:
run(pip_command, check=True)
except CalledProcessError as e:
return e.returncode
returncode = e.returncode

# Cheap macOS workaround, part 2
if platform.system() == "Darwin":
os.remove(os.path.expanduser('~/.pydistutils.cfg'))

return 0
return returncode

def bind_logger(self, logger: Logger) -> str:
"""Connect a logger to the module manager.
Expand Down

0 comments on commit 08d52a8

Please sign in to comment.