[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-04-13 00:00:18 +00:00
parent 72ad6dc953
commit f4cd1ba0d6
813 changed files with 66015 additions and 58839 deletions

View file

@ -1,30 +1,35 @@
from distutils import log, dir_util
from __future__ import annotations
import os
import pkg_resources
from distutils import dir_util
from distutils import log
from setuptools import Command
from setuptools import namespaces
from setuptools.archive_util import unpack_archive
import pkg_resources
class install_egg_info(namespaces.Installer, Command):
"""Install an .egg-info directory for the package"""
description = "Install an .egg-info directory for the package"
description = 'Install an .egg-info directory for the package'
user_options = [
('install-dir=', 'd', "directory to install to"),
('install-dir=', 'd', 'directory to install to'),
]
def initialize_options(self):
self.install_dir = None
def finalize_options(self):
self.set_undefined_options('install_lib',
('install_dir', 'install_dir'))
ei_cmd = self.get_finalized_command("egg_info")
self.set_undefined_options(
'install_lib',
('install_dir', 'install_dir'),
)
ei_cmd = self.get_finalized_command('egg_info')
basename = pkg_resources.Distribution(
None, None, ei_cmd.egg_name, ei_cmd.egg_version
None, None, ei_cmd.egg_name, ei_cmd.egg_version,
).egg_name() + '.egg-info'
self.source = ei_cmd.egg_info
self.target = os.path.join(self.install_dir, basename)
@ -35,11 +40,11 @@ class install_egg_info(namespaces.Installer, Command):
if os.path.isdir(self.target) and not os.path.islink(self.target):
dir_util.remove_tree(self.target, dry_run=self.dry_run)
elif os.path.exists(self.target):
self.execute(os.unlink, (self.target,), "Removing " + self.target)
self.execute(os.unlink, (self.target,), 'Removing ' + self.target)
if not self.dry_run:
pkg_resources.ensure_directory(self.target)
self.execute(
self.copytree, (), "Copying %s to %s" % (self.source, self.target)
self.copytree, (), 'Copying {} to {}'.format(self.source, self.target),
)
self.install_namespaces()
@ -56,7 +61,7 @@ class install_egg_info(namespaces.Installer, Command):
if src.startswith(skip) or '/' + skip in src:
return None
self.outputs.append(dst)
log.debug("Copying %s to %s", src, dst)
log.debug('Copying %s to %s', src, dst)
return dst
unpack_archive(self.source, self.target, skimmer)