dh_python3 sets shebang to Python 2 -- is this a bug?
I have an issue with a package build, and I'm not sure whether this is a bug in dh-python, or whether I'm just misunderstanding something. A package that had recently been converted from Python 2 to Python3 was still generating dependencies for Python 2, see #936924. Frederic-Emmanuel Picca correctly pointed me to the source of this issue, it was an unversioned shebang in some scripts installed into /usr/bin. Here's the thing that puzzles me: dh_python3 identifies the unversioned shebang, | I: dh_python3 tools:114: replacing shebang in debian/libsvm-tools/usr/bin/svm-grid | I: dh_python3 tools:114: replacing shebang in debian/libsvm-tools/usr/bin/svm-subset | I: dh_python3 tools:114: replacing shebang in debian/libsvm-tools/usr/bin/svm-checkdata | I: dh_python3 tools:114: replacing shebang in debian/libsvm-tools/usr/bin/svm-easy but it replaces the shebang with the Python *2* versioned one. A Python 3 helper setting /usr/bin/python2 looks odd to me, but I have no in-depth knowledge of dh-python's design, or the corner cases it might need to address. Is there a use case where dh_python3 (not dh_python2) doing this can make sense? Or can this be considered a bug? Furthermore, the package does not list any Python 2 build dependencies, and all binary package dependencies are generated by the ${python3:Depends} substvar. Could this perhaps be worth an "if the package does not have Python 2 dependencies, a Python 2 shebang is a bug" lintian check? Christian
Re: python3-arcus only builds for python 3.8 despite pybuild
Re: To Gregor Riepl 2020-01-19 <20200119211205.ga69...@msg.df7cb.de> > Is that a failure in pybuild, cmake or dh-python? (Continued on #debian-python, and in #949377.) Christoph
Re: dh_python3 sets shebang to Python 2 -- is this a bug?
Hello Christian, On Mon, Jan 20, 2020 at 08:51:56AM +0100, Christian Kastner wrote: > I have an issue with a package build, and I'm not sure whether this is a > bug in dh-python, or whether I'm just misunderstanding something. > > > A package that had recently been converted from Python 2 to Python3 was > still generating dependencies for Python 2, see #936924. > > Frederic-Emmanuel Picca correctly pointed me to the source of this > issue, it was an unversioned shebang in some scripts installed into > /usr/bin. > > Here's the thing that puzzles me: dh_python3 identifies the unversioned > shebang, > > | I: dh_python3 tools:114: replacing shebang in > debian/libsvm-tools/usr/bin/svm-grid > | I: dh_python3 tools:114: replacing shebang in > debian/libsvm-tools/usr/bin/svm-subset > | I: dh_python3 tools:114: replacing shebang in > debian/libsvm-tools/usr/bin/svm-checkdata > | I: dh_python3 tools:114: replacing shebang in > debian/libsvm-tools/usr/bin/svm-easy > > but it replaces the shebang with the Python *2* versioned one. I think you're hitting the following code paths: https://sources.debian.org/src/dh-python/4.20191017/dhpython/tools.py/#L94 https://sources.debian.org/src/dh-python/4.20191017/dhpython/tools.py/#L100 https://sources.debian.org/src/dh-python/4.20191017/dhpython/interpreter.py/#L212 https://sources.debian.org/src/dh-python/4.20191017/dhpython/interpreter.py/#L196 https://sources.debian.org/src/dh-python/4.20191017/dhpython/tools.py/#L106 https://sources.debian.org/src/dh-python/4.20191017/dhpython/tools.py/#L114 I've personally seen some upstream use 'python' in shebang with the intention of meaning 'works with either python2 or python3', but in debian it seems people have always assumed unversioned (/usr/bin/)python always means python *2*. I guess the tools are written in the latter sense here, rewriting the shebang from python -> python2 explicitly unless you override it You should note that if you know the code is actually python-version agnostic you should be able to fix this by setting the shebang explicitly by using: https://sources.debian.org/src/dh-python/4.20191017/dh_python3/#L122 eg. in debian/rules use: export DH_OPTIONS=--shebang=/usr/bin/python3 > > A Python 3 helper setting /usr/bin/python2 looks odd to me, but I have > no in-depth knowledge of dh-python's design, or the corner cases it > might need to address. > > Is there a use case where dh_python3 (not dh_python2) doing this can > make sense? Or can this be considered a bug? I'm not really qualified to answer your questions here but my guess is that in the past this made sense, but nowadays probably not so much... > > Furthermore, the package does not list any Python 2 build dependencies, > and all binary package dependencies are generated by the > ${python3:Depends} substvar. Could this perhaps be worth an "if the > package does not have Python 2 dependencies, a Python 2 shebang is a > bug" lintian check? Having some safety-net in place here would likely be a good idea because I understand how this could easily be missed otherwise. Regards, Andreas Henriksson
Request to join DPMT and PAPT teams
Hi, I am a Debian Developer and I maintaining two packages - python-wget and vim-autopep8 under DPMT and PAPT teams respetively. Last year was relatively busy for me so I could not spend as much time as I wanted towards the maintainership. However, now that I can spend more time here, I wish to be a part of both of the teams and help with maintaining those packages. I have read and agree to the policy available at https://salsa.debian.org/python-team/tools/python-modules/blob/master/policy.rst My salsa username is balasankarc. Please add me to the python-team group in Salsa so that I could push my changes to the packages. Regards Balasankar "Balu" C signature.asc Description: OpenPGP digital signature
Re: dh_python3 sets shebang to Python 2 -- is this a bug?
Hi Andreas! On 20.01.20 17:40, Andreas Henriksson wrote: > On Mon, Jan 20, 2020 at 08:51:56AM +0100, Christian Kastner wrote: > I've personally seen some upstream use 'python' in shebang with the > intention of meaning 'works with either python2 or python3', but in > debian it seems people have always assumed unversioned > (/usr/bin/)python always means python *2*. > I guess the tools are written in the latter sense here, rewriting the > shebang from python -> python2 explicitly unless you override it That's the plausible explanation... it just felt odd to see this is an pure Python 3 package. > You should note that if you know the code is actually python-version > agnostic you should be able to fix this by setting the shebang > explicitly by using: > https://sources.debian.org/src/dh-python/4.20191017/dh_python3/#L122 > > eg. in debian/rules use: export DH_OPTIONS=--shebang=/usr/bin/python3 That worked, thanks! >> Furthermore, the package does not list any Python 2 build dependencies, >> and all binary package dependencies are generated by the >> ${python3:Depends} substvar. Could this perhaps be worth an "if the >> package does not have Python 2 dependencies, a Python 2 shebang is a >> bug" lintian check? > > Having some safety-net in place here would likely be a good idea because > I understand how this could easily be missed otherwise. Let's see if anyone else has something contradictory to add... else, I'll file the wishlist bug. Christian