pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

www/py-bottle should not use suffix .py for binaries



Hi,

Some time ago I created a package for conan in wip/py-conan.
Until now I myself only used the conan client, but when I tested conan_server it failed.

Conan_server, turned out, uses python bottle web framework (www/py-bottle) which happens to install a binary bottle.py into $PREFIX/bin. So when conan_server tries to import bottle it looks for it (as it should) in $PROFIX/lib/python3.7/site-packages but first in the directory from which the binary was started, i.e. $PREFIX/bin. 
So it tries to import $PREFIX/bin/bottle.py as module instead of the one from lib/python-3.7/site-packages.

It fails because www/py-bottle uses ALTERNATIVES and $PREFIX/bin/bottle.py is not a python script but a shell wrapper.

Actually, even if it was a python script (if no ALTERNATIVES were used) it would still be wrong.

So I suggest to install binaries without .py suffix (as it is done in many other python packages).

The following patch solves the problem for me:

diff -ur a/py-bottle/ALTERNATIVES b/py-bottle/ALTERNATIVES
--- a/py-bottle/ALTERNATIVES	2020-08-03 15:37:31.045278619 +0200
+++ b/py-bottle/ALTERNATIVES	2020-08-03 15:37:22.885257065 +0200
@@ -1 +1 @@
-bin/bottle.py @PREFIX@/bin/bottle-@PYVERSSUFFIX@.py
+bin/bottle @PREFIX@/bin/bottle-@PYVERSSUFFIX@
diff -ur a/py-bottle/Makefile b/py-bottle/Makefile
--- a/py-bottle/Makefile	2020-08-03 15:37:31.045278619 +0200
+++ b/py-bottle/Makefile	2020-08-03 15:37:22.885257065 +0200
@@ -14,7 +14,7 @@
 
 post-install:
 	cd ${DESTDIR}${PREFIX}/bin && \
-	${MV} bottle.py bottle-${PYVERSSUFFIX}.py || ${TRUE}
+	${MV} bottle.py bottle-${PYVERSSUFFIX} || ${TRUE}
 
 .include "../../lang/python/egg.mk"
 .include "../../mk/bsd.pkg.mk"
diff -ur a/py-bottle/PLIST b/py-bottle/PLIST
--- a/py-bottle/PLIST	2020-08-03 15:37:31.045278619 +0200
+++ b/py-bottle/PLIST	2020-08-03 15:37:22.885257065 +0200
@@ -1,5 +1,5 @@
 @comment $NetBSD: PLIST,v 1.3 2018/11/30 12:23:34 adam Exp $
-bin/bottle-${PYVERSSUFFIX}.py
+bin/bottle-${PYVERSSUFFIX}
 ${PYSITELIB}/${EGG_INFODIR}/PKG-INFO
 ${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt
 ${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt

Please consider using the patch.
Thank you.

--
Aleksej Lebedev


Home | Main Index | Thread Index | Old Index