app-emulation/protontricks: re-enable tests
authorMarek Szuba <marecki@gentoo.org>
Wed, 22 Apr 2020 21:44:15 +0000 (22:44 +0100)
committerMarek Szuba <marecki@gentoo.org>
Wed, 22 Apr 2020 23:47:27 +0000 (00:47 +0100)
Instead of having to jump through hoops to satisfy setuptools-scm,
remove references to that package and seed the version file manually,
using the value of ${PV}. Presto, can use GitHub release archives -
and by extension run tests - again!

Signed-off-by: Marek Szuba <marecki@gentoo.org>
app-emulation/protontricks/Manifest
app-emulation/protontricks/files/protontricks-1.4.1_no-setuptools-scm.patch [new file with mode: 0644]
app-emulation/protontricks/protontricks-1.4.1-r1.ebuild [new file with mode: 0644]

index fe8223dd60dab5348b452f519c6c2a79dc947471..07a1ca660a76ed350bde4494ab2500dae23b293c 100644 (file)
@@ -1 +1,2 @@
+DIST protontricks-1.4.1.gh.tar.gz 40029 BLAKE2B 3937f69ad1113c0a368117db38cf8bf1b66feea5cc7c509eaee2f7adabdeea724368baa15f51134a5a9749171a34f439878bfda3fc6b813caba11faf7be76373 SHA512 96d4b3aa5b1ca8f7f9bad0859f5984eb29a0bed01f420d108e537deef0436af314e73fcfaccfd58b5b1dc912698404bd4b0157e69ab6a055d65eb3701a60d00b
 DIST protontricks-1.4.1.tar.gz 31838 BLAKE2B b8c94a1b96fa7df14eaf1cc6d11cb96e43ae4e8c7bd232687a50cae9c79cf2d0e7864b1af0e1dc4cc20086952e1fcefeb16cb71a9c3a977f6feafad1b17d6857 SHA512 7635c9830afa3c64617514cd86edc7d7f9f33e6e81a1da995ec8bee70adc1cf8b5d9de92036c372134e408d735615b267b46a9afc9246f14ff161cb2ee1fc8f9
diff --git a/app-emulation/protontricks/files/protontricks-1.4.1_no-setuptools-scm.patch b/app-emulation/protontricks/files/protontricks-1.4.1_no-setuptools-scm.patch
new file mode 100644 (file)
index 0000000..fac3ed8
--- /dev/null
@@ -0,0 +1,36 @@
+Since version 1.4.1 upstream has used setuptools-scm to determine the
+current version number. Unfortunately the package in question does not
+support GitHub release archives, using GitHub VCS snapshots would require
+retrieving and updating commit hashes corresponding to release tags, and
+PyPI tarballs do not contain tests. setuptools_scm_git_archive does not
+help because it requires extra files to be included in the repository,
+which upstream has not done.
+
+Seeing as we already know the version number, bypass setuptools_scm
+altogether and create the version file ourselves. For obvious reasons the
+latter cannot be done with a patch alone - have to call sed in src_prepare.
+
+--- a/setup.py
++++ b/setup.py
+@@ -16,9 +16,6 @@
+ setup(
+     name="protontricks",
+-    use_scm_version={
+-        "write_to": "src/protontricks/_version.py"
+-    },
+     description=DESCRIPTION,
+     long_description=LONG_DESCRIPTION,
+     author=AUTHOR,
+@@ -28,7 +25,6 @@
+     packages=["protontricks"],
+     package_data={"": ["LICENSE"]},
+     package_dir={"protontricks": "src/protontricks"},
+-    setup_requires=["setuptools_scm"],
+     install_requires=["vdf>=2.4"],
+     entry_points={
+         "console_scripts": [
+--- /dev/null
++++ b/src/protontricks/_version.py
+@@ -0,0 +1 @@
++version = '@VERSION@'
diff --git a/app-emulation/protontricks/protontricks-1.4.1-r1.ebuild b/app-emulation/protontricks/protontricks-1.4.1-r1.ebuild
new file mode 100644 (file)
index 0000000..d17ef1b
--- /dev/null
@@ -0,0 +1,58 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+DISTUTILS_SINGLE_IMPL=1
+DISTUTILS_USE_SETUPTOOLS=rdepend
+
+inherit distutils-r1
+
+DESCRIPTION="app-emulation/winetricks wrapper for Proton (Steam Play) games"
+HOMEPAGE="https://github.com/Matoking/protontricks"
+# Will remove the .gh bit come next version bump
+SRC_URI="https://github.com/Matoking/${PN}/archive/${PV}.tar.gz -> ${P}.gh.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="+gui"
+
+RDEPEND="app-emulation/winetricks
+       $(python_gen_cond_dep '
+               dev-python/vdf[${PYTHON_USEDEP}]
+       ')
+       gui? ( gnome-extra/zenity
+               || (
+                       app-emulation/winetricks[gtk]
+                       app-emulation/winetricks[kde]
+               )
+       )"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.4.1_no-setuptools-scm.patch
+)
+
+DOCS=( CHANGELOG.md README.md )
+
+distutils_enable_tests pytest
+
+python_prepare_all() {
+       distutils-r1_python_prepare_all
+       sed -i -e "s/@VERSION@/${PV}/" "${S}"/src/${PN}/_version.py || die
+}
+
+pkg_postinst() {
+       elog
+
+       if ! use gui; then
+               ewarn "Please note that disabling USE=gui does *not* presently remove the --gui command-line option,"
+               ewarn "it just means using this option will fail unless gnome-extra/zenity happens to be installed."
+               ewarn
+       fi
+
+       elog "Protontricks can only find games for which a Proton prefix already exists."
+       elog "Make sure to run a Proton game at least once before trying to use protontricks on it."
+       elog
+}