kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #38291
Python shebangs
-
To:
KiCad Developers <kicad-developers@xxxxxxxxxxxxxxxxxxx>
-
From:
"Steven A. Falco" <stevenfalco@xxxxxxxxx>
-
Date:
Tue, 6 Nov 2018 09:45:29 -0500
-
Autocrypt:
addr=stevenfalco@xxxxxxxxx; keydata= xsBNBFsz14EBCACybmOt8ADXje8UJJ4hPBTZo3Sm3XS5hhMUDb1/6rQSbT7dpFf3CGp4qwIB DMfS4sV1JMyr3Sl67HzvTMqqHCOTj/QSWiRtFEiasYy82ujfN0/82esM5uKK7Ev2QTs+PZ+Z oqZCwuD7FIRgKtKogJrYmM0aNkKYf1cw4WsND8eGcN1EmmVAQ0PIptpXhiSkJbQLFm06lyTp OBA9MctcPXCRE3DRgByx0YJAjeSckHnU8grJY6niIJgYv5pfrOYSEI+aHgEyePgPzuVz5Y1G 1lb35JG6kdH7GJ406Gggrwe/ia15+HDUMMIy+7EHUSeVWhuXjyW8h4IbbdJ9/YJJa5R9ABEB AAHNJ1N0ZXZlbiBBLiBGYWxjbyA8c3RldmVuZmFsY29AZ21haWwuY29tPsLAlAQTAQgAPhYh BFyBX3Re/Ohwg2zkVLdBZWVuLJciBQJbM9eBAhsDBQkDwmcABQsJCAcCBhUKCQgLAgQWAgMB Ah4BAheAAAoJELdBZWVuLJcia4EIAKziir4OlOCoOnrcLkL5uHGPD1DmbmvBPGiAmgMRvtFC TZ+AhAH10B/Bl7zrti3sNrCs4Q74cU9ApY13ZWeRHfFGnoQnVNQHMf7bTF+iBLqMJvCLOLva mT0mE38fwhwiHD/f1E8AG+vQWgodOwX6Y1qFc4XkozkOJGSW/ZH8mOS28ctdSjVliV4dqTZ3 5Tfb34HDKBtmh/pPAfEfEldN9p3iNo8nkKfAFaYS4HcGj7M2EZ3yPPs8ALRUKs3D4YvDMM8G Uc63nBYmOAnXnXkqb39VnqpELJQjVoL9vDOmxY/yxoZQvtwBhTsXtWGH6czoNxj+QHp+KjUW PmMweX10dyjOwE0EWzPXgQEIAN5WNTBUyL/eZ6wr4le5J6zoUZTm2pwxaqsyOje+iyoa/Cpa imhAaFnYe3N3z3gvlIPOLUAmyzUmy2ph9yMsi+GXFP3ZxaPk5uP4fmvivF6OuOlrNSpbEdn1 2AU0msRZccTbWIU6wunkvi7cUYJLe+ZZEn43ALaIMwFegRZqe57Re8pc8k0wlYOsVrZ8UTTp NEXGJ+c/aC1K5xhPUt6nCZNfvkAOdQ74mVrg4ogXuGl1vbZS0J8mv+OOe9RYUqFSUPo3MIGT M68SOfE6NmsVXI/Glb7m6kMKQt+Tm22hKVxyptIgNqA4qrYBc/PMCvGObnCKEy4GSLii1bcz D9a+2ZcAEQEAAcLAfAQYAQgAJhYhBFyBX3Re/Ohwg2zkVLdBZWVuLJciBQJbM9eBAhsMBQkD wmcAAAoJELdBZWVuLJci65cIAKbId2gAW8DVDkra1aMfhqp9NvdiMVCMSvDbSY8iHKDURMHp Tj1Dzi5W8yroqM3Gi2P4ixDHxMuEiwRLqP/E9XubXCBEJyZz/9oTiG9XumY2x2lj4U9/YZsQ 3Cn9vS7r4197ryw/xWBDZeqx/JpUwLhRSK6t8PaXD+nlrwHfs0CihfiYdkCbgJljibZAGziF 31gG4iTqNVpJupOAjL8pFt9KuuvcJEDjU9xPxvfFn3MwbBWSEBH1xbVc8Mwt3Tq1tD7+47GR HLb/21KLBIxfXB+wDvl3Dlgg9UhQCuxVfjTFPUBi9Lqv3NZg8+o0gEzHepAmFc/QvdH8quum hkppYOY=
-
Openpgp:
preference=signencrypt
-
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0
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
Follow ups