public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mike Gilbert <floppym@gentoo.org>
To: "Michał Górny" <mgorny@gentoo.org>
Cc: gentoo-python@lists.gentoo.org, python@gentoo.org, jlec@gentoo.org
Subject: [gentoo-python] Re: [PATCH] Introduce python_newscript().
Date: Fri, 1 Feb 2013 20:56:36 -0500	[thread overview]
Message-ID: <CAJ0EP43ixbCW7i8DQTu5hrX874-C_QiZBgOpaG8wCHVMRuEhTw@mail.gmail.com> (raw)
In-Reply-To: <1359769584-12644-1-git-send-email-mgorny@gentoo.org>

On Fri, Feb 1, 2013 at 8:46 PM, Michał Górny <mgorny@gentoo.org> wrote:
> Requested by jlec, I think.
> ---
>  gx86/eclass/python-utils-r1.eclass | 47 ++++++++++++++++++++++++++++++--------
>  1 file changed, 37 insertions(+), 10 deletions(-)
>
> diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass
> index b425302..c5a1f6e 100644
> --- a/gx86/eclass/python-utils-r1.eclass
> +++ b/gx86/eclass/python-utils-r1.eclass
> @@ -521,7 +521,34 @@ python_scriptinto() {
>  python_doscript() {
>         debug-print-function ${FUNCNAME} "${@}"
>
> +       local f
> +       for f; do
> +               python_newscript "${f}" "${f}"
> +       done
> +}


Won't this break on something like "python_doscript path/to/script"?
That would result in this call:

python_newscript path/to/script path/to/script

If I'm reading python_newscript correctly, $2 should not have any path
information.

> +
> +# @FUNCTION: python_newscript
> +# @USAGE: <path> <new-name>
> +# @DESCRIPTION:
> +# Install the given script into current python_scriptroot
> +# for the current Python implementation (${EPYTHON}), and name it
> +# <new-name>.
> +#
> +# The file must start with a 'python' shebang. The shebang will be
> +# converted, the file will be renamed to be EPYTHON-suffixed
> +# and a wrapper will be installed in place of the <new-name>.
> +#
> +# Example:
> +# @CODE
> +# src_install() {
> +#   python_foreach_impl python_newscript foo.py foo
> +# }
> +# @CODE
> +python_newscript() {
> +       debug-print-function ${FUNCNAME} "${@}"
> +
>         [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
> +       [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>"
>
>         local d=${python_scriptroot:-${DESTTREE}/bin}
>         local INSDESTTREE INSOPTIONS
> @@ -529,18 +556,18 @@ python_doscript() {
>         insinto "${d}"
>         insopts -m755
>
> -       local f
> -       for f; do
> -               local oldfn=${f##*/}
> -               local newfn=${oldfn}-${EPYTHON}
> +       local f=${1}
> +       local barefn=${2}
>
> -               debug-print "${FUNCNAME}: ${oldfn} -> ${newfn}"
> -               newins "${f}" "${newfn}" || die
> -               _python_rewrite_shebang "${ED}/${d}/${newfn}"
> +       local oldfn=${f##*/}
> +       local newfn=${barefn}-${EPYTHON}
>
> -               # install the wrapper
> -               _python_ln_rel "${ED}"/usr/bin/python-exec "${ED}/${d}/${oldfn}" || die
> -       done
> +       debug-print "${FUNCNAME}: ${oldfn} -> ${newfn}"
> +       newins "${f}" "${newfn}" || die
> +       _python_rewrite_shebang "${ED}/${d}/${newfn}"
> +
> +       # install the wrapper
> +       _python_ln_rel "${ED}"/usr/bin/python-exec "${ED}/${d}/${barefn}" || die
>  }
>
>  # @ECLASS-VARIABLE: python_moduleroot
> --
> 1.8.1.2
>


  reply	other threads:[~2013-02-02  1:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-02  1:46 [gentoo-python] [PATCH] Introduce python_newscript() Michał Górny
2013-02-02  1:56 ` Mike Gilbert [this message]
2013-02-02  9:58   ` [gentoo-python] " Michał Górny
2013-02-02 15:32     ` Mike Gilbert

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=CAJ0EP43ixbCW7i8DQTu5hrX874-C_QiZBgOpaG8wCHVMRuEhTw@mail.gmail.com \
    --to=floppym@gentoo.org \
    --cc=gentoo-python@lists.gentoo.org \
    --cc=jlec@gentoo.org \
    --cc=mgorny@gentoo.org \
    --cc=python@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