summaryrefslogtreecommitdiff
path: root/setuptools/command
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-11-14 17:41:08 -0500
committerGitHub <noreply@github.com>2021-11-14 17:41:08 -0500
commit5b75de07169ef13952a5ab48e0b8bc15f31d0c37 (patch)
tree13b02b20c66d6f5fca7905285ee609a5ad72acb6 /setuptools/command
parent6fc5d3099898fc3d06bcf72f1f6607d02124d60f (diff)
parent5141c4210c2a63a3bb54f0f512e4116faedc8d63 (diff)
downloadpython-setuptools-git-debt/remove-legacy-version.tar.gz
Merge branch 'main' into debt/remove-legacy-versiondebt/remove-legacy-version
Diffstat (limited to 'setuptools/command')
-rw-r--r--setuptools/command/build_py.py10
-rw-r--r--setuptools/command/easy_install.py6
-rw-r--r--setuptools/command/egg_info.py21
-rw-r--r--setuptools/command/install.py7
-rw-r--r--setuptools/command/sdist.py13
5 files changed, 52 insertions, 5 deletions
diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py
index 6a615433..c3fdc092 100644
--- a/setuptools/command/build_py.py
+++ b/setuptools/command/build_py.py
@@ -67,6 +67,16 @@ class build_py(orig.build_py):
self.analyze_manifest()
return list(map(self._get_pkg_data_files, self.packages or ()))
+ def get_data_files_without_manifest(self):
+ """
+ Generate list of ``(package,src_dir,build_dir,filenames)`` tuples,
+ but without triggering any attempt to analyze or build the manifest.
+ """
+ # Prevent eventual errors from unset `manifest_files`
+ # (that would otherwise be set by `analyze_manifest`)
+ self.__dict__.setdefault('manifest_files', {})
+ return list(map(self._get_pkg_data_files, self.packages or ()))
+
def _get_pkg_data_files(self, package):
# Locate package source directory
src_dir = self.get_package_dir(package)
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index b88c3e9a..1aed0e87 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -153,6 +153,12 @@ class easy_install(Command):
create_index = PackageIndex
def initialize_options(self):
+ warnings.warn(
+ "easy_install command is deprecated. "
+ "Use build and pip and other standards-based tools.",
+ EasyInstallDeprecationWarning,
+ )
+
# the --user option seems to be an opt-in one,
# so the default should be False.
self.user = 0
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 57bc7982..d7abfe38 100644
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -608,6 +608,27 @@ class manifest_maker(sdist):
self.filelist.exclude_pattern(r'(^|' + sep + r')(RCS|CVS|\.svn)' + sep,
is_regex=1)
+ def _safe_data_files(self, build_py):
+ """
+ The parent class implementation of this method
+ (``sdist``) will try to include data files, which
+ might cause recursion problems when
+ ``include_package_data=True``.
+
+ Therefore, avoid triggering any attempt of
+ analyzing/building the manifest again.
+ """
+ if hasattr(build_py, 'get_data_files_without_manifest'):
+ return build_py.get_data_files_without_manifest()
+
+ warnings.warn(
+ "Custom 'build_py' does not implement "
+ "'get_data_files_without_manifest'.\nPlease extend command classes"
+ " from setuptools instead of distutils.",
+ SetuptoolsDeprecationWarning
+ )
+ return build_py.get_data_files()
+
def write_file(filename, contents):
"""Create a file with the specified name and write 'contents' (a
diff --git a/setuptools/command/install.py b/setuptools/command/install.py
index 72b9a3e4..35e54d20 100644
--- a/setuptools/command/install.py
+++ b/setuptools/command/install.py
@@ -30,6 +30,13 @@ class install(orig.install):
_nc = dict(new_commands)
def initialize_options(self):
+
+ warnings.warn(
+ "setup.py install is deprecated. "
+ "Use build and pip and other standards-based tools.",
+ setuptools.SetuptoolsDeprecationWarning,
+ )
+
orig.install.initialize_options(self)
self.old_and_unmanageable = None
self.single_version_externally_managed = None
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
index e8062f2e..0285b690 100644
--- a/setuptools/command/sdist.py
+++ b/setuptools/command/sdist.py
@@ -114,12 +114,15 @@ class sdist(sdist_add_defaults, orig.sdist):
def _safe_data_files(self, build_py):
"""
- Extracting data_files from build_py is known to cause
- infinite recursion errors when `include_package_data`
- is enabled, so suppress it in that case.
+ Since the ``sdist`` class is also used to compute the MANIFEST
+ (via :obj:`setuptools.command.egg_info.manifest_maker`),
+ there might be recursion problems when trying to obtain the list of
+ data_files and ``include_package_data=True`` (which in turn depends on
+ the files included in the MANIFEST).
+
+ To avoid that, ``manifest_maker`` should be able to overwrite this
+ method and avoid recursive attempts to build/analyze the MANIFEST.
"""
- if self.distribution.include_package_data:
- return ()
return build_py.data_files
def _add_data_files(self, data_files):