Change venv
This commit is contained in:
@@ -4,17 +4,19 @@ import os
|
||||
import sys
|
||||
import io
|
||||
import contextlib
|
||||
from itertools import chain
|
||||
|
||||
from .py36compat import sdist_add_defaults
|
||||
|
||||
import pkg_resources
|
||||
from .._importlib import metadata
|
||||
from .build import _ORIGINAL_SUBCOMMANDS
|
||||
|
||||
_default_revctrl = list
|
||||
|
||||
|
||||
def walk_revctrl(dirname=''):
|
||||
"""Find all files under revision control"""
|
||||
for ep in pkg_resources.iter_entry_points('setuptools.file_finders'):
|
||||
for ep in metadata.entry_points(group='setuptools.file_finders'):
|
||||
for item in ep.load()(dirname):
|
||||
yield item
|
||||
|
||||
@@ -31,6 +33,10 @@ class sdist(sdist_add_defaults, orig.sdist):
|
||||
('dist-dir=', 'd',
|
||||
"directory to put the source distribution archive(s) in "
|
||||
"[default: dist]"),
|
||||
('owner=', 'u',
|
||||
"Owner name used when creating a tar file [default: current user]"),
|
||||
('group=', 'g',
|
||||
"Group name used when creating a tar file [default: current group]"),
|
||||
]
|
||||
|
||||
negative_opt = {}
|
||||
@@ -96,6 +102,10 @@ class sdist(sdist_add_defaults, orig.sdist):
|
||||
if orig_val is not NoValue:
|
||||
setattr(os, 'link', orig_val)
|
||||
|
||||
def add_defaults(self):
|
||||
super().add_defaults()
|
||||
self._add_defaults_build_sub_commands()
|
||||
|
||||
def _add_defaults_optional(self):
|
||||
super()._add_defaults_optional()
|
||||
if os.path.isfile('pyproject.toml'):
|
||||
@@ -108,14 +118,25 @@ class sdist(sdist_add_defaults, orig.sdist):
|
||||
self.filelist.extend(build_py.get_source_files())
|
||||
self._add_data_files(self._safe_data_files(build_py))
|
||||
|
||||
def _add_defaults_build_sub_commands(self):
|
||||
build = self.get_finalized_command("build")
|
||||
missing_cmds = set(build.get_sub_commands()) - _ORIGINAL_SUBCOMMANDS
|
||||
# ^-- the original built-in sub-commands are already handled by default.
|
||||
cmds = (self.get_finalized_command(c) for c in missing_cmds)
|
||||
files = (c.get_source_files() for c in cmds if hasattr(c, "get_source_files"))
|
||||
self.filelist.extend(chain.from_iterable(files))
|
||||
|
||||
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):
|
||||
|
Reference in New Issue
Block a user