-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes: #37484.
- Loading branch information
Showing
4 changed files
with
108 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
From 1eac94954530a1dca2c498de7bf9f92ee12479b1 Mon Sep 17 00:00:00 2001 | ||
From: kkalinowski-reef <114084217+kkalinowski-reef@users.noreply.github.com> | ||
Date: Tue, 15 Nov 2022 01:11:34 +0100 | ||
Subject: [PATCH] Fetching command class from parsed arguments instead of | ||
registry (#836) | ||
|
||
* Fetching command class from parsed arguments instead of registry | ||
|
||
* Enabled 3.11 tests in both nox and github workflows | ||
--- | ||
.github/workflows/ci.yml | 2 +- | ||
CHANGELOG.md | 1 + | ||
b2/console_tool.py | 11 ++++++----- | ||
noxfile.py | 8 +++++++- | ||
4 files changed, 15 insertions(+), 7 deletions(-) | ||
|
||
[Void note (ahesford): CHANGLEOG.md diff conflicts and was dropped.] | ||
|
||
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml | ||
index 5d64cdb5..84932867 100644 | ||
--- a/.github/workflows/ci.yml | ||
+++ b/.github/workflows/ci.yml | ||
@@ -80,7 +80,7 @@ jobs: | ||
fail-fast: false | ||
matrix: | ||
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | ||
- python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7"] | ||
+ python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7", "3.11"] | ||
exclude: | ||
- os: "macos-latest" | ||
python-version: "pypy-3.7" | ||
diff --git a/b2/console_tool.py b/b2/console_tool.py | ||
index 1115cc79..760be547 100644 | ||
--- a/b2/console_tool.py | ||
+++ b/b2/console_tool.py | ||
@@ -500,11 +500,8 @@ def name_and_alias(cls): | ||
@classmethod | ||
def register_subcommand(cls, command_class): | ||
assert cls.subcommands_registry is not None, 'Initialize the registry class' | ||
- name, alias = command_class.name_and_alias() | ||
+ name, _ = command_class.name_and_alias() | ||
decorator = cls.subcommands_registry.register(key=name)(command_class) | ||
- # Register alias if present | ||
- if alias is not None: | ||
- cls.subcommands_registry[alias] = command_class | ||
return decorator | ||
|
||
@classmethod | ||
@@ -531,6 +528,8 @@ def get_parser(cls, subparsers=None, parents=None, for_docs=False): | ||
aliases=[alias] if alias is not None and not for_docs else (), | ||
for_docs=for_docs, | ||
) | ||
+ # Register class that will handle this particular command, for both name and alias. | ||
+ parser.set_defaults(command_class=cls) | ||
|
||
cls._setup_parser(parser) | ||
|
||
@@ -655,7 +654,9 @@ def name_and_alias(cls): | ||
return NAME, None | ||
|
||
def run(self, args): | ||
- return self.subcommands_registry.get_class(args.command) | ||
+ # Commands could be named via name or alias, so we fetch | ||
+ # the command from args assigned during parser preparation. | ||
+ return args.command_class | ||
|
||
|
||
@B2.register_subcommand | ||
diff --git a/noxfile.py b/noxfile.py | ||
index aaa2bac3..25cf8de1 100644 | ||
--- a/noxfile.py | ||
+++ b/noxfile.py | ||
@@ -24,7 +24,13 @@ | ||
NO_STATICX = os.environ.get('NO_STATICX') is not None | ||
NOX_PYTHONS = os.environ.get('NOX_PYTHONS') | ||
|
||
-PYTHON_VERSIONS = ['3.7', '3.8', '3.9', '3.10'] if NOX_PYTHONS is None else NOX_PYTHONS.split(',') | ||
+PYTHON_VERSIONS = [ | ||
+ '3.7', | ||
+ '3.8', | ||
+ '3.9', | ||
+ '3.10', | ||
+ '3.11', | ||
+] if NOX_PYTHONS is None else NOX_PYTHONS.split(',') | ||
PYTHON_DEFAULT_VERSION = PYTHON_VERSIONS[-1] | ||
|
||
PY_PATHS = ['b2', 'test', 'noxfile.py', 'setup.py'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Setup works just fine with the version of setuptools_scm in Void. | ||
|
||
--- a/setup.py | ||
+++ b/setup.py | ||
@@ -111,7 +111,7 @@ | ||
# for example: | ||
# $ pip install -e .[dev,test] | ||
extras_require={'doc': read_requirements('doc')}, | ||
- setup_requires=['setuptools_scm<6.0'], | ||
+ setup_requires=['setuptools_scm'], | ||
use_scm_version=True, | ||
|
||
# If there are data files included in your packages that need to be |
12 changes: 0 additions & 12 deletions
12
srcpkgs/backblaze-b2/patches/src_last_modified_millis.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters