mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Review updates
This commit is contained in:
parent
33f48e2b72
commit
d509a27ad4
3 changed files with 15 additions and 49 deletions
|
@ -166,11 +166,13 @@ def _copy_source_tree(source, target):
|
||||||
skipped += [target_basename]
|
skipped += [target_basename]
|
||||||
return skipped
|
return skipped
|
||||||
|
|
||||||
kwargs = dict(ignore=ignore, symlinks=True) # type: CopytreeKwargs
|
shutil.copytree(
|
||||||
|
source,
|
||||||
kwargs['copy_function'] = _copy2_ignoring_special_files
|
target,
|
||||||
|
ignore=ignore,
|
||||||
shutil.copytree(source, target, **kwargs)
|
symlinks=True,
|
||||||
|
copy_function=_copy2_ignoring_special_files,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_file_url(
|
def get_file_url(
|
||||||
|
|
|
@ -24,9 +24,7 @@ def _is_list_of_str(obj):
|
||||||
|
|
||||||
def make_pyproject_path(unpacked_source_directory):
|
def make_pyproject_path(unpacked_source_directory):
|
||||||
# type: (str) -> str
|
# type: (str) -> str
|
||||||
path = os.path.join(unpacked_source_directory, 'pyproject.toml')
|
return os.path.join(unpacked_source_directory, 'pyproject.toml')
|
||||||
|
|
||||||
return path
|
|
||||||
|
|
||||||
|
|
||||||
BuildSystemDetails = namedtuple('BuildSystemDetails', [
|
BuildSystemDetails = namedtuple('BuildSystemDetails', [
|
||||||
|
|
|
@ -190,47 +190,13 @@ WINDOWS = (sys.platform.startswith("win") or
|
||||||
(sys.platform == 'cli' and os.name == 'nt'))
|
(sys.platform == 'cli' and os.name == 'nt'))
|
||||||
|
|
||||||
|
|
||||||
if hasattr(shutil, 'get_terminal_size'):
|
def get_terminal_size():
|
||||||
def get_terminal_size():
|
# type: () -> Tuple[int, int]
|
||||||
# type: () -> Tuple[int, int]
|
"""
|
||||||
"""
|
Returns a tuple (x, y) representing the width(x) and the height(y)
|
||||||
Returns a tuple (x, y) representing the width(x) and the height(y)
|
in characters of the terminal window.
|
||||||
in characters of the terminal window.
|
"""
|
||||||
"""
|
return tuple(shutil.get_terminal_size()) # type: ignore
|
||||||
return tuple(shutil.get_terminal_size()) # type: ignore
|
|
||||||
else:
|
|
||||||
def get_terminal_size():
|
|
||||||
# type: () -> Tuple[int, int]
|
|
||||||
"""
|
|
||||||
Returns a tuple (x, y) representing the width(x) and the height(y)
|
|
||||||
in characters of the terminal window.
|
|
||||||
"""
|
|
||||||
def ioctl_GWINSZ(fd):
|
|
||||||
try:
|
|
||||||
import fcntl
|
|
||||||
import struct
|
|
||||||
import termios
|
|
||||||
cr = struct.unpack_from(
|
|
||||||
'hh',
|
|
||||||
fcntl.ioctl(fd, termios.TIOCGWINSZ, '12345678')
|
|
||||||
)
|
|
||||||
except Exception:
|
|
||||||
return None
|
|
||||||
if cr == (0, 0):
|
|
||||||
return None
|
|
||||||
return cr
|
|
||||||
cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)
|
|
||||||
if not cr:
|
|
||||||
if sys.platform != "win32":
|
|
||||||
try:
|
|
||||||
fd = os.open(os.ctermid(), os.O_RDONLY)
|
|
||||||
cr = ioctl_GWINSZ(fd)
|
|
||||||
os.close(fd)
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
if not cr:
|
|
||||||
cr = (os.environ.get('LINES', 25), os.environ.get('COLUMNS', 80))
|
|
||||||
return int(cr[1]), int(cr[0])
|
|
||||||
|
|
||||||
|
|
||||||
# Fallback to noop_lru_cache in Python 2
|
# Fallback to noop_lru_cache in Python 2
|
||||||
|
|
Loading…
Reference in a new issue