This commit is contained in:
ton
2024-10-07 10:13:40 +07:00
parent aa1631742f
commit 3a7d696db6
9729 changed files with 1832837 additions and 161742 deletions

View File

@@ -5,14 +5,15 @@ As defined in the wheel specification
import os
import shutil
import sys
from contextlib import contextmanager
from distutils import log
from distutils.core import Command
from pathlib import Path
from typing import cast
from .. import _normalization
from ..warnings import SetuptoolsDeprecationWarning
from .egg_info import egg_info as egg_info_cls
from distutils import log
from distutils.core import Command
class dist_info(Command):
@@ -24,18 +25,11 @@ class dist_info(Command):
description = "DO NOT CALL DIRECTLY, INTERNAL ONLY: create .dist-info directory"
user_options = [
(
'egg-base=',
'e',
"directory containing .egg-info directories"
" (default: top of the source tree)"
" DEPRECATED: use --output-dir.",
),
(
'output-dir=',
'o',
"directory inside of which the .dist-info will be"
"created (default: top of the source tree)",
"created [default: top of the source tree]",
),
('tag-date', 'd', "Add date stamp (e.g. 20050528) to version number"),
('tag-build=', 'b', "Specify explicit tag to add to version number"),
@@ -47,7 +41,6 @@ class dist_info(Command):
negative_opt = {'no-date': 'tag-date'}
def initialize_options(self):
self.egg_base = None
self.output_dir = None
self.name = None
self.dist_info_dir = None
@@ -56,18 +49,11 @@ class dist_info(Command):
self.keep_egg_info = False
def finalize_options(self):
if self.egg_base:
msg = "--egg-base is deprecated for dist_info command. Use --output-dir."
SetuptoolsDeprecationWarning.emit(msg, due_date=(2023, 9, 26))
# This command is internal to setuptools, therefore it should be safe
# to remove the deprecated support soon.
self.output_dir = self.egg_base or self.output_dir
dist = self.distribution
project_dir = dist.src_root or os.curdir
self.output_dir = Path(self.output_dir or project_dir)
egg_info = self.reinitialize_command("egg_info")
egg_info = cast(egg_info_cls, self.reinitialize_command("egg_info"))
egg_info.egg_base = str(self.output_dir)
if self.tag_date:
@@ -93,7 +79,7 @@ class dist_info(Command):
if requires_bkp:
bkp_name = f"{dir_path}.__bkp__"
_rm(bkp_name, ignore_errors=True)
_copy(dir_path, bkp_name, dirs_exist_ok=True, symlinks=True)
shutil.copytree(dir_path, bkp_name, dirs_exist_ok=True, symlinks=True)
try:
yield
finally:
@@ -119,9 +105,3 @@ class dist_info(Command):
def _rm(dir_name, **opts):
if os.path.isdir(dir_name):
shutil.rmtree(dir_name, **opts)
def _copy(src, dst, **opts):
if sys.version_info < (3, 8):
opts.pop("dirs_exist_ok", None)
shutil.copytree(src, dst, **opts)