From a37fa9563065819a8520b1a7c501949a5a5d8df4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 24 Nov 2013 15:30:17 -0500 Subject: Updated environment-specific console script generation to use modern style. --- setup.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 50d0e4c5..6cf52521 100755 --- a/setup.py +++ b/setup.py @@ -31,14 +31,23 @@ from setuptools.command.test import test as _test scripts = [] -console_scripts = ["easy_install = setuptools.command.easy_install:main"] - -# Gentoo distributions manage the python-version-specific scripts themselves, -# so they define an environment variable to suppress the creation of the -# version-specific scripts. -if os.environ.get("SETUPTOOLS_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT") in (None, "", "0") and \ - os.environ.get("DISTRIBUTE_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT") in (None, "", "0"): - console_scripts.append("easy_install-%s = setuptools.command.easy_install:main" % sys.version[:3]) +def _gen_console_scripts(): + yield "easy_install = setuptools.command.easy_install:main" + + # Gentoo distributions manage the python-version-specific scripts + # themselves, so those platforms define an environment variable to + # suppress the creation of the version-specific scripts. + var_names = ( + 'SETUPTOOLS_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT', + 'DISTRIBUTE_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT', + ) + if any(os.environ.get(var) not in (None, "", "0") for var in var_names): + return + yield ("easy_install-{shortver} = setuptools.command.easy_install:main" + .format(shortver=sys.version[:3])) + +console_scripts = list(_gen_console_scripts()) + # specific command that is used to generate windows .exe files class build_py(_build_py): -- cgit v1.2.1