diff --git a/mingw-w64-nicotine+/PKGBUILD b/mingw-w64-nicotine+/PKGBUILD index 26b57b8c56..aeb78fae61 100644 --- a/mingw-w64-nicotine+/PKGBUILD +++ b/mingw-w64-nicotine+/PKGBUILD @@ -4,7 +4,7 @@ _realname=nicotine+ pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" pkgver=3.3.10 -pkgrel=1 +pkgrel=2 pkgdesc="Graphical client for the Soulseek peer-to-peer network (mingw-w64)" arch=('any') mingw_arch=('ucrt64' 'clang64' 'clangarm64') @@ -26,8 +26,10 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-python-build" "${MINGW_PACKAGE_PREFIX}-gobject-introspection" "${MINGW_PACKAGE_PREFIX}-gettext-tools") options=('!strip') -source=("${msys2_repository_url}/archive/${pkgver}/${_realname}-${pkgver}.tar.gz") -sha256sums=('3917ebc562f2d6a6b26b3d815d7cbdf1d11c058d994b1f47794bbb850489b35e') +source=("${msys2_repository_url}/archive/${pkgver}/${_realname}-${pkgver}.tar.gz" + "pyscript2exe.py") +sha256sums=('3917ebc562f2d6a6b26b3d815d7cbdf1d11c058d994b1f47794bbb850489b35e' + '3c65bc3dd7337877e14b19bc7c42918bde664a11a860cfc0b9db891f8a1052db') noextract=("${_realname}-${pkgver}.tar.gz") prepare() { @@ -47,5 +49,7 @@ package() { python -m installer --prefix=${MINGW_PREFIX} \ --destdir="${pkgdir}" dist/*.whl + python "${srcdir}/pyscript2exe.py" "${pkgdir}${MINGW_PREFIX}/bin/nicotine" + install -Dm644 COPYING "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING" } diff --git a/mingw-w64-nicotine+/pyscript2exe.py b/mingw-w64-nicotine+/pyscript2exe.py new file mode 100644 index 0000000000..a519fe25b3 --- /dev/null +++ b/mingw-w64-nicotine+/pyscript2exe.py @@ -0,0 +1,23 @@ +""" +Creates an exe launcher for Python scripts for the executing interpreter. +foobar.py -> foobar.exe + foobar-script.py +""" + +import sys +import re +import os +try: + from setuptools.command.easy_install import get_win_launcher +except ImportError: + # v80+ + from setuptools._scripts import get_win_launcher + +path = sys.argv[1] +with open(path, "rb") as f: + data = f.read() +with open(path, "wb") as f: + f.write(re.sub(b"^#![^\n\r]*", b'', data)) +root, ext = os.path.splitext(path) +with open(root + ".exe", "wb") as f: + f.write(get_win_launcher("cli")) +os.rename(path, root + "-script.py")