1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
# HG changeset patch
# User Jannis Leidel <jannis@leidel.info>
# Date 1280103078 -7200
# Branch trunk
# Node ID 8be37c509fe5cd474ba947e784b8676d7bd3d535
# Parent 29ae52edcb91323785116ccea255841843757c5c
Fixed #46 - Use a proper temp dir instead of /tmp.
Index: python-virtualenv-1.4.9/virtualenv.py
===================================================================
--- python-virtualenv-1.4.9.orig/virtualenv.py
+++ python-virtualenv-1.4.9/virtualenv.py
@@ -10,6 +10,7 @@ import optparse
import re
import shutil
import logging
+import tempfile
import distutils.sysconfig
try:
import subprocess
@@ -286,7 +287,6 @@ def _install_req(py_executable, unzip=Fa
if is_jython and os._name == 'nt':
# Jython's .bat sys.executable can't handle a command line
# argument with newlines
- import tempfile
fd, ez_setup = tempfile.mkstemp('.py')
os.write(fd, bootstrap_script)
os.close(fd)
@@ -324,10 +324,10 @@ def _install_req(py_executable, unzip=Fa
return filter_ez_setup(line, project_name)
if not os.access(os.getcwd(), os.W_OK):
- cwd = '/tmp'
+ cwd = tempfile.mkdtemp()
if source is not None and os.path.exists(source):
# the current working dir is hostile, let's copy the
- # tarball to /tmp
+ # tarball to a temp dir
target = os.path.join(cwd, os.path.split(source)[-1])
shutil.copy(source, target)
try:
|