Skip to content

Commit

Permalink
dev-vcs/git-up: add patch to drop Click dep
Browse files Browse the repository at this point in the history
See msiemens/PyGitUp#96

Package-Manager: Portage-3.0.18, Repoman-3.0.3
  • Loading branch information
Tatsh committed May 14, 2021
1 parent a20f37b commit 47531d2
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dev-vcs/git-up/Manifest
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
AUX remove-click-dep.patch 3804 BLAKE2B d3a0204d1bc6036753ddb3134b0f5d7d75d8b244f18cacfa0ffbdf8740369d8bcaa929d236cf1aba717a3d78a464851808b7230103595b1fbc18fed266b057a8 SHA512 fdc1c57799b4277da22d1ba95acdf4a359aa57687603cd2ade8e9f16085ebc9cb7f2b63aac1e1ba3410ce6b5f7a1fba8c995668fbe823eee6263cf2dfd077f98
DIST git-up-2.0.2.tar.gz 23268 BLAKE2B b0844c3d622cb20fc00c0c1750ddb713fb1c01f20ad9e6df68be94d48e075c34cdef3cfe0f484bbe4b37f2e99af2eb50978dcdae0101c24bf17525f29a93440d SHA512 58d3fd42b2209a02e5c3af7380eba4e12096f6f41e6a4055dabda271cb8a8bccbdd7151ae273fad6a6010e4ad3b5182222009c981e3772d1d5a5c69f447293e0
EBUILD git-up-2.0.2.ebuild 560 BLAKE2B 1289ef04556947649058b17ec877039facb0374d6ab578588ad766c287fe8a562754d1239c58dcba4da131f50ce707182c21158fa66db7405dd0c0b40957f4fd SHA512 d9de4193d3689ccd853603f77a613d02ddfa8b7121602f8ba3dfade36f48288a040ceaca90676fc10eb9de0f8b327f315564001b17a89ea8800852c928c87d2c
EBUILD git-up-2.0.2-r1.ebuild 661 BLAKE2B c311cd3279d6b171f1e5958242df16b0d3df724b7e7bc2826aa4f7f2eabed57b011b613b59c198d197164f21cf38b6a30b8a7824676d9e464f65df19bc453208 SHA512 1dda3f49aefcdc8a89255635bf250284efb970336460e4f1ca197ad5e862aee6d27f3d7adc244d176e926f55029acf5262b8c78af0d747223b4d26c4f37f7c15
MISC metadata.xml 246 BLAKE2B 719b651fc01707ec3d9e366f618d27c931b4c5f912fdfb5c2d85434a0e798b9ee0d0ea6925cb62e693c745953abaf666009d03696da5496fd93c9045bbe893d2 SHA512 f517e1837b4773afe57afb34d82308adc22f72aeeaabf5664c3caecf1c6d9204e783e32010cae416245213f5558d333edb8e60e05c7388824a2902473483af6f
106 changes: 106 additions & 0 deletions dev-vcs/git-up/files/remove-click-dep.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
From be8e2ccfe7138c7e0c60cb661437078a7dd9d63d Mon Sep 17 00:00:00 2001
From: Ewoud Kohl van Wijngaarden <ewoud@kohlvanwijngaarden.nl>
Date: Tue, 31 Dec 2019 18:40:17 +0100
Subject: [PATCH] Drop the click dependency

This reduces the number of external dependencies and relies more on
Python's standard library.

It drops the --no-push option since argparse doesn't support having a
--option / --no-option. That's also the default and this makes it
clearer to the user what the default is.

The help text's formatting is slightly different. Mostly visible are
that the description and epilog are no longer indented.
---
PyGitUp/gitup.py | 43 ++++++++++++++++++++-----------------------
requirements.txt | 1 -
setup.py | 2 +-
3 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/PyGitUp/gitup.py b/PyGitUp/gitup.py
index 7b0f529..70cdec5 100644
--- a/PyGitUp/gitup.py
+++ b/PyGitUp/gitup.py
@@ -12,6 +12,7 @@
###############################################################################

# Python libs
+import argparse
import codecs
import errno
import sys
@@ -36,7 +37,6 @@
else: # pragma: no cover
NO_DISTRIBUTE = False

-import click
import colorama
from git import Repo, GitCmdObjectDB
from termcolor import colored
@@ -615,21 +615,24 @@ def print_error(self, error):
'''


-@click.command(epilog=EPILOG)
-@click.option('-V', '--version', is_flag=True,
- help='Show version (and if there is a newer version).')
-@click.option('-q', '--quiet', is_flag=True,
- help='Be quiet, only print error messages.')
-@click.option('--no-fetch', '--no-f', is_flag=True,
- help='Don\'t try to fetch from origin.')
-@click.option('-p', '--push/--no-push', default=None,
- help='Push the changes after pulling successfully.')
-@click.help_option('-h', '--help')
-def run(version, quiet, no_fetch, push, **kwargs): # pragma: no cover
+def run(): # pragma: no cover
"""
A nicer `git pull`.
"""
- if version:
+
+ parser = argparse.ArgumentParser(description="A nicer `git pull`.", epilog=EPILOG)
+ parser.add_argument('-V', '--version', action='store_true',
+ help='Show version (and if there is a newer version).')
+ parser.add_argument('-q', '--quiet', action='store_true',
+ help='Be quiet, only print error messages.')
+ parser.add_argument('--no-fetch', '--no-f', dest='fetch', action='store_false',
+ help='Don\'t try to fetch from origin.')
+ parser.add_argument('-p', '--push', action='store_true',
+ help='Push the changes after pulling successfully.')
+
+ args = parser.parse_args()
+
+ if args.version:
if NO_DISTRIBUTE:
print(colored('Please install \'git-up\' via pip in order to '
'get version information.', 'yellow'))
@@ -637,19 +640,13 @@ def run(version, quiet, no_fetch, push, **kwargs): # pragma: no cover
GitUp(sparse=True).version_info()
return

- if quiet:
+ if args.quiet:
sys.stdout = StringIO()

try:
gitup = GitUp()
-
- if push is not None:
- gitup.settings['push.auto'] = push
-
- # if arguments['--no-fetch'] or arguments['--no-f']:
- if no_fetch:
- gitup.should_fetch = False
-
+ gitup.settings['push.auto'] = args.push
+ gitup.should_fetch = args.fetch
except GitError:
sys.exit(1) # Error in constructor
else:
@@ -657,4 +654,4 @@ def run(version, quiet, no_fetch, push, **kwargs): # pragma: no cover


if __name__ == '__main__': # pragma: no cover
- run(help_option_names=['-h'])
+ run()
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ KEYWORDS="~amd64 ~x86"
RDEPEND=">=dev-python/GitPython-3.1.8
>=dev-python/colorama-0.3.7
>=dev-python/termcolor-1.1.0
>=dev-python/click-7.0
>=dev-python/six-1.10.0"
DEPEND="${RDEPEND}"

PATCHES=( "${FILESDIR}/remove-click-dep.patch" )

src_prepare() {
default
sed -r -e "/'click>=7.0,<8.0',/d" -i setup.py
}

0 comments on commit 47531d2

Please sign in to comment.