Skip to content

Deprecated Eggsecutable Scripts #1764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1557.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deprecated eggsecutable scripts and updated docs.
2 changes: 2 additions & 0 deletions docs/setuptools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,8 @@ Services and Plugins`_.
"Eggsecutable" Scripts
----------------------

.. deprecated:: 45.3.0

Occasionally, there are situations where it's desirable to make an ``.egg``
file directly executable. You can do this by including an entry point such
as the following::
Expand Down
9 changes: 8 additions & 1 deletion setuptools/command/bdist_egg.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
import re
import textwrap
import marshal
import warnings

from setuptools.extern import six

from pkg_resources import get_build_platform, Distribution, ensure_directory
from pkg_resources import EntryPoint
from setuptools.extension import Library
from setuptools import Command
from setuptools import Command, SetuptoolsDeprecationWarning

try:
# Python 2.7 or >=3.2
Expand Down Expand Up @@ -278,6 +279,12 @@ def gen_header(self):
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' "
Expand Down
15 changes: 15 additions & 0 deletions setuptools/tests/test_bdist_egg.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pytest

from setuptools.dist import Distribution
from setuptools import SetuptoolsDeprecationWarning

from . import contexts

Expand Down Expand Up @@ -64,3 +65,17 @@ 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()