Skip to content

Followup build and src dir fixes #566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 6, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions pip/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@ def running_under_virtualenv():
build_prefix = os.path.join(sys.prefix, 'build')
src_prefix = os.path.join(sys.prefix, 'src')
else:
#Use tempfile to create a temporary folder
build_prefix = tempfile.mkdtemp('-build', 'pip-')
src_prefix = tempfile.mkdtemp('-src', 'pip-')
## FIXME: this is a terrible hack; change req.py (or other locations?)
## to flag a directory for deletion based on whether or not it matches
## build_prefix and src_prefix, NOT if pip has had to create it
# Use tempfile to create a temporary folder for build
# Note: we are NOT using mkdtemp so we can have a consistent build dir
build_prefix = os.path.join(tempfile.gettempdir(), 'pip-build')

## FIXME: keep src in cwd for now (it is not a temporary folder)
try:
os.rmdir(build_prefix)
os.rmdir(src_prefix)
src_prefix = os.path.join(os.getcwd(), 'src')
except OSError:
# I'm not sure why this wouldn't work, but just in case!
sys.exit("An error has occurred in attempting to set up the temporary directories")
# In case the current working directory has been renamed or deleted
sys.exit("The folder you are executing pip from can no longer be found.")

# under Mac OS X + virtualenv sys.prefix is not properly resolved
# it is something like /path/to/python/bin/..
Expand Down