From 7d89ee3783393d4a4b7ddf37d49b36d58e7f0491 Mon Sep 17 00:00:00 2001 From: David Boucha Date: Sat, 30 Jun 2012 14:01:57 -0600 Subject: [PATCH] import setuptools if SETUPTOOLS env var exists Default to importing distutils unless the user has created an environment variable named SETUPTOOLS in which case import setuptools --- setup.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 265a3dce5d..44e924c52f 100755 --- a/setup.py +++ b/setup.py @@ -14,12 +14,16 @@ from distutils.sysconfig import get_python_lib, PREFIX # Use setuptools if available, else fallback to distutils. # As an example, setuptools is available in virtualenvs and buildouts through # Setuptools or Distribute. -try: - from setuptools import setup - with_setuptools = True -except ImportError: +with_setuptools = False +if 'SETUPTOOLS' in os.environ: + try: + from setuptools import setup + with_setuptools = True + except: + with_setuptools = False + +if with_setuptools == False: from distutils.core import setup - with_setuptools = False exec(compile(open("salt/version.py").read(), "salt/version.py", 'exec'))