commit:     a602bf6eeb37e815981e28199b84d060465f1d79
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 13 20:11:36 2025 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sat Dec 13 20:11:36 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a602bf6e

games-misc/ponysay: Install sources properly rather than as an executable zip

Upstream zips the sources, shoves a shebang in front, and installs this to
/usr/bin. It works, but it's not optimal.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 ...say-3.0.3-r1.ebuild => ponysay-3.0.3-r2.ebuild} | 25 +++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/games-misc/ponysay/ponysay-3.0.3-r1.ebuild 
b/games-misc/ponysay/ponysay-3.0.3-r2.ebuild
similarity index 61%
rename from games-misc/ponysay/ponysay-3.0.3-r1.ebuild
rename to games-misc/ponysay/ponysay-3.0.3-r2.ebuild
index 36aeb7c21b33..93257e9f963a 100644
--- a/games-misc/ponysay/ponysay-3.0.3-r1.ebuild
+++ b/games-misc/ponysay/ponysay-3.0.3-r2.ebuild
@@ -49,10 +49,33 @@ src_compile() {
        setup_py build
 }
 
+# Upstream zips the sources, shoves a shebang in front, and installs this to
+# /usr/bin. It works, but it's not optimal. This installs things properly.
 src_install() {
        setup_py --destdir="${D}" prebuilt
 
-       python_fix_shebang "${ED}"/usr/bin/${PN}
+       # setup.py rewrites each source file to a file suffixed with 
".install". We
+       # need to strip the suffix before installing these.
+       local src
+       for src in src/*.py.install; do
+               mv -v "${src}" "${src%.install}" || die
+       done
+
+       # Only the main file is executable, but all the files have shebangs.
+       python_fix_shebang src/*.py
+
+       # Install the sources under site-packages.
+       python_moduleinto ${PN}
+       python_domodule src/*.py
+
+       # Make the main file executable for the symlinks below.
+       local main=$(python_get_sitedir)/ponysay/__main__.py
+       fperms 0755 "${main}"
+
+       # All the tools are symlinks pointing to the main file.
+       dosym -r "${main}" /usr/bin/${PN}
+       dosym -r "${main}" /usr/bin/${PN}-tool
+       dosym -r "${main}" /usr/bin/${PN%say}think
 
        rm -rv "${ED}"/usr/share/licenses || die
        dodoc CHANGELOG CONTRIBUTING CREDITS README.md

Reply via email to