Date: Friday, May 28, 2021 @ 14:40:09 Author: dvzrv Revision: 949850 upgpkg: python-click-repl 0.1.6-5: Rebuild to apply fix for python-click >= 8.0.0.
Fixes https://bugs.archlinux.org/task/71044 Added: python-click-repl/trunk/python-click-repl-0.1.6-click8.patch Modified: python-click-repl/trunk/PKGBUILD --------------------------------------+ PKGBUILD | 19 +++++-- python-click-repl-0.1.6-click8.patch | 83 +++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 5 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2021-05-28 14:39:16 UTC (rev 949849) +++ PKGBUILD 2021-05-28 14:40:09 UTC (rev 949850) @@ -1,8 +1,9 @@ -# Maintainer: David Runge <d...@sleepmap.de> +# Maintainer: David Runge <dv...@archlinux.org> + _name=click-repl pkgname=python-click-repl pkgver=0.1.6 -pkgrel=4 +pkgrel=5 pkgdesc="Subcommand REPL for click apps" arch=('any') url="https://github.com/click-contrib/click-repl" @@ -10,11 +11,20 @@ depends=('python-click' 'python-prompt_toolkit' 'python-six') makedepends=('python-setuptools') checkdepends=('python-pytest') -source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.tar.gz") -sha512sums=('50576166e8eb61098b8b4e1c7db43101c226d09785a497539830addfd52a2c35b2fa7865d3cbb20559dcf2fea99801f306dcb05c177886f021a1ada188501ced') +source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.tar.gz" + "${pkgname}-0.1.6-click8.patch" +) +sha512sums=('50576166e8eb61098b8b4e1c7db43101c226d09785a497539830addfd52a2c35b2fa7865d3cbb20559dcf2fea99801f306dcb05c177886f021a1ada188501ced' + 'b4ff9f0ffd36d4b332e45d4320844757bf5bde7d4afed7bb12ec49f097261425aa91f00d58a44b4f6c15b15e71b8dd80f6e7dc56605aefbba082af6bf73ea491') +b2sums=('3729c1d24d9c89a209c5e567e635291dd278dbd0d7f5cd0e0890574652f072e0861744fc33759f92158313c498bc421d8b3805bfb76a959e1036401d5f2f7908' + '252914397b6c388f772ba0559199bfb3433ac7d1d47ee9aa9ca6073a50b2000fd5e49f9716452bc021f3406911e1834bcb90697c006e6b0c4a779607cb142351') prepare() { mv -v "${_name}-$pkgver" "$pkgname-$pkgver" + cd "$pkgname-$pkgver" + # fix issues with python-click > 8 + # https://github.com/click-contrib/click-repl/pull/76 + patch -Np1 -i "../${pkgname}-0.1.6-click8.patch" } build() { @@ -34,7 +44,6 @@ cd "$pkgname-$pkgver" python setup.py install --skip-build \ --optimize=1 \ - --prefix=/usr \ --root="${pkgdir}" install -vDm 644 README.rst -t "${pkgdir}/usr/share/doc/${pkgname}/" install -vDm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/" Added: python-click-repl-0.1.6-click8.patch =================================================================== --- python-click-repl-0.1.6-click8.patch (rev 0) +++ python-click-repl-0.1.6-click8.patch 2021-05-28 14:40:09 UTC (rev 949850) @@ -0,0 +1,83 @@ +From 7350d3533e97951865da79a0ef2ae1df9e686b9d Mon Sep 17 00:00:00 2001 +From: JM Lopez <jm.lo...@utoronto.ca> +Date: Thu, 13 May 2021 14:34:48 -0400 +Subject: [PATCH 1/2] support for click 8 changes + +--- + click_repl/__init__.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/click_repl/__init__.py b/click_repl/__init__.py +index 5000020..a48f227 100644 +--- a/click_repl/__init__.py ++++ b/click_repl/__init__.py +@@ -3,7 +3,7 @@ + from prompt_toolkit.history import InMemoryHistory + from prompt_toolkit.shortcuts import prompt + import click +-import click._bashcomplete ++import click.shell_completion + import click.parser + import os + import shlex +@@ -108,7 +108,7 @@ def get_completions(self, document, complete_event=None): + # command, so give all relevant completions for this context. + incomplete = "" + +- ctx = click._bashcomplete.resolve_ctx(self.cli, "", args) ++ ctx = click.shell_completion._resolve_context(self.cli, {}, "", args) + if ctx is None: + return + + +From d98c0af5eb51026c8bfe8f47ce4107e04c350448 Mon Sep 17 00:00:00 2001 +From: JM Lopez <jm.lo...@utoronto.ca> +Date: Mon, 17 May 2021 15:41:05 -0400 +Subject: [PATCH 2/2] Backwards compatibility between click 7 & 8 + +--- + click_repl/__init__.py | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/click_repl/__init__.py b/click_repl/__init__.py +index a48f227..216eec7 100644 +--- a/click_repl/__init__.py ++++ b/click_repl/__init__.py +@@ -3,7 +3,6 @@ + from prompt_toolkit.history import InMemoryHistory + from prompt_toolkit.shortcuts import prompt + import click +-import click.shell_completion + import click.parser + import os + import shlex +@@ -11,6 +10,14 @@ + import six + from .exceptions import InternalCommandException, ExitReplException # noqa + ++# Handle backwards compatibility between Click 7.0 and 8.0 ++try: ++ import click.shell_completion ++ HAS_C8 = True ++except ImportError: ++ import click._bashcomplete ++ HAS_C8 = False ++ + # Handle click.exceptions.Exit introduced in Click 7.0 + try: + from click.exceptions import Exit as ClickExit +@@ -107,8 +114,12 @@ def get_completions(self, document, complete_event=None): + # We've not entered anything, either at all or for the current + # command, so give all relevant completions for this context. + incomplete = "" +- +- ctx = click.shell_completion._resolve_context(self.cli, {}, "", args) ++ # Resolve context based on click version ++ if HAS_C8: ++ ctx = click.shell_completion._resolve_context(self.cli, {}, "", args) ++ else: ++ ctx = click._bashcomplete.resolve_ctx(self.cli, "", args) ++ + if ctx is None: + return +