It seems python_fix_shebang cannot prepend a shebang line to a pyhton script. * Package: sci-biology/eval-2.2.8 * Repository: science * Maintainer: mmokrejs@fold.natur.cuni.cz sci-biology@gentoo.org * USE: abi_x86_64 amd64 elibc_glibc kernel_linux python_targets_python2_7 userland_GNU * FEATURES: nostrip preserve-libs sandbox splitdebug userpriv usersandbox >>> Unpacking source... >>> Unpacking eval-2.2.8.tar.gz to /scratch/var/tmp/portage/sci-biology/eval-2.2.8/work >>> Unpacking eval-documentation.pdf to /scratch/var/tmp/portage/sci-biology/eval-2.2.8/work unpack eval-documentation.pdf: file format not recognized. Ignoring. >>> Source unpacked in /scratch/var/tmp/portage/sci-biology/eval-2.2.8/work >>> Preparing source in /scratch/var/tmp/portage/sci-biology/eval-2.2.8/work/eval-2.2.8 ... >>> Source prepared. >>> Configuring source in /scratch/var/tmp/portage/sci-biology/eval-2.2.8/work/eval-2.2.8 ... >>> Source configured. >>> Compiling source in /scratch/var/tmp/portage/sci-biology/eval-2.2.8/work/eval-2.2.8 ... >>> Source compiled. >>> Test phase [not enabled]: sci-biology/eval-2.2.8 >>> Install eval-2.2.8 into /scratch/var/tmp/portage/sci-biology/eval-2.2.8/image/ category sci-biology * python2_7: running python_doscript RangeFinder.py merge_gtf_transcripts.py * The file has incompatible shebang: * file: /usr/lib/python-exec/python2.7/RangeFinder.py * current shebang: """Container index by sequence id, range, and optionally strand that efficiently * requested impl: python2.7 * ERROR: sci-biology/eval-2.2.8::science failed (install phase): * python_fix_shebang: conversion of incompatible shebang requested * * Call stack: * ebuild.sh, line 115: Called src_install * environment, line 3742: Called python_foreach_impl 'python_doscript' 'RangeFinder.py' 'merge_gtf_transcripts.py' * environment, line 3272: Called multibuild_foreach_variant '_python_multibuild_wrapper' 'python_doscript' 'RangeFinder.py' 'merge_gtf_transcripts.py' * environment, line 1997: Called _multibuild_run '_python_multibuild_wrapper' 'python_doscript' 'RangeFinder.py' 'merge_gtf_transcripts.py' * environment, line 1995: Called _python_multibuild_wrapper 'python_doscript' 'RangeFinder.py' 'merge_gtf_transcripts.py' * environment, line 468: Called python_doscript 'RangeFinder.py' 'merge_gtf_transcripts.py' * environment, line 2922: Called python_doexe 'RangeFinder.py' 'merge_gtf_transcripts.py' * environment, line 2883: Called python_newexe 'RangeFinder.py' 'RangeFinder.py' * environment, line 3503: Called python_fix_shebang '-q' '/scratch/var/tmp/portage/sci-biology/eval-2.2.8/image//usr/lib/python-exec/python2.7/RangeFinder.py' * environment, line 3251: Called die * The specific snippet of code: * die "${FUNCNAME}: conversion of incompatible shebang requested"; * * If you need support, post the output of `emerge --info '=sci-biology/eval-2.2.8::science'`, * the complete build log and the output of `emerge -pqv '=sci-biology/eval-2.2.8::science'`. * The complete build log is located at '/scratch/var/tmp/portage/sci-biology/eval-2.2.8/temp/build.log'. * The ebuild environment file is located at '/scratch/var/tmp/portage/sci-biology/eval-2.2.8/temp/environment'. * Working directory: '/scratch/var/tmp/portage/sci-biology/eval-2.2.8/work/eval-2.2.8' * S: '/scratch/var/tmp/portage/sci-biology/eval-2.2.8/work/eval-2.2.8'
That's really not the purpose of python_fix_shebang.
Yeah, it would be inconsistent with other bits of how it operates -- e.g. that it rejects incompatible shebangs.
In a pinch, you could use the following command to add a shebang, and then call python_fix_shebang to fix it. sed -i -e '1i #!/usr/bin/env python' myscript || die
(In reply to Mike Gilbert from comment #3) > In a pinch, you could use the following command to add a shebang, and then > call python_fix_shebang to fix it. > > sed -i -e '1i #!/usr/bin/env python' myscript || die Or even: sed -i -e "1i #!/usr/bin/env ${EPYTHON}" myscript || die and not have to fix it at all ;-P.
(In reply to Michał Górny from comment #4) > Or even: > > sed -i -e "1i #!/usr/bin/env ${EPYTHON}" myscript || die > > and not have to fix it at all ;-P. * The file has incompatible shebang: * file: /usr/lib/python-exec/python2.7/RangeFinder.py * current shebang: #!/usr/bin/env * requested impl: python2.7 * ERROR: sci-biology/eval-2.2.8::science failed (install phase): * python_fix_shebang: conversion of incompatible shebang requested IMHO 'python_foreach_impl python_doscript *.py' should have done this for me automagically. Some of the have a shebang line, one does not.
(In reply to Michał Górny from comment #4) > (In reply to Mike Gilbert from comment #3) > > In a pinch, you could use the following command to add a shebang, and then > > call python_fix_shebang to fix it. > > > > sed -i -e '1i #!/usr/bin/env python' myscript || die > > Or even: > > sed -i -e "1i #!/usr/bin/env ${EPYTHON}" myscript || die > > and not have to fix it at all ;-P. I failed with this so I had to let python_fix_shebang to fix it. See last two commits: https://cgit.gentoo.org/proj/sci.git/commit/sci-biology/eval?id=91d9ac3dd8937f2091118f1f3ac1d638898445d9 https://cgit.gentoo.org/proj/sci.git/commit/sci-biology/eval?id=a4fd373b45de86b4a6b5d631c2a4ddc148e290eb Seemed I have to include python-ditutils-r1 but then than I had to override src_compile as there is no setup.py, so I just puth there #!/usr.bin/env python