public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH 06/12] python-utils-r1.eclass: Don't die in python_fix_shebang if all fixed
Date: Sat, 05 Jan 2019 22:42:27 +0100	[thread overview]
Message-ID: <1546724547.1889.16.camel@gentoo.org> (raw)
In-Reply-To: <20190105213814.6e916a5d@symphony.aura-online.co.uk>

[-- Attachment #1: Type: text/plain, Size: 3662 bytes --]

On Sat, 2019-01-05 at 21:38 +0000, James Le Cuirot wrote:
> On Fri, 04 Jan 2019 19:26:34 +0100
> Michał Górny <mgorny@gentoo.org> wrote:
> 
> > On Fri, 2019-01-04 at 13:10 -0500, Mike Gilbert wrote:
> > > On Fri, Jan 4, 2019 at 10:55 AM Michał Górny <mgorny@gentoo.org> wrote:  
> > > > 
> > > > On Thu, 2019-01-03 at 21:39 +0000, James Le Cuirot wrote:  
> > > > > Shebangs may need fixing on prefix systems or when cross-building but
> > > > > not at other times.
> > > > > 
> > > > > Signed-off-by: James Le Cuirot <chewi@gentoo.org>
> > > > > ---
> > > > >  eclass/python-utils-r1.eclass | 8 ++------
> > > > >  1 file changed, 2 insertions(+), 6 deletions(-)
> > > > > 
> > > > > diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
> > > > > index 19cfaf2798ab..91e457f3cf14 100644
> > > > > --- a/eclass/python-utils-r1.eclass
> > > > > +++ b/eclass/python-utils-r1.eclass
> > > > > @@ -1328,16 +1328,12 @@ python_fix_shebang() {
> > > > >                       fi
> > > > >               done < <(find -H "${path}" -type f -print0 || die)
> > > > > 
> > > > > -             if [[ ! ${any_fixed} ]]; then
> > > > > +             if [[ ! ${any_fixed} && ! ${any_correct} ]]; then
> > > > >                       local cmd=eerror
> > > > >                       [[ ${EAPI:-0} == [012345] ]] && cmd=eqawarn
> > > > > 
> > > > >                       "${cmd}" "QA warning: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files."
> > > > > -                     if [[ ${any_correct} ]]; then
> > > > > -                             "${cmd}" "All files have ${EPYTHON} shebang already."
> > > > > -                     else
> > > > > -                             "${cmd}" "There are no Python files in specified directory."
> > > > > -                     fi
> > > > > +                     "${cmd}" "There are no Python files in specified directory."
> > > > > 
> > > > >                       [[ ${cmd} == eerror ]] && die "${FUNCNAME} did not match any fixable files (QA warning fatal in EAPI ${EAPI})"
> > > > >               fi  
> > > > 
> > > > Sounds like you're introducing breakage, then abusing a function to fix
> > > > your breakage, then killing a useful diagnostic because you've just
> > > > broken it.  
> > > 
> > > I'm unable to make sense of what you are trying to say here. Is there
> > > something wrong with this patch, or are you making a general comment
> > > on the patch series?
> > >   
> > 
> > Original usage: rewrite 'python' to 'pythonX.Y', etc. on static files. 
> > Throws an error if you try to use for files that have correct shebang
> > already.
> > 
> > Now:
> > 
> > 1. Due to PYTHON override, generated files frequently have wrong
> > shebangs.
> > 
> > 2. python_fix_shebang is modified to fix this -- orthogonal behavior is
> > introduced.
> > 
> > 3. Now diagnostic on files with correct shebang is gone because it
> > conflicts with the orthogonal behavior added here.
> 
> The diagnostic is a problem even without my changes.
> 
> It's quite likely upstream could hardcode a shebang like
> #!/usr/bin/python2.7, which does not need to be modified on normal
> systems but does on prefixed systems. 

Fixing prefix was never the goal.

> 
> What about hardcoding #!/usr/bin/python3.6? This would need correcting
> against 3.7 but would fall foul of the diagnostic when using 3.6.

No, it would fail as mismatched shebang.  By design.

python_fix_shebang is meant to fix common cases of generic shebangs
in a safe way, not serve as a generic shebang replacement tool.

-- 
Best regards,
Michał Górny

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

  reply	other threads:[~2019-01-05 21:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03 21:39 [gentoo-dev] [PATCH] Eclass changes for cross-compiling Python modules James Le Cuirot
2019-01-03 21:39 ` [gentoo-dev] [PATCH 01/12] python-utils-r1.eclass: Fix some double slash paths James Le Cuirot
2019-01-03 21:39 ` [gentoo-dev] [PATCH 02/12] python-utils-r1.eclass: New python_fix_shebang approach James Le Cuirot
2019-01-04  6:02   ` Michał Górny
2019-01-06 17:20     ` James Le Cuirot
2019-01-03 21:39 ` [gentoo-dev] [PATCH 03/12] python-utils-r1.eclass: Have wrapper workdir default to "impl" arg James Le Cuirot
2019-01-03 21:39 ` [gentoo-dev] [PATCH 04/12] python-utils-r1.eclass: Use wrapper scripts to fix cross-compiling James Le Cuirot
2019-01-04 15:53   ` Michał Górny
2019-01-05 21:30     ` James Le Cuirot
2019-01-03 21:39 ` [gentoo-dev] [PATCH 05/12] python-utils-r1.eclass: Replace temporary paths in python_fix_shebang James Le Cuirot
2019-01-03 21:39 ` [gentoo-dev] [PATCH 06/12] python-utils-r1.eclass: Don't die in python_fix_shebang if all fixed James Le Cuirot
2019-01-04 15:55   ` Michał Górny
2019-01-04 18:10     ` Mike Gilbert
2019-01-04 18:26       ` Michał Górny
2019-01-05 21:38         ` James Le Cuirot
2019-01-05 21:42           ` Michał Górny [this message]
2019-01-06 14:52             ` James Le Cuirot
2019-01-03 21:39 ` [gentoo-dev] [PATCH 07/12] python-utils-r1.eclass: Add special wrapper handling for Python itself James Le Cuirot
2019-01-03 21:39 ` [gentoo-dev] [PATCH 08/12] python-utils-r1.eclass: Adjust wrappers for Python 3.7 libdir change James Le Cuirot
2019-01-03 21:39 ` [gentoo-dev] [PATCH 09/12] python-any-r1.eclass: Export PYTHON after checking whether installed James Le Cuirot
2019-01-03 21:39 ` [gentoo-dev] [PATCH 10/12] python-any-r1.eclass: Create wrappers against build system's config James Le Cuirot
2019-01-03 21:39 ` [gentoo-dev] [PATCH 11/12] distutils-r1.eclass: Fix cross-compiling James Le Cuirot
2019-01-03 21:39 ` [gentoo-dev] [PATCH 12/12] distutils-r1.eclass: Make distutils-r1_create_setup_cfg external James Le Cuirot
2019-01-04  2:11 ` [gentoo-dev] [PATCH] Eclass changes for cross-compiling Python modules Benda Xu
2019-01-04 16:03 ` Michał Górny
2019-01-05  0:06   ` James Le Cuirot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1546724547.1889.16.camel@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox