← Back to team overview

kicad-developers team mailing list archive

Re: Python shebangs

 

I don't think this is an issue outside of Fedora.

On Tue, Nov 6, 2018 at 8:45 AM Steven A. Falco <stevenfalco@xxxxxxxxx>
wrote:

> I'd like to have a discussion about python shebangs.  I noticed several
> rpmlint errors when building the official Fedora packages.  Specifically,
> rpmlint is complaining about using "env" as a method for locating the
> python interpreter.  Here are the errors:
>
> kicad-doc.noarch: E: wrong-script-interpreter
> /usr/share/doc/kicad/scripts/ddr3_length_match.py /usr/bin/env python2
> kicad-doc.noarch: E: wrong-script-interpreter
> /usr/share/doc/kicad/scripts/mk_macos_icons.py /usr/bin/env python
> kicad-doc.noarch: E: wrong-script-interpreter
> /usr/share/doc/kicad/scripts/mk_mime_icons.py /usr/bin/env python
>
> I've done a little research, and apparently, the concern is that "env" may
> find a locally installed python interpreter that doesn't work the same as
> the system python interpreter, and that can result in subtle bugs.  Of
> course the locally-installed interpreter may have been installed
> specifically because of bugs in the system interpreter!
>
> There is an interesting web page
> https://blogs.gnome.org/mcatanzaro/2018/02/16/on-python-shebangs/ that
> goes into a lot more detail about this topic.
>
> I see a few ways I can proceed.
>
> 1) Ignore the errors.  I don't know if this is viable - I have to wait a
> week or so to see if the package is accepted with the errors present.
>
> 2) Add a Fedora-only patch to change the shebangs into something
> acceptable.  I'd probably set them to "#!/usr/bin/python2".
>
> 3) Add an "exception file" to tell rpmlint to ignore these errors.
>
> 4) Have upstream KiCad "fix" the problem, although given the discussion in
> the web page above, I'm not even sure what a good fix would be.
>
> Some people have suggested having the build scripts locate the correct
> (system) interpreter to use, and patch the scripts at build-time to
> explicitly put in the absolute path to the system interpreter.  That might
> be a nice way to deal with cross-platform issues between Mac, Linux, and
> Windows but it could get messy if a later OS release puts the interpreter
> in a different place or renames it.
>
> Please let me know what you think about this so I know how to proceed.
>
>         Thanks,
>         Steve
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>

References