Skip to content

Commit

Permalink
Upgrade setuptools and pip (#1939)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat authored Sep 10, 2020
1 parent dc5eb79 commit 13c0498
Show file tree
Hide file tree
Showing 38 changed files with 159 additions and 77 deletions.
19 changes: 5 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,16 @@ repos:
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.0.1
hooks:
- id: add-trailing-comma
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.2
hooks:
- id: pyupgrade
- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config
args: [--application-directories, '.:src']
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.4.2
- repo: https://github.com/PyCQA/isort
rev: 5.5.2
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: 19.10b0
rev: 20.8b1
hooks:
- id: black
args: [--safe]
Expand All @@ -38,7 +29,7 @@ repos:
rev: v1.8.0
hooks:
- id: blacken-docs
additional_dependencies: [black==19.10b0]
additional_dependencies: [black==20.8b1]
language_version: python3.8
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.6.0
Expand All @@ -49,7 +40,7 @@ repos:
hooks:
- id: setup-cfg-fmt
args: [--min-py3-version, "3.4"]
- repo: https://gitlab.com/pycqa/flake8
- repo: https://github.com/PyCQA/flake8
rev: "3.8.3"
hooks:
- id: flake8
Expand Down
1 change: 1 addition & 0 deletions docs/changelog/1939.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade embedded setuptools to ``50.2.0`` and pip to ``20.2.3`` - by :user:`gaborbernat`.
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
def generate_draft_news():
root = Path(__file__).parents[1]
new = subprocess.check_output(
[sys.executable, "-m", "towncrier", "--draft", "--version", "NEXT"], cwd=root, universal_newlines=True,
[sys.executable, "-m", "towncrier", "--draft", "--version", "NEXT"],
cwd=root,
universal_newlines=True,
)
(root / "docs" / "_draft.rst").write_text("" if "No significant changes" in new else new)

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ universal = true
markers =
slow
junit_family = xunit2
addopts = --tb=auto -ra --showlocals
addopts = --tb=auto -ra --showlocals --no-success-flaky-report
env =
PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command
PYTHONIOENCODING=utf-8
5 changes: 4 additions & 1 deletion src/virtualenv/app_data/via_disk_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,8 @@ def __init__(self, in_folder, path):
class EmbedDistributionUpdateStoreDisk(JSONStoreDisk):
def __init__(self, in_folder, distribution):
super(EmbedDistributionUpdateStoreDisk, self).__init__(
in_folder, distribution, "embed update of distribution %s", (distribution,),
in_folder,
distribution,
"embed update of distribution %s",
(distribution,),
)
8 changes: 6 additions & 2 deletions src/virtualenv/create/creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def add_parser_arguments(cls, parser, interpreter, meta, app_data):
:param meta: value as returned by :meth:`can_create`
"""
parser.add_argument(
"dest", help="directory to create virtualenv at", type=cls.validate_dest,
"dest",
help="directory to create virtualenv at",
type=cls.validate_dest,
)
parser.add_argument(
"--clear",
Expand Down Expand Up @@ -120,7 +122,9 @@ def non_write_able(dest, value):
if refused:
raise ArgumentTypeError(
"the file system codec ({}) cannot handle characters {!r} within {!r}".format(
encoding, "".join(refused.keys()), raw_value,
encoding,
"".join(refused.keys()),
raw_value,
),
)
if os.pathsep in raw_value:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def read_data(file, endian, num=1):

def mach_o_change(at_path, what, value):
"""Replace a given name (what) in any LC_LOAD_DYLIB command found in the given binary with a new name (value),
provided it's shorter."""
provided it's shorter."""

def do_macho(file, bits, endian):
# Read Mach-O header (the magic number is assumed read by the caller)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def can_create(cls, interpreter):
meta.symlink_error = "cannot symlink {}".format(src)
if not meta.can_copy and not meta.can_symlink:
meta.error = "neither copy or symlink supported, copy: {} symlink: {}".format(
meta.copy_error, meta.symlink_error,
meta.copy_error,
meta.symlink_error,
)
else:
meta.error = "missing required file {}".format(src)
Expand Down Expand Up @@ -92,7 +93,7 @@ def set_pyenv_cfg(self):
"""
We directly inject the base prefix and base exec prefix to avoid site.py needing to discover these
from home (which usually is done within the interpreter itself)
"""
"""
super(ViaGlobalRefVirtualenvBuiltin, self).set_pyenv_cfg()
self.pyenv_cfg["base-prefix"] = self.interpreter.system_prefix
self.pyenv_cfg["base-exec-prefix"] = self.interpreter.system_exec_prefix
Expand Down
5 changes: 4 additions & 1 deletion src/virtualenv/create/via_global_ref/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def create_inline(self):
from venv import EnvBuilder

builder = EnvBuilder(
system_site_packages=self.enable_system_site_package, clear=False, symlinks=self.symlinks, with_pip=False,
system_site_packages=self.enable_system_site_package,
clear=False,
symlinks=self.symlinks,
with_pip=False,
)
builder.create(str(self.dest))

Expand Down
5 changes: 4 additions & 1 deletion src/virtualenv/discovery/cached_py_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ def _run_subprocess(cls, exe, app_data):
result.executable = exe # keep original executable as this may contain initialization code
else:
msg = "failed to query {} with code {}{}{}".format(
exe, code, " out: {!r}".format(out) if out else "", " err: {!r}".format(err) if err else "",
exe,
code,
" out: {!r}".format(out) if out else "",
" err: {!r}".format(err) if err else "",
)
failure = RuntimeError(msg)
return failure, result
Expand Down
3 changes: 2 additions & 1 deletion src/virtualenv/discovery/py_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ def __unicode__(self):

def __repr__(self):
return "{}({!r})".format(
self.__class__.__name__, {k: v for k, v in self.__dict__.items() if not k.startswith("_")},
self.__class__.__name__,
{k: v for k, v in self.__dict__.items() if not k.startswith("_")},
)

def __str__(self):
Expand Down
3 changes: 2 additions & 1 deletion src/virtualenv/run/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def _do_report_setup(parser, args, setup_logging):
level_map = ", ".join("{}={}".format(logging.getLevelName(l), c) for c, l in sorted(list(LEVELS.items())))
msg = "verbosity = verbose - quiet, default {}, mapping => {}"
verbosity_group = parser.add_argument_group(
title="verbosity", description=msg.format(logging.getLevelName(LEVELS[3]), level_map),
title="verbosity",
description=msg.format(logging.getLevelName(LEVELS[3]), level_map),
)
verbosity = verbosity_group.add_mutually_exclusive_group()
verbosity.add_argument("-v", "--verbose", action="count", dest="verbose", help="increase verbosity", default=2)
Expand Down
5 changes: 4 additions & 1 deletion src/virtualenv/run/plugin/creators.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ def for_interpreter(cls, interpreter):
else:
raise RuntimeError("No virtualenv implementation for {}".format(interpreter))
return CreatorInfo(
key_to_class=key_to_class, key_to_meta=key_to_meta, describe=describe, builtin_key=builtin_key,
key_to_class=key_to_class,
key_to_meta=key_to_meta,
describe=describe,
builtin_key=builtin_key,
)

def add_selector_arg_parse(self, name, choices):
Expand Down
3 changes: 2 additions & 1 deletion src/virtualenv/run/plugin/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class Discovery(PluginLoader):
def get_discover(parser, args):
discover_types = Discovery.entry_points_for("virtualenv.discovery")
discovery_parser = parser.add_argument_group(
title="discovery", description="discover and provide a target interpreter",
title="discovery",
description="discover and provide a target interpreter",
)
discovery_parser.add_argument(
"--discovery",
Expand Down
6 changes: 5 additions & 1 deletion src/virtualenv/run/plugin/seeders.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ def add_selector_arg_parse(self, name, choices):
help="seed packages install method",
)
self.parser.add_argument(
"--no-seed", "--without-pip", help="do not install seed packages", action="store_true", dest="no_seed",
"--no-seed",
"--without-pip",
help="do not install seed packages",
action="store_true",
dest="no_seed",
)

@staticmethod
Expand Down
3 changes: 2 additions & 1 deletion src/virtualenv/run/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def _seed(self):
def _activate(self):
if self.activators:
logging.info(
"add activators for %s", ", ".join(type(i).__name__.replace("Activator", "") for i in self.activators),
"add activators for %s",
", ".join(type(i).__name__.replace("Activator", "") for i in self.activators),
)
for activator in self.activators:
activator.generate(self.creator)
Expand Down
3 changes: 2 additions & 1 deletion src/virtualenv/seed/embed/base_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def __unicode__(self):
if getattr(self, "no_{}".format(distribution)):
continue
result += " {}{},".format(
distribution, "={}".format(getattr(self, "{}_version".format(distribution), None) or "latest"),
distribution,
"={}".format(getattr(self, "{}_version".format(distribution), None) or "latest"),
)
return result[:-1] + ")"

Expand Down
26 changes: 13 additions & 13 deletions src/virtualenv/seed/wheels/embed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@
BUNDLE_FOLDER = Path(__file__).absolute().parent
BUNDLE_SUPPORT = {
"3.10": {
"pip": "pip-20.2.2-py2.py3-none-any.whl",
"setuptools": "setuptools-49.6.0-py3-none-any.whl",
"pip": "pip-20.2.3-py2.py3-none-any.whl",
"setuptools": "setuptools-50.2.0-py3-none-any.whl",
"wheel": "wheel-0.35.1-py2.py3-none-any.whl",
},
"3.9": {
"pip": "pip-20.2.2-py2.py3-none-any.whl",
"setuptools": "setuptools-49.6.0-py3-none-any.whl",
"pip": "pip-20.2.3-py2.py3-none-any.whl",
"setuptools": "setuptools-50.2.0-py3-none-any.whl",
"wheel": "wheel-0.35.1-py2.py3-none-any.whl",
},
"3.8": {
"pip": "pip-20.2.2-py2.py3-none-any.whl",
"setuptools": "setuptools-49.6.0-py3-none-any.whl",
"pip": "pip-20.2.3-py2.py3-none-any.whl",
"setuptools": "setuptools-50.2.0-py3-none-any.whl",
"wheel": "wheel-0.35.1-py2.py3-none-any.whl",
},
"3.7": {
"pip": "pip-20.2.2-py2.py3-none-any.whl",
"setuptools": "setuptools-49.6.0-py3-none-any.whl",
"pip": "pip-20.2.3-py2.py3-none-any.whl",
"setuptools": "setuptools-50.2.0-py3-none-any.whl",
"wheel": "wheel-0.35.1-py2.py3-none-any.whl",
},
"3.6": {
"pip": "pip-20.2.2-py2.py3-none-any.whl",
"setuptools": "setuptools-49.6.0-py3-none-any.whl",
"pip": "pip-20.2.3-py2.py3-none-any.whl",
"setuptools": "setuptools-50.2.0-py3-none-any.whl",
"wheel": "wheel-0.35.1-py2.py3-none-any.whl",
},
"3.5": {
"pip": "pip-20.2.2-py2.py3-none-any.whl",
"setuptools": "setuptools-49.6.0-py3-none-any.whl",
"pip": "pip-20.2.3-py2.py3-none-any.whl",
"setuptools": "setuptools-50.2.0-py3-none-any.whl",
"wheel": "wheel-0.35.1-py2.py3-none-any.whl",
},
"3.4": {
Expand All @@ -41,7 +41,7 @@
"wheel": "wheel-0.33.6-py2.py3-none-any.whl",
},
"2.7": {
"pip": "pip-20.2.2-py2.py3-none-any.whl",
"pip": "pip-20.2.3-py2.py3-none-any.whl",
"setuptools": "setuptools-44.1.1-py2.py3-none-any.whl",
"wheel": "wheel-0.35.1-py2.py3-none-any.whl",
},
Expand Down
Binary file not shown.
Binary file not shown.
5 changes: 4 additions & 1 deletion src/virtualenv/seed/wheels/periodic_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ def use(self, now):

def __repr__(self):
return "{}(filename={}), found_date={}, release_date={})".format(
self.__class__.__name__, self.filename, self.found_date, self.release_date,
self.__class__.__name__,
self.filename,
self.found_date,
self.release_date,
)

def __eq__(self, other):
Expand Down
4 changes: 3 additions & 1 deletion src/virtualenv/util/path/_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ def __init__(self, src, dest):

def __str__(self):
return "{}{} to {}".format(
"directory " if self.src.is_dir() else "", ensure_text(str(self.src)), ensure_text(str(self.dest)),
"directory " if self.src.is_dir() else "",
ensure_text(str(self.src)),
ensure_text(str(self.dest)),
)


Expand Down
6 changes: 5 additions & 1 deletion src/virtualenv/util/subprocess/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
def run_cmd(cmd):
try:
process = Popen(
cmd, universal_newlines=True, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE,
cmd,
universal_newlines=True,
stdin=subprocess.PIPE,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
)
out, err = process.communicate() # input disabled
code = process.returncode
Expand Down
4 changes: 3 additions & 1 deletion tasks/make_zipapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ def build_sdist(self, target):
with TemporaryDirectory() as temp_folder:
folder = Path(temp_folder) / target.name
shutil.copytree(
str(target), str(folder), ignore=shutil.ignore_patterns(".tox", "venv", "__pycache__", "*.pyz"),
str(target),
str(folder),
ignore=shutil.ignore_patterns(".tox", "venv", "__pycache__", "*.pyz"),
)
try:
return self._build_sdist(self.into, folder)
Expand Down
13 changes: 10 additions & 3 deletions tests/unit/activation/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def get_version(self, raise_on_fail):
# locally we disable, so that contributors don't need to have everything setup
try:
process = Popen(
self._version_cmd, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
self._version_cmd,
universal_newlines=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
out, err = process.communicate()
result = out if out else err
Expand Down Expand Up @@ -164,7 +167,8 @@ def print_os_env_var(self, var):
val = '"{}"'.format(var)
return self.python_cmd(
"import os; import sys; v = os.environ.get({}); print({})".format(
val, "v" if six.PY3 or IS_PYPY else "None if v is None else v.decode(sys.getfilesystemencoding())",
val,
"v" if six.PY3 or IS_PYPY else "None if v is None else v.decode(sys.getfilesystemencoding())",
),
)

Expand Down Expand Up @@ -199,7 +203,10 @@ def __init__(self, of_class, session, cmd, activate_script, extension, non_sourc
def __call__(self, monkeypatch, tmp_path):
env, activate_script = super(RaiseOnNonSourceCall, self).__call__(monkeypatch, tmp_path)
process = Popen(
self.non_source_activate(activate_script), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env,
self.non_source_activate(activate_script),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env=env,
)
out, _err = process.communicate()
err = _err.decode("utf-8")
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/activation/test_activation_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@


@pytest.mark.parametrize(
"activator_class", [BatchActivator, PowerShellActivator, PythonActivator, BashActivator, FishActivator],
"activator_class",
[BatchActivator, PowerShellActivator, PythonActivator, BashActivator, FishActivator],
)
def test_activator_support_windows(mocker, activator_class):
activator = activator_class(Namespace(prompt=None))
Expand All @@ -36,7 +37,8 @@ def test_activator_no_support_windows(mocker, activator_class):


@pytest.mark.parametrize(
"activator_class", [BashActivator, CShellActivator, FishActivator, PowerShellActivator, PythonActivator],
"activator_class",
[BashActivator, CShellActivator, FishActivator, PowerShellActivator, PythonActivator],
)
def test_activator_support_posix(mocker, activator_class):
activator = activator_class(Namespace(prompt=None))
Expand Down
7 changes: 6 additions & 1 deletion tests/unit/activation/test_bash.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ def test_bash(raise_on_non_source_class, activation_tester):
class Bash(raise_on_non_source_class):
def __init__(self, session):
super(Bash, self).__init__(
BashActivator, session, "bash", "activate", "sh", "You must source this script: $ source ",
BashActivator,
session,
"bash",
"activate",
"sh",
"You must source this script: $ source ",
)

activation_tester(Bash)
Loading

0 comments on commit 13c0498

Please sign in to comment.