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, hasufell@gentoo.org
Subject: [gentoo-python] Re: [PATCH 1/2] python_doscript() to install Python scripts.
Date: Sat, 17 Nov 2012 14:39:05 -0500	[thread overview]
Message-ID: <CAJ0EP41bni=LtCBSgidG6vKbxQ=jKmzOjRqnF+BGGhtGbU0dLw@mail.gmail.com> (raw)
In-Reply-To: <1352922846-4290-1-git-send-email-mgorny@gentoo.org>

On Wed, Nov 14, 2012 at 2:54 PM, Michał Górny <mgorny@gentoo.org> wrote:
> ---
>  gx86/eclass/python-r1.eclass | 66 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 66 insertions(+)
>
> diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
> index 6d4eb33..44103a8 100644
> --- a/gx86/eclass/python-r1.eclass
> +++ b/gx86/eclass/python-r1.eclass
> @@ -611,3 +611,69 @@ python_replicate_script() {
>                 _python_ln_rel "${ED}"/usr/bin/python-exec "${f}" || die
>         done
>  }
> +
> +# @ECLASS-VARIABLE: python_scriptroot
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# The current script destination for python_doscript(). The path
> +# is relative to the installation root (${ED}).
> +#
> +# When unset, ${DESTTREE}/bin (/usr/bin by default) will be used.
> +#
> +# Can be set indirectly through the python_scriptinto() function.
> +#
> +# Example:
> +# @CODE
> +# src_install() {
> +#   local python_scriptroot=${GAMES_BINDIR}
> +#   python_foreach_impl python_doscript foo
> +# }
> +# @CODE
> +
> +# @FUNCTION: python_scriptinto
> +# @USAGE: <new-path>
> +# @DESCRIPTION:
> +# Set the current scriptroot. The new value will be stored
> +# in the 'python_scriptroot' environment variable. The new value need
> +# be relative to the installation root (${ED}).
> +#
> +# Alternatively, you can set the variable directly.
> +python_scriptinto() {
> +       debug-print-function ${FUNCNAME} "${@}"
> +
> +       python_scriptroot=${1}
> +}
> +
> +# @FUNCTION: python_doscript
> +# @USAGE: <files>...
> +# @DESCRIPTION:
> +# Install the given scripts into current python_scriptroot,
> +# for the current Python implementation (${EPYTHON}).
> +#
> +# All specified files 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 original name.
> +python_doscript() {
> +       debug-print-function ${FUNCNAME} "${@}"
> +
> +       [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
> +
> +       local d=${python_scriptroot:-${DESTTREE}/bin}
> +       local INSDESTTREE INSOPTIONS
> +
> +       insinto "${d}"
> +       insopts -m755
> +

Could possibly use exeinto/newexe instead here.

> +       local f
> +       for f; do
> +               local oldfn=${f##*/}
> +               local newfn=${oldfn}-${EPYTHON}
> +
> +               debug-print "${FUNCNAME}: ${oldfn} -> ${newfn}"
> +               newins "${f}" "${newfn}"
> +               _python_rewrite_shebang "${D}/${d}/${newfn}"
> +
> +               # install the wrapper
> +               _python_ln_rel "${ED}"/usr/bin/python-exec "${D}/${d}/${oldfn}" || die
> +       done
> +}
> --
> 1.8.0
>

Looks fine overall.


  parent reply	other threads:[~2012-11-17 19:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14 19:54 [gentoo-python] [PATCH 1/2] python_doscript() to install Python scripts Michał Górny
2012-11-14 19:54 ` [gentoo-python] [PATCH 2/2] python_domodule() to install Python modules Michał Górny
2012-11-17 19:39 ` Mike Gilbert [this message]
2012-11-17 21:26   ` [gentoo-python] Re: [PATCH 1/2] python_doscript() to install Python scripts Michał Górny

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='CAJ0EP41bni=LtCBSgidG6vKbxQ=jKmzOjRqnF+BGGhtGbU0dLw@mail.gmail.com' \
    --to=floppym@gentoo.org \
    --cc=gentoo-python@lists.gentoo.org \
    --cc=hasufell@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