From 16f122039ae676bd73619223fb0c3294b744f590 Mon Sep 17 00:00:00 2001 From: Martin Gysel Date: Wed, 9 Dec 2020 08:04:46 +0100 Subject: dev-vcs/git-cola: add py3.8, fix qa warnings Bug: https://bugs.gentoo.org/750068 Bug: https://bugs.gentoo.org/713930 Package-Manager: Portage-3.0.12, Repoman-3.0.2 Signed-off-by: Martin Gysel Closes: https://github.com/gentoo/gentoo/pull/18576 Signed-off-by: Joonas Niilola --- .../files/git-cola-3.5-py3.8-line-buffering.patch | 29 ++++++++++++++++++++++ dev-vcs/git-cola/git-cola-3.5-r1.ebuild | 8 +++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 dev-vcs/git-cola/files/git-cola-3.5-py3.8-line-buffering.patch (limited to 'dev-vcs/git-cola') diff --git a/dev-vcs/git-cola/files/git-cola-3.5-py3.8-line-buffering.patch b/dev-vcs/git-cola/files/git-cola-3.5-py3.8-line-buffering.patch new file mode 100644 index 000000000000..4938d6a30eca --- /dev/null +++ b/dev-vcs/git-cola/files/git-cola-3.5-py3.8-line-buffering.patch @@ -0,0 +1,29 @@ +From ed00653d43b00b18e89c8c4d9e733ef156c02579 Mon Sep 17 00:00:00 2001 +From: Simon Peeters +Date: Mon, 18 Nov 2019 21:15:32 +0100 +Subject: [PATCH] Only use line buffering in text mode when calling Popen + +Python3.8 started complaining loudly when trying to open a stream in binary mode but with line buffering enabled. +So we should only try to set `bufsize` to `1` when we enable `text` or `universal_newlines` mode. + +see https://docs.python.org/3/library/subprocess.html#subprocess.Popen under bufsize +--- + cola/core.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/cola/core.py b/cola/core.py +index 0fabfcf3d..5ad719f05 100644 +--- a/cola/core.py ++++ b/cola/core.py +@@ -208,7 +208,10 @@ def start_command(cmd, cwd=None, add_env=None, + CREATE_NO_WINDOW = 0x08000000 + extra['creationflags'] = CREATE_NO_WINDOW + +- return subprocess.Popen(cmd, bufsize=1, stdin=stdin, stdout=stdout, ++ # Use line buffering when in text/universal_newlines mode, ++ # otherwise use the system default buffer size. ++ bufsize = 1 if universal_newlines else -1 ++ return subprocess.Popen(cmd, bufsize=bufsize, stdin=stdin, stdout=stdout, + stderr=stderr, cwd=cwd, env=env, + universal_newlines=universal_newlines, **extra) + diff --git a/dev-vcs/git-cola/git-cola-3.5-r1.ebuild b/dev-vcs/git-cola/git-cola-3.5-r1.ebuild index 0c0122bcd5b6..e6a1500ea821 100644 --- a/dev-vcs/git-cola/git-cola-3.5-r1.ebuild +++ b/dev-vcs/git-cola/git-cola-3.5-r1.ebuild @@ -3,8 +3,9 @@ EAPI=7 -PYTHON_COMPAT=( python3_{6,7} ) +PYTHON_COMPAT=( python3_{6,8} ) DISTUTILS_SINGLE_IMPL=true +DISTUTILS_USE_SETUPTOOLS=no inherit distutils-r1 readme.gentoo-r1 virtualx xdg-utils DESCRIPTION="The highly caffeinated git GUI" @@ -37,6 +38,8 @@ BDEPEND="sys-devel/gettext ) ")" +PATCHES=( "${FILESDIR}/${P}-py3.8-line-buffering.patch" ) + python_prepare_all() { # make sure that tests also use the system provided QtPy rm -r qtpy || die @@ -95,6 +98,9 @@ python_install_all() { python_fix_shebang "${ED}/usr/share/git-cola/bin/git-xbase" "${ED}"/usr/bin/git-cola python_optimize "${ED}/usr/share/git-cola/lib/cola" + # fix appdata installation + mv "${D}"/usr/share/appdata "${D}"/usr/share/metainfo || die "moving appdata failed" + use doc || HTML_DOCS=( "${FILESDIR}"/index.html ) distutils-r1_python_install_all -- cgit v1.2.3-65-gdbad