Skip to content

Commit

Permalink
backblaze-b2: update to 3.6.0.
Browse files Browse the repository at this point in the history
Fixes: #37484.
  • Loading branch information
ahesford committed Dec 7, 2022
1 parent d6efa32 commit 738e50d
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 31 deletions.
87 changes: 87 additions & 0 deletions srcpkgs/backblaze-b2/patches/python-3.11.patch
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']
13 changes: 13 additions & 0 deletions srcpkgs/backblaze-b2/patches/setuptools_scm_version.patch
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 srcpkgs/backblaze-b2/patches/src_last_modified_millis.patch

This file was deleted.

27 changes: 8 additions & 19 deletions srcpkgs/backblaze-b2/template
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
# Template file for 'backblaze-b2'
pkgname=backblaze-b2
version=2.1.0
revision=3
version=3.6.0
revision=1
build_style=python3-module
hostmakedepends="python3-setuptools"
depends="python3-logfury python3-Arrow python3-requests python3-six
python3-tqdm python-b2sdk python3-phx-class-registry"
checkdepends="python3-pytest $depends python3-pyflakes python3-mock
python3-dateutil"
hostmakedepends="python3-setuptools_scm"
depends="python3-Arrow python3-b2sdk python3-docutils
python3-phx-class-registry python3-rst2ansi python3-tabulate"
short_desc="Command Line Interface for Backblaze's B2 storage service"
maintainer="Andrea Brancaleoni <abc@pompel.me>"
license="MIT"
homepage="https://github.com/Backblaze/B2_Command_Line_Tool"
distfiles="${PYPI_SITE}/b/b2/b2-${version}.tar.gz"
checksum=fdae4aa7c88c7981ae68784600cc820ab8fd591a2ca6dc7af5e6b4d1549c2080
checksum=a879e751348b635ca772a2231be20c2e835abaf830534e2ab2f1fb75967c0252
replaces="python-b2>=0"
provides="python-b2-${version}_${revision}"

post_patch() {
# this files is necessary for do_check
# the files is copied directly from its GitHub's repository
cp "$FILESDIR/test_b2_command_line.py" "$wrksrc"
}
make_check=no # tests require unpackaged dependencies

post_install() {
# Remove test directory polluting site-packages
rm -rf ${DESTDIR}/usr/lib/python*/site-packages/test

# Avoid conflict with Boost's b2 tool
mv ${DESTDIR}/usr/bin/b2 ${DESTDIR}/usr/bin/backblaze-b2
mv ${DESTDIR}/usr/bin/b2 ${DESTDIR}/usr/bin/backblaze-b2

vlicense LICENSE
}
Expand Down

0 comments on commit 738e50d

Please sign in to comment.