Permalink
Browse files

fix distutils-init to not rely on __init__.py

On Mac OS X Lion, Apple have only distributed the compiled
.pyc and .pyo files.

distutils-init used to directly 'exec' the real distils'
__init__.py file. Instead, we import the real module using
imp and grab the variables we're interested in.
  • Loading branch information...
1 parent 9fb413c commit 81990bc5d50cec8ea0179376087fb8bc67530f23 @GrahamDennis GrahamDennis committed with Matt Singleton Feb 25, 2012
Showing with 28 additions and 22 deletions.
  1. +23 −21 virtualenv.py
  2. +5 −1 virtualenv_embedded/distutils-init.py
View
@@ -2254,27 +2254,29 @@ def convert(s):
##file distutils-init.py
DISTUTILS_INIT = convert("""
-eJytV92L4zYQf9dfMU0ottuse7RvC6FQrg8Lxz2Ugz4si9HacqKuIxlJ2ST313fG8odkO9d7qGFB
-keZLv/nNjFaeWm0caMukX9nbuLxwo6Q6WBg2dFvqSsB2WEgLSjvg8C6NO/NGqHc46erciB1YDRcB
-JVdwtijpwGmoparAHQVYVzXylUH0beGpc8OV+wG+oLo2b6AVtLf2tkM19HY6WwevAj16N7jLHRhh
-ZSUsSEXGF1bR00N7c0etfkEtWUtRPVzzW/4VKmlE6bS5MYZLxU8C9ghF3nJ3zPsdOrLu7GRjC9oP
-JP7RUqUz8dRDkxdFLRtRFNkOktFAkjFZj+pKmxMt0thBBvtFEOlCZ7SfPXYXHnKV0yIdMdh8QbSD
-7IyuoOXlGz8glA5+tMDbVnBjKUkIrwcSLAHS6JI7iWng1m/erBOnydDvm4yJxgofRtFdoShyqaww
-Lv2wg9ntOjFxFSUiJSb4OixjUUSuKKSSDs21tyTLciN4lWYZY7XRQQjQ05M2dhRgqVUtD4w5c/Nh
-vXIrrDMIEBPXUrQOPuPd/jRGm7kA5hcXjG23CJErj/B6lk1ViKuDKT6otLAqcfCm9AWO+IfAHYTr
-EEK+2YBa3tCRmHxB/uuLhQeqhyM3FVHFw0oimAajz32JdM5FRdfJWyNqecV7I3u63w13NTKBmJKg
-0d9+Tfw1YlzyUp9OXFX5dIUeqWkDs6pxOW50ZsqG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jPP5QTy5UJV9kbirk4nHyUKP+3wYcdRnkZJ4xmISbWhVpQvuG+FORnk2
+9hWFi+jMiznukmEtTVoFt0bhn1KFVCWNoZ4xj0ltcwzEiVxKK6GwjSjxMVZusfp8crY0YTtsEER/
+OZ+83X1rPJxOIRhzZ2OjvcmMXXMSd3ily3a5z5X1RHYt/hCaiewMSRzE15CkR/JVJJE4R5JWTIXL
+mqhXkQ2ZgIbu/wj1zKvYp/8AHjmuAx8Ql4GfIDmRHYHvyGfuV2mkKqAtQB9Q0++42fcztcWm07dg
+peMd8H/rWUQf9Jb28tIci9dx3a7jQS5+ZwxO0YO5dFmb6uTj3a/4Ok7a/9xwjA1M8Uwarh96gUf0
+pvdrjVv5Gd97NA9xKQyS05dO4AGNy4kHaJ1guWK4f1W35+/hobP9GBknrWExDhLsat4W6muByq5W
+xazCwor5Fy6WNxU=
""")
##file distutils.cfg
@@ -1,6 +1,7 @@
import os
import sys
import warnings
+import imp
import opcode # opcode is not a virtualenv module, so we can use it to find the stdlib
# Important! To work on pypy, this must be a module that resides in the
# lib-python/modified-x.y.z directory
@@ -13,7 +14,10 @@
"The virtualenv distutils package at %s appears to be in the same location as the system distutils?")
else:
__path__.insert(0, distutils_path)
- exec(open(os.path.join(distutils_path, '__init__.py')).read())
+ real_distutils = imp.load_module("_virtualenv_distutils", None, distutils_path, ('', '', imp.PKG_DIRECTORY))
+ # Copy the relevant attributes
+ __revision__ = real_distutils.__revision__
+ __version__ = real_distutils.__version__
from distutils import dist, sysconfig

0 comments on commit 81990bc

Please sign in to comment.