Skip to content

Instantly share code, notes, and snippets.

@bukzor
Created April 27, 2011 16:21
Show Gist options
  • Save bukzor/944589 to your computer and use it in GitHub Desktop.
Save bukzor/944589 to your computer and use it in GitHub Desktop.
--- virtualenv.orig 2011-04-26 20:27:02.557885000 -0700
+++ virtualenv.py 2011-04-26 21:49:58.111075000 -0700
@@ -394,6 +394,14 @@
# Some bad symlink in the src
logger.warn('Cannot find file %s (bad symlink)', src)
return
+ if os.path.isdir(dest):
+ logger.debug('Directory %s already exists', dest)
+ logger.indent += 2
+ try:
+ for fn in os.listdir(src):
+ copyfile(join(src, fn), join(dest, fn), symlink)
+ finally:
+ logger.indent -= 2
if os.path.exists(dest):
logger.debug('File %s already exists', dest)
return
@@ -884,7 +892,7 @@
def change_prefix(filename, dst_prefix):
- prefixes = [sys.prefix]
+ prefixes = [sys.prefix, sys.exec_prefix]
if sys.platform == "darwin":
prefixes.extend((
@@ -1004,8 +1012,14 @@
exec_dir = join(sys.exec_prefix, 'Lib')
else:
exec_dir = join(sys.exec_prefix, 'lib', py_version)
- for fn in os.listdir(exec_dir):
- copyfile(join(exec_dir, fn), join(lib_dir, fn))
+ logger.debug('Exec dir %s', exec_dir)
+ logger.indent += 2
+ try:
+ for fn in os.listdir(exec_dir):
+ if fn != 'site-packages':
+ copyfile(join(exec_dir, fn), join(lib_dir, fn))
+ finally:
+ logger.indent -= 2
if is_jython:
# Jython has either jython-dev.jar and javalib/ dir, or just
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment