Commit 874b7ef0 authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

Merge pull request #1764 from venthur/fix/1557

Deprecated Eggsecutable Scripts
parents a5dec2f1 ce8e3ee1
Deprecated eggsecutable scripts and updated docs.
...@@ -560,6 +560,8 @@ Services and Plugins`_. ...@@ -560,6 +560,8 @@ Services and Plugins`_.
"Eggsecutable" Scripts "Eggsecutable" Scripts
---------------------- ----------------------
.. deprecated:: 45.3.0
Occasionally, there are situations where it's desirable to make an ``.egg`` 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 file directly executable. You can do this by including an entry point such
as the following:: as the following::
......
...@@ -11,13 +11,14 @@ import os ...@@ -11,13 +11,14 @@ import os
import re import re
import textwrap import textwrap
import marshal import marshal
import warnings
from setuptools.extern import six from setuptools.extern import six
from pkg_resources import get_build_platform, Distribution, ensure_directory from pkg_resources import get_build_platform, Distribution, ensure_directory
from pkg_resources import EntryPoint from pkg_resources import EntryPoint
from setuptools.extension import Library from setuptools.extension import Library
from setuptools import Command from setuptools import Command, SetuptoolsDeprecationWarning
try: try:
# Python 2.7 or >=3.2 # Python 2.7 or >=3.2
...@@ -278,6 +279,12 @@ class bdist_egg(Command): ...@@ -278,6 +279,12 @@ class bdist_egg(Command):
if ep is None: if ep is None:
return 'w' # not an eggsecutable, do it the usual way. 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: if not ep.attrs or ep.extras:
raise DistutilsSetupError( raise DistutilsSetupError(
"eggsecutable entry point (%r) cannot have 'extras' " "eggsecutable entry point (%r) cannot have 'extras' "
......
...@@ -7,6 +7,7 @@ import zipfile ...@@ -7,6 +7,7 @@ import zipfile
import pytest import pytest
from setuptools.dist import Distribution from setuptools.dist import Distribution
from setuptools import SetuptoolsDeprecationWarning
from . import contexts from . import contexts
...@@ -64,3 +65,17 @@ class Test: ...@@ -64,3 +65,17 @@ class Test:
names = list(zi.filename for zi in zip.filelist) names = list(zi.filename for zi in zip.filelist)
assert 'hi.pyc' in names assert 'hi.pyc' in names
assert 'hi.py' not 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()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment