Commits

William Deegan committed c89c850

Fix for bug 2769 where installing via pip fails due to 'error: option --single-version-externally-managed not recognized'. This is fixed by selectively importing setuptools instead of distutil when being called via pip or with USE_SETUPTOOLS env variable set.

Comments (0)

Files changed (1)

 else:
     is_win32 = 1
 
-
 import distutils
 import distutils.core
 import distutils.command.install
 import distutils.command.install_scripts
 import distutils.command.build_scripts
 
-_install = distutils.command.install.install
+with_setuptools = False
+if 'USE_SETUPTOOLS' in os.environ or 'pip' in __file__:
+    try:
+        from setuptools import setup
+        from setuptools.command.install import install
+        with_setuptools = True
+    except:
+        with_setuptools = False
+
+if with_setuptools is False:
+    import warnings
+    from distutils.command.install import install
+    from distutils.core import setup    
+
+
+#_install = distutils.command.install.install
+_install = install
+
 _install_data = distutils.command.install_data.install_data
 _install_lib = distutils.command.install_lib.install_lib
 _install_scripts = distutils.command.install_scripts.install_scripts
                           'build_scripts'   : build_scripts}
 }
 
-distutils.core.setup(**arguments)
+setup(**arguments)
 
 if Installed:
     for i in Installed: