更改enroll命名,添加了注释,向get_error_msg中添加了一些错误代码
This commit is contained in:
@@ -11,10 +11,9 @@ import re
|
||||
import textwrap
|
||||
import marshal
|
||||
|
||||
from pkg_resources import get_build_platform, Distribution
|
||||
from pkg_resources import get_build_platform, Distribution, ensure_directory
|
||||
from setuptools.extension import Library
|
||||
from setuptools import Command
|
||||
from .._path import ensure_directory
|
||||
|
||||
from sysconfig import get_path, get_python_version
|
||||
|
||||
|
||||
@@ -4,13 +4,9 @@ As defined in the wheel specification
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import warnings
|
||||
from inspect import cleandoc
|
||||
|
||||
from distutils.core import Command
|
||||
from distutils import log
|
||||
from setuptools.extern import packaging
|
||||
|
||||
|
||||
class dist_info(Command):
|
||||
@@ -33,36 +29,8 @@ class dist_info(Command):
|
||||
egg_info.egg_base = self.egg_base
|
||||
egg_info.finalize_options()
|
||||
egg_info.run()
|
||||
name = _safe(self.distribution.get_name())
|
||||
version = _version(self.distribution.get_version())
|
||||
base = self.egg_base or os.curdir
|
||||
dist_info_dir = os.path.join(base, f"{name}-{version}.dist-info")
|
||||
dist_info_dir = egg_info.egg_info[:-len('.egg-info')] + '.dist-info'
|
||||
log.info("creating '{}'".format(os.path.abspath(dist_info_dir)))
|
||||
|
||||
bdist_wheel = self.get_finalized_command('bdist_wheel')
|
||||
bdist_wheel.egg2dist(egg_info.egg_info, dist_info_dir)
|
||||
|
||||
|
||||
def _safe(component: str) -> str:
|
||||
"""Escape a component used to form a wheel name according to PEP 491"""
|
||||
return re.sub(r"[^\w\d.]+", "_", component)
|
||||
|
||||
|
||||
def _version(version: str) -> str:
|
||||
"""Convert an arbitrary string to a version string."""
|
||||
v = version.replace(' ', '.')
|
||||
try:
|
||||
return str(packaging.version.Version(v)).replace("-", "_")
|
||||
except packaging.version.InvalidVersion:
|
||||
msg = f"""!!\n\n
|
||||
###################
|
||||
# Invalid version #
|
||||
###################
|
||||
{version!r} is not valid according to PEP 440.\n
|
||||
Please make sure specify a valid version for your package.
|
||||
Also note that future releases of setuptools may halt the build process
|
||||
if an invalid version is given.
|
||||
\n\n!!
|
||||
"""
|
||||
warnings.warn(cleandoc(msg))
|
||||
return _safe(v).strip("_")
|
||||
|
||||
@@ -39,10 +39,9 @@ import subprocess
|
||||
import shlex
|
||||
import io
|
||||
import configparser
|
||||
import sysconfig
|
||||
|
||||
|
||||
from sysconfig import get_path
|
||||
from sysconfig import get_config_vars, get_path
|
||||
|
||||
from setuptools import SetuptoolsDeprecationWarning
|
||||
|
||||
@@ -56,21 +55,18 @@ from setuptools.package_index import (
|
||||
from setuptools.command import bdist_egg, egg_info
|
||||
from setuptools.wheel import Wheel
|
||||
from pkg_resources import (
|
||||
normalize_path, resource_string,
|
||||
yield_lines, normalize_path, resource_string, ensure_directory,
|
||||
get_distribution, find_distributions, Environment, Requirement,
|
||||
Distribution, PathMetadata, EggMetadata, WorkingSet, DistributionNotFound,
|
||||
VersionConflict, DEVELOP_DIST,
|
||||
)
|
||||
import pkg_resources
|
||||
from .._path import ensure_directory
|
||||
from ..extern.jaraco.text import yield_lines
|
||||
|
||||
|
||||
# Turn on PEP440Warnings
|
||||
warnings.filterwarnings("default", category=pkg_resources.PEP440Warning)
|
||||
|
||||
__all__ = [
|
||||
'easy_install', 'PthDistributions', 'extract_wininst_cfg',
|
||||
'samefile', 'easy_install', 'PthDistributions', 'extract_wininst_cfg',
|
||||
'get_exe_prefixes',
|
||||
]
|
||||
|
||||
@@ -79,6 +75,22 @@ def is_64bit():
|
||||
return struct.calcsize("P") == 8
|
||||
|
||||
|
||||
def samefile(p1, p2):
|
||||
"""
|
||||
Determine if two paths reference the same file.
|
||||
|
||||
Augments os.path.samefile to work on Windows and
|
||||
suppresses errors if the path doesn't exist.
|
||||
"""
|
||||
both_exist = os.path.exists(p1) and os.path.exists(p2)
|
||||
use_samefile = hasattr(os.path, 'samefile') and both_exist
|
||||
if use_samefile:
|
||||
return os.path.samefile(p1, p2)
|
||||
norm_p1 = os.path.normpath(os.path.normcase(p1))
|
||||
norm_p2 = os.path.normpath(os.path.normcase(p2))
|
||||
return norm_p1 == norm_p2
|
||||
|
||||
|
||||
def _to_bytes(s):
|
||||
return s.encode('utf8')
|
||||
|
||||
@@ -169,8 +181,12 @@ class easy_install(Command):
|
||||
self.install_data = None
|
||||
self.install_base = None
|
||||
self.install_platbase = None
|
||||
self.install_userbase = site.USER_BASE
|
||||
self.install_usersite = site.USER_SITE
|
||||
if site.ENABLE_USER_SITE:
|
||||
self.install_userbase = site.USER_BASE
|
||||
self.install_usersite = site.USER_SITE
|
||||
else:
|
||||
self.install_userbase = None
|
||||
self.install_usersite = None
|
||||
self.no_find_links = None
|
||||
|
||||
# Options not specifiable via command line
|
||||
@@ -220,22 +236,23 @@ class easy_install(Command):
|
||||
self.version and self._render_version()
|
||||
|
||||
py_version = sys.version.split()[0]
|
||||
prefix, exec_prefix = get_config_vars('prefix', 'exec_prefix')
|
||||
|
||||
self.config_vars = dict(sysconfig.get_config_vars())
|
||||
|
||||
self.config_vars.update({
|
||||
self.config_vars = {
|
||||
'dist_name': self.distribution.get_name(),
|
||||
'dist_version': self.distribution.get_version(),
|
||||
'dist_fullname': self.distribution.get_fullname(),
|
||||
'py_version': py_version,
|
||||
'py_version_short': f'{sys.version_info.major}.{sys.version_info.minor}',
|
||||
'py_version_nodot': f'{sys.version_info.major}{sys.version_info.minor}',
|
||||
'sys_prefix': self.config_vars['prefix'],
|
||||
'sys_exec_prefix': self.config_vars['exec_prefix'],
|
||||
'py_version_short': py_version[0:3],
|
||||
'py_version_nodot': py_version[0] + py_version[2],
|
||||
'sys_prefix': prefix,
|
||||
'prefix': prefix,
|
||||
'sys_exec_prefix': exec_prefix,
|
||||
'exec_prefix': exec_prefix,
|
||||
# Only python 3.2+ has abiflags
|
||||
'abiflags': getattr(sys, 'abiflags', ''),
|
||||
'platlibdir': getattr(sys, 'platlibdir', 'lib'),
|
||||
})
|
||||
}
|
||||
with contextlib.suppress(AttributeError):
|
||||
# only for distutils outside stdlib
|
||||
self.config_vars.update({
|
||||
@@ -243,15 +260,11 @@ class easy_install(Command):
|
||||
'implementation': install._get_implementation(),
|
||||
})
|
||||
|
||||
# pypa/distutils#113 Python 3.9 compat
|
||||
self.config_vars.setdefault(
|
||||
'py_version_nodot_plat',
|
||||
getattr(sys, 'windir', '').replace('.', ''),
|
||||
)
|
||||
if site.ENABLE_USER_SITE:
|
||||
self.config_vars['userbase'] = self.install_userbase
|
||||
self.config_vars['usersite'] = self.install_usersite
|
||||
|
||||
self.config_vars['userbase'] = self.install_userbase
|
||||
self.config_vars['usersite'] = self.install_usersite
|
||||
if self.user and not site.ENABLE_USER_SITE:
|
||||
elif self.user:
|
||||
log.warn("WARNING: The user site-packages directory is disabled.")
|
||||
|
||||
self._fix_install_dir_for_user_site()
|
||||
@@ -287,14 +300,27 @@ class easy_install(Command):
|
||||
self.script_dir = self.install_scripts
|
||||
# default --record from the install command
|
||||
self.set_undefined_options('install', ('record', 'record'))
|
||||
# Should this be moved to the if statement below? It's not used
|
||||
# elsewhere
|
||||
normpath = map(normalize_path, sys.path)
|
||||
self.all_site_dirs = get_site_dirs()
|
||||
self.all_site_dirs.extend(self._process_site_dirs(self.site_dirs))
|
||||
|
||||
if self.site_dirs is not None:
|
||||
site_dirs = [
|
||||
os.path.expanduser(s.strip()) for s in
|
||||
self.site_dirs.split(',')
|
||||
]
|
||||
for d in site_dirs:
|
||||
if not os.path.isdir(d):
|
||||
log.warn("%s (in --site-dirs) does not exist", d)
|
||||
elif normalize_path(d) not in normpath:
|
||||
raise DistutilsOptionError(
|
||||
d + " (in --site-dirs) is not on sys.path"
|
||||
)
|
||||
else:
|
||||
self.all_site_dirs.append(normalize_path(d))
|
||||
if not self.editable:
|
||||
self.check_site_dir()
|
||||
default_index = os.getenv("__EASYINSTALL_INDEX", "https://pypi.org/simple/")
|
||||
# ^ Private API for testing purposes only
|
||||
self.index_url = self.index_url or default_index
|
||||
self.index_url = self.index_url or "https://pypi.org/simple/"
|
||||
self.shadow_path = self.all_site_dirs[:]
|
||||
for path_item in self.install_dir, normalize_path(self.script_dir):
|
||||
if path_item not in self.shadow_path:
|
||||
@@ -320,7 +346,15 @@ class easy_install(Command):
|
||||
if not self.no_find_links:
|
||||
self.package_index.add_find_links(self.find_links)
|
||||
self.set_undefined_options('install_lib', ('optimize', 'optimize'))
|
||||
self.optimize = self._validate_optimize(self.optimize)
|
||||
if not isinstance(self.optimize, int):
|
||||
try:
|
||||
self.optimize = int(self.optimize)
|
||||
if not (0 <= self.optimize <= 2):
|
||||
raise ValueError
|
||||
except ValueError as e:
|
||||
raise DistutilsOptionError(
|
||||
"--optimize must be 0, 1, or 2"
|
||||
) from e
|
||||
|
||||
if self.editable and not self.build_directory:
|
||||
raise DistutilsArgError(
|
||||
@@ -332,44 +366,11 @@ class easy_install(Command):
|
||||
|
||||
self.outputs = []
|
||||
|
||||
@staticmethod
|
||||
def _process_site_dirs(site_dirs):
|
||||
if site_dirs is None:
|
||||
return
|
||||
|
||||
normpath = map(normalize_path, sys.path)
|
||||
site_dirs = [
|
||||
os.path.expanduser(s.strip()) for s in
|
||||
site_dirs.split(',')
|
||||
]
|
||||
for d in site_dirs:
|
||||
if not os.path.isdir(d):
|
||||
log.warn("%s (in --site-dirs) does not exist", d)
|
||||
elif normalize_path(d) not in normpath:
|
||||
raise DistutilsOptionError(
|
||||
d + " (in --site-dirs) is not on sys.path"
|
||||
)
|
||||
else:
|
||||
yield normalize_path(d)
|
||||
|
||||
@staticmethod
|
||||
def _validate_optimize(value):
|
||||
try:
|
||||
value = int(value)
|
||||
if value not in range(3):
|
||||
raise ValueError
|
||||
except ValueError as e:
|
||||
raise DistutilsOptionError(
|
||||
"--optimize must be 0, 1, or 2"
|
||||
) from e
|
||||
|
||||
return value
|
||||
|
||||
def _fix_install_dir_for_user_site(self):
|
||||
"""
|
||||
Fix the install_dir if "--user" was used.
|
||||
"""
|
||||
if not self.user:
|
||||
if not self.user or not site.ENABLE_USER_SITE:
|
||||
return
|
||||
|
||||
self.create_home_path()
|
||||
@@ -918,9 +919,7 @@ class easy_install(Command):
|
||||
ensure_directory(destination)
|
||||
|
||||
dist = self.egg_distribution(egg_path)
|
||||
if not (
|
||||
os.path.exists(destination) and os.path.samefile(egg_path, destination)
|
||||
):
|
||||
if not samefile(egg_path, destination):
|
||||
if os.path.isdir(destination) and not os.path.islink(destination):
|
||||
dir_util.remove_tree(destination, dry_run=self.dry_run)
|
||||
elif os.path.exists(destination):
|
||||
@@ -1329,7 +1328,7 @@ class easy_install(Command):
|
||||
if not self.user:
|
||||
return
|
||||
home = convert_path(os.path.expanduser("~"))
|
||||
for path in only_strs(self.config_vars.values()):
|
||||
for name, path in self.config_vars.items():
|
||||
if path.startswith(home) and not os.path.isdir(path):
|
||||
self.debug_print("os.makedirs('%s', 0o700)" % path)
|
||||
os.makedirs(path, 0o700)
|
||||
@@ -1351,7 +1350,7 @@ class easy_install(Command):
|
||||
|
||||
if self.prefix:
|
||||
# Set default install_dir/scripts from --prefix
|
||||
config_vars = dict(config_vars)
|
||||
config_vars = config_vars.copy()
|
||||
config_vars['base'] = self.prefix
|
||||
scheme = self.INSTALL_SCHEMES.get(os.name, self.DEFAULT_SCHEME)
|
||||
for attr, val in scheme.items():
|
||||
@@ -1578,7 +1577,7 @@ class PthDistributions(Environment):
|
||||
self.sitedirs = list(map(normalize_path, sitedirs))
|
||||
self.basedir = normalize_path(os.path.dirname(self.filename))
|
||||
self._load()
|
||||
super().__init__([], None, None)
|
||||
Environment.__init__(self, [], None, None)
|
||||
for path in yield_lines(self.paths):
|
||||
list(map(self.add, find_distributions(path, True)))
|
||||
|
||||
@@ -1651,14 +1650,14 @@ class PthDistributions(Environment):
|
||||
if new_path:
|
||||
self.paths.append(dist.location)
|
||||
self.dirty = True
|
||||
super().add(dist)
|
||||
Environment.add(self, dist)
|
||||
|
||||
def remove(self, dist):
|
||||
"""Remove `dist` from the distribution map"""
|
||||
while dist.location in self.paths:
|
||||
self.paths.remove(dist.location)
|
||||
self.dirty = True
|
||||
super().remove(dist)
|
||||
Environment.remove(self, dist)
|
||||
|
||||
def make_relative(self, path):
|
||||
npath, last = os.path.split(normalize_path(path))
|
||||
@@ -2299,13 +2298,6 @@ def current_umask():
|
||||
return tmp
|
||||
|
||||
|
||||
def only_strs(values):
|
||||
"""
|
||||
Exclude non-str values. Ref #3063.
|
||||
"""
|
||||
return filter(lambda val: isinstance(val, str), values)
|
||||
|
||||
|
||||
class EasyInstallDeprecationWarning(SetuptoolsDeprecationWarning):
|
||||
"""
|
||||
Warning for EasyInstall deprecations, bypassing suppression.
|
||||
|
||||
@@ -17,22 +17,18 @@ import warnings
|
||||
import time
|
||||
import collections
|
||||
|
||||
from .._importlib import metadata
|
||||
from .. import _entry_points
|
||||
|
||||
from setuptools import Command
|
||||
from setuptools.command.sdist import sdist
|
||||
from setuptools.command.sdist import walk_revctrl
|
||||
from setuptools.command.setopt import edit_config
|
||||
from setuptools.command import bdist_egg
|
||||
from pkg_resources import (
|
||||
Requirement, safe_name, parse_version,
|
||||
safe_version, to_filename)
|
||||
parse_requirements, safe_name, parse_version,
|
||||
safe_version, yield_lines, EntryPoint, iter_entry_points, to_filename)
|
||||
import setuptools.unicode_utils as unicode_utils
|
||||
from setuptools.glob import glob
|
||||
|
||||
from setuptools.extern import packaging
|
||||
from setuptools.extern.jaraco.text import yield_lines
|
||||
from setuptools import SetuptoolsDeprecationWarning
|
||||
|
||||
|
||||
@@ -136,21 +132,11 @@ class InfoCommon:
|
||||
in which case the version string already contains all tags.
|
||||
"""
|
||||
return (
|
||||
version if self.vtags and self._already_tagged(version)
|
||||
version if self.vtags and version.endswith(self.vtags)
|
||||
else version + self.vtags
|
||||
)
|
||||
|
||||
def _already_tagged(self, version: str) -> bool:
|
||||
# Depending on their format, tags may change with version normalization.
|
||||
# So in addition the regular tags, we have to search for the normalized ones.
|
||||
return version.endswith(self.vtags) or version.endswith(self._safe_tags())
|
||||
|
||||
def _safe_tags(self) -> str:
|
||||
# To implement this we can rely on `safe_version` pretending to be version 0
|
||||
# followed by tags. Then we simply discard the starting 0 (fake version number)
|
||||
return safe_version(f"0{self.vtags}")[1:]
|
||||
|
||||
def tags(self) -> str:
|
||||
def tags(self):
|
||||
version = ''
|
||||
if self.tag_build:
|
||||
version += self.tag_build
|
||||
@@ -219,8 +205,12 @@ class egg_info(InfoCommon, Command):
|
||||
|
||||
try:
|
||||
is_version = isinstance(parsed_version, packaging.version.Version)
|
||||
spec = "%s==%s" if is_version else "%s===%s"
|
||||
Requirement(spec % (self.egg_name, self.egg_version))
|
||||
spec = (
|
||||
"%s==%s" if is_version else "%s===%s"
|
||||
)
|
||||
list(
|
||||
parse_requirements(spec % (self.egg_name, self.egg_version))
|
||||
)
|
||||
except ValueError as e:
|
||||
raise distutils.errors.DistutilsOptionError(
|
||||
"Invalid distribution name or version syntax: %s-%s" %
|
||||
@@ -295,9 +285,10 @@ class egg_info(InfoCommon, Command):
|
||||
def run(self):
|
||||
self.mkpath(self.egg_info)
|
||||
os.utime(self.egg_info, None)
|
||||
for ep in metadata.entry_points(group='egg_info.writers'):
|
||||
self.distribution._install_dependencies(ep)
|
||||
writer = ep.load()
|
||||
installer = self.distribution.fetch_build_egg
|
||||
for ep in iter_entry_points('egg_info.writers'):
|
||||
ep.require(installer=installer)
|
||||
writer = ep.resolve()
|
||||
writer(self, ep.name, os.path.join(self.egg_info, ep.name))
|
||||
|
||||
# Get rid of native_libs.txt if it was put there by older bdist_egg
|
||||
@@ -728,9 +719,20 @@ def write_arg(cmd, basename, filename, force=False):
|
||||
|
||||
|
||||
def write_entries(cmd, basename, filename):
|
||||
eps = _entry_points.load(cmd.distribution.entry_points)
|
||||
defn = _entry_points.render(eps)
|
||||
cmd.write_or_delete_file('entry points', filename, defn, True)
|
||||
ep = cmd.distribution.entry_points
|
||||
|
||||
if isinstance(ep, str) or ep is None:
|
||||
data = ep
|
||||
elif ep is not None:
|
||||
data = []
|
||||
for section, contents in sorted(ep.items()):
|
||||
if not isinstance(contents, str):
|
||||
contents = EntryPoint.parse_group(section, contents)
|
||||
contents = '\n'.join(sorted(map(str, contents.values())))
|
||||
data.append('[%s]\n%s\n\n' % (section, contents))
|
||||
data = ''.join(data)
|
||||
|
||||
cmd.write_or_delete_file('entry points', filename, data, True)
|
||||
|
||||
|
||||
def get_pkg_info_revision():
|
||||
|
||||
@@ -91,21 +91,14 @@ class install(orig.install):
|
||||
msg = "For best results, pass -X:Frames to enable call stack."
|
||||
warnings.warn(msg)
|
||||
return True
|
||||
|
||||
frames = inspect.getouterframes(run_frame)
|
||||
for frame in frames[2:4]:
|
||||
caller, = frame[:1]
|
||||
info = inspect.getframeinfo(caller)
|
||||
caller_module = caller.f_globals.get('__name__', '')
|
||||
|
||||
if caller_module == "setuptools.dist" and info.function == "run_command":
|
||||
# Starting from v61.0.0 setuptools overwrites dist.run_command
|
||||
continue
|
||||
|
||||
return (
|
||||
caller_module == 'distutils.dist'
|
||||
and info.function == 'run_commands'
|
||||
)
|
||||
res = inspect.getouterframes(run_frame)[2]
|
||||
caller, = res[:1]
|
||||
info = inspect.getframeinfo(caller)
|
||||
caller_module = caller.f_globals.get('__name__', '')
|
||||
return (
|
||||
caller_module == 'distutils.dist'
|
||||
and info.function == 'run_commands'
|
||||
)
|
||||
|
||||
def do_egg_install(self):
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import os
|
||||
from setuptools import Command
|
||||
from setuptools import namespaces
|
||||
from setuptools.archive_util import unpack_archive
|
||||
from .._path import ensure_directory
|
||||
import pkg_resources
|
||||
|
||||
|
||||
@@ -38,7 +37,7 @@ class install_egg_info(namespaces.Installer, Command):
|
||||
elif os.path.exists(self.target):
|
||||
self.execute(os.unlink, (self.target,), "Removing " + self.target)
|
||||
if not self.dry_run:
|
||||
ensure_directory(self.target)
|
||||
pkg_resources.ensure_directory(self.target)
|
||||
self.execute(
|
||||
self.copytree, (), "Copying %s to %s" % (self.source, self.target)
|
||||
)
|
||||
|
||||
@@ -4,8 +4,7 @@ from distutils.errors import DistutilsModuleError
|
||||
import os
|
||||
import sys
|
||||
|
||||
from pkg_resources import Distribution, PathMetadata
|
||||
from .._path import ensure_directory
|
||||
from pkg_resources import Distribution, PathMetadata, ensure_directory
|
||||
|
||||
|
||||
class install_scripts(orig.install_scripts):
|
||||
|
||||
@@ -7,14 +7,14 @@ import contextlib
|
||||
|
||||
from .py36compat import sdist_add_defaults
|
||||
|
||||
from .._importlib import metadata
|
||||
import pkg_resources
|
||||
|
||||
_default_revctrl = list
|
||||
|
||||
|
||||
def walk_revctrl(dirname=''):
|
||||
"""Find all files under revision control"""
|
||||
for ep in metadata.entry_points(group='setuptools.file_finders'):
|
||||
for ep in pkg_resources.iter_entry_points('setuptools.file_finders'):
|
||||
for item in ep.load()(dirname):
|
||||
yield item
|
||||
|
||||
|
||||
@@ -16,11 +16,10 @@ from pkg_resources import (
|
||||
evaluate_marker,
|
||||
add_activation_listener,
|
||||
require,
|
||||
EntryPoint,
|
||||
)
|
||||
from .._importlib import metadata
|
||||
from setuptools import Command
|
||||
from setuptools.extern.more_itertools import unique_everseen
|
||||
from setuptools.extern.jaraco.functools import pass_none
|
||||
|
||||
|
||||
class ScanningLoader(TestLoader):
|
||||
@@ -242,10 +241,12 @@ class test(Command):
|
||||
return ['unittest'] + self.test_args
|
||||
|
||||
@staticmethod
|
||||
@pass_none
|
||||
def _resolve_as_ep(val):
|
||||
"""
|
||||
Load the indicated attribute value, called, as a as if it were
|
||||
specified as an entry point.
|
||||
"""
|
||||
return metadata.EntryPoint(value=val, name=None, group=None).load()()
|
||||
if val is None:
|
||||
return
|
||||
parsed = EntryPoint.parse("x=" + val)
|
||||
return parsed.resolve()()
|
||||
|
||||
@@ -17,11 +17,8 @@ import itertools
|
||||
import functools
|
||||
import http.client
|
||||
import urllib.parse
|
||||
import warnings
|
||||
|
||||
from .._importlib import metadata
|
||||
from .. import SetuptoolsDeprecationWarning
|
||||
|
||||
from pkg_resources import iter_entry_points
|
||||
from .upload import upload
|
||||
|
||||
|
||||
@@ -46,10 +43,9 @@ class upload_docs(upload):
|
||||
boolean_options = upload.boolean_options
|
||||
|
||||
def has_sphinx(self):
|
||||
return bool(
|
||||
self.upload_dir is None
|
||||
and metadata.entry_points(group='distutils.commands', name='build_sphinx')
|
||||
)
|
||||
if self.upload_dir is None:
|
||||
for ep in iter_entry_points('distutils.commands', 'build_sphinx'):
|
||||
return True
|
||||
|
||||
sub_commands = [('build_sphinx', has_sphinx)]
|
||||
|
||||
@@ -91,12 +87,6 @@ class upload_docs(upload):
|
||||
zip_file.close()
|
||||
|
||||
def run(self):
|
||||
warnings.warn(
|
||||
"upload_docs is deprecated and will be removed in a future "
|
||||
"version. Use tools like httpie or curl instead.",
|
||||
SetuptoolsDeprecationWarning,
|
||||
)
|
||||
|
||||
# Run sub commands
|
||||
for cmd_name in self.get_sub_commands():
|
||||
self.run_command(cmd_name)
|
||||
|
||||
Reference in New Issue
Block a user