mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-09 04:54:16 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
72ad6dc953
commit
f4cd1ba0d6
813 changed files with 66015 additions and 58839 deletions
|
|
@ -1,42 +1,49 @@
|
|||
from distutils import log
|
||||
import distutils.command.sdist as orig
|
||||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
import io
|
||||
import contextlib
|
||||
|
||||
import distutils.command.sdist as orig
|
||||
import pkg_resources
|
||||
from distutils import log
|
||||
|
||||
from .py36compat import sdist_add_defaults
|
||||
|
||||
import pkg_resources
|
||||
|
||||
_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 item in ep.load()(dirname):
|
||||
yield item
|
||||
yield from ep.load()(dirname)
|
||||
|
||||
|
||||
class sdist(sdist_add_defaults, orig.sdist):
|
||||
"""Smart sdist that finds anything supported by revision control"""
|
||||
|
||||
user_options = [
|
||||
('formats=', None,
|
||||
"formats for source distribution (comma-separated list)"),
|
||||
('keep-temp', 'k',
|
||||
"keep the distribution tree around after creating " +
|
||||
"archive file(s)"),
|
||||
('dist-dir=', 'd',
|
||||
"directory to put the source distribution archive(s) in "
|
||||
"[default: dist]"),
|
||||
(
|
||||
'formats=', None,
|
||||
'formats for source distribution (comma-separated list)',
|
||||
),
|
||||
(
|
||||
'keep-temp', 'k',
|
||||
'keep the distribution tree around after creating ' +
|
||||
'archive file(s)',
|
||||
),
|
||||
(
|
||||
'dist-dir=', 'd',
|
||||
'directory to put the source distribution archive(s) in '
|
||||
'[default: dist]',
|
||||
),
|
||||
]
|
||||
|
||||
negative_opt = {}
|
||||
|
||||
README_EXTENSIONS = ['', '.rst', '.txt', '.md']
|
||||
READMES = tuple('README{0}'.format(ext) for ext in README_EXTENSIONS)
|
||||
READMES = tuple(f'README{ext}' for ext in README_EXTENSIONS)
|
||||
|
||||
def run(self):
|
||||
self.run_command('egg_info')
|
||||
|
|
@ -132,7 +139,7 @@ class sdist(sdist_add_defaults, orig.sdist):
|
|||
try:
|
||||
super()._add_defaults_data_files()
|
||||
except TypeError:
|
||||
log.warn("data_files contains unexpected objects")
|
||||
log.warn('data_files contains unexpected objects')
|
||||
|
||||
def check_readme(self):
|
||||
for f in self.READMES:
|
||||
|
|
@ -140,8 +147,8 @@ class sdist(sdist_add_defaults, orig.sdist):
|
|||
return
|
||||
else:
|
||||
self.warn(
|
||||
"standard file not found: should have one of " +
|
||||
', '.join(self.READMES)
|
||||
'standard file not found: should have one of ' +
|
||||
', '.join(self.READMES),
|
||||
)
|
||||
|
||||
def make_release_tree(self, base_dir, files):
|
||||
|
|
@ -162,10 +169,12 @@ class sdist(sdist_add_defaults, orig.sdist):
|
|||
if not os.path.isfile(self.manifest):
|
||||
return False
|
||||
|
||||
with io.open(self.manifest, 'rb') as fp:
|
||||
with open(self.manifest, 'rb') as fp:
|
||||
first_line = fp.readline()
|
||||
return (first_line !=
|
||||
'# file GENERATED by distutils, do NOT edit\n'.encode())
|
||||
return (
|
||||
first_line !=
|
||||
b'# file GENERATED by distutils, do NOT edit\n'
|
||||
)
|
||||
|
||||
def read_manifest(self):
|
||||
"""Read the manifest file (named by 'self.manifest') and use it to
|
||||
|
|
@ -179,7 +188,7 @@ class sdist(sdist_add_defaults, orig.sdist):
|
|||
try:
|
||||
line = line.decode('UTF-8')
|
||||
except UnicodeDecodeError:
|
||||
log.warn("%r not UTF-8 decodable -- skipping" % line)
|
||||
log.warn('%r not UTF-8 decodable -- skipping' % line)
|
||||
continue
|
||||
# ignore comments and blank lines
|
||||
line = line.strip()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue