From fa81391fe65fa727f79f1be73f058e83ffe97193 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 20 Jan 2021 21:13:41 -0500 Subject: [PATCH 1/2] Remove eggsecutable --- setup.py | 2 -- setuptools/command/bdist_egg.py | 49 ++---------------------------- setuptools/command/easy_install.py | 10 ------ setuptools/tests/test_bdist_egg.py | 15 --------- 4 files changed, 2 insertions(+), 74 deletions(-) diff --git a/setup.py b/setup.py index 28d3dada34..3d84c65ac4 100755 --- a/setup.py +++ b/setup.py @@ -171,8 +171,6 @@ def _restore_install_lib(self): "dependency_links.txt = setuptools.command.egg_info:overwrite_arg", ], "console_scripts": list(_gen_console_scripts()), - "setuptools.installation": - ['eggsecutable = setuptools.command.easy_install:bootstrap'], }, dependency_links=[ pypi_link( diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index 206f2419ba..e6b1609f7b 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -2,7 +2,6 @@ Build .egg distributions""" -from distutils.errors import DistutilsSetupError from distutils.dir_util import remove_tree, mkpath from distutils import log from types import CodeType @@ -11,12 +10,10 @@ import re import textwrap import marshal -import warnings from pkg_resources import get_build_platform, Distribution, ensure_directory -from pkg_resources import EntryPoint from setuptools.extension import Library -from setuptools import Command, SetuptoolsDeprecationWarning +from setuptools import Command from sysconfig import get_path, get_python_version @@ -268,49 +265,7 @@ def zip_safe(self): return analyze_egg(self.bdist_dir, self.stubs) def gen_header(self): - epm = EntryPoint.parse_map(self.distribution.entry_points or '') - ep = epm.get('setuptools.installation', {}).get('eggsecutable') - if ep is None: - return 'w' # not an eggsecutable, do it the usual way. - - warnings.warn( - "Eggsecutables are deprecated and will be removed in a future " - "version.", - SetuptoolsDeprecationWarning - ) - - if not ep.attrs or ep.extras: - raise DistutilsSetupError( - "eggsecutable entry point (%r) cannot have 'extras' " - "or refer to a module" % (ep,) - ) - - pyver = '{}.{}'.format(*sys.version_info) - pkg = ep.module_name - full = '.'.join(ep.attrs) - base = ep.attrs[0] - basename = os.path.basename(self.egg_output) - - header = ( - "#!/bin/sh\n" - 'if [ `basename $0` = "%(basename)s" ]\n' - 'then exec python%(pyver)s -c "' - "import sys, os; sys.path.insert(0, os.path.abspath('$0')); " - "from %(pkg)s import %(base)s; sys.exit(%(full)s())" - '" "$@"\n' - 'else\n' - ' echo $0 is not the correct name for this egg file.\n' - ' echo Please rename it back to %(basename)s and try again.\n' - ' exec false\n' - 'fi\n' - ) % locals() - - if not self.dry_run: - mkpath(os.path.dirname(self.egg_output), dry_run=self.dry_run) - f = open(self.egg_output, 'w') - f.write(header) - f.close() - return 'a' + return 'w' def copy_metadata_to(self, target_dir): "Copy metadata (egg info) to the target_dir" diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index f1e487d4d2..544e8fd444 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -2284,16 +2284,6 @@ def current_umask(): return tmp -def bootstrap(): - # This function is called when setuptools*.egg is run using /bin/sh - import setuptools - - argv0 = os.path.dirname(setuptools.__path__[0]) - sys.argv[0] = argv0 - sys.argv.append(argv0) - main() - - def main(argv=None, **kw): from setuptools import setup from setuptools.dist import Distribution diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py index 8760ea304c..fb5b90b1a3 100644 --- a/setuptools/tests/test_bdist_egg.py +++ b/setuptools/tests/test_bdist_egg.py @@ -7,7 +7,6 @@ import pytest from setuptools.dist import Distribution -from setuptools import SetuptoolsDeprecationWarning from . import contexts @@ -65,17 +64,3 @@ def test_exclude_source_files(self, setup_context, user_override): names = list(zi.filename for zi in zip.filelist) assert 'hi.pyc' in names assert 'hi.py' not in names - - def test_eggsecutable_warning(self, setup_context, user_override): - dist = Distribution(dict( - script_name='setup.py', - script_args=['bdist_egg'], - name='foo', - py_modules=['hi'], - entry_points={ - 'setuptools.installation': - ['eggsecutable = my_package.some_module:main_func']}, - )) - dist.parse_command_line() - with pytest.warns(SetuptoolsDeprecationWarning): - dist.run_commands() From c0660de32f80ad71b3940abcb26b237ca2103876 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 23 Jan 2021 19:07:21 -0500 Subject: [PATCH 2/2] Update changelog. --- changelog.d/2545.breaking.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2545.breaking.rst diff --git a/changelog.d/2545.breaking.rst b/changelog.d/2545.breaking.rst new file mode 100644 index 0000000000..0c69fdf34d --- /dev/null +++ b/changelog.d/2545.breaking.rst @@ -0,0 +1 @@ +Removed support for eggsecutables.