Permalink
Browse files

Better fix for 'pip' detection in setup.py

  • Loading branch information...
zsimic committed Mar 20, 2013
1 parent 1572064 commit 7d5441e294a23dda1ac246791c211f494f47e170
Showing with 2 additions and 1 deletion.
  1. +2 −1 setup.py
View
@@ -20,10 +20,11 @@
os.chdir(setup_dirname)
# Use setuptools only if the user opts-in by setting the USE_SETUPTOOLS env var
+# Or if setuptools was previously imported (which is the case when using 'distribute')
# This ensures consistent behavior but allows for advanced usage with
# virtualenv, buildout, and others.
with_setuptools = False
-if 'USE_SETUPTOOLS' in os.environ or 'pip' in __file__:
+if 'USE_SETUPTOOLS' in os.environ or 'setuptools' in sys.modules:
try:
from setuptools import setup
from setuptools.command.install import install

0 comments on commit 7d5441e

Please sign in to comment.