Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/6] python: rework python symlinks installation
Date: Sat, 29 Mar 2014 12:05:16 +0100	[thread overview]
Message-ID: <20140329110516.GB3227@free.fr> (raw)
In-Reply-To: <1394057085-10399-2-git-send-email-s.martin49@gmail.com>

Samuel, All,

On 2014-03-05 23:04 +0100, Samuel Martin spake thusly:
> This change adds a patch to python disabling the installation of the
> python and python-config symlinks.
[--SNIP--]
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  .../python/python-011-remove-python-symlink.patch  | 29 ++++++++++++++++++++
>  package/python/python.mk                           | 32 ++++++++++++++++++++++
>  2 files changed, 61 insertions(+)
>  create mode 100644 package/python/python-011-remove-python-symlink.patch
> 
> diff --git a/package/python/python-011-remove-python-symlink.patch b/package/python/python-011-remove-python-symlink.patch
> new file mode 100644
> index 0000000..a9b1daa
> --- /dev/null
> +++ b/package/python/python-011-remove-python-symlink.patch
> @@ -0,0 +1,29 @@
> +Remove the python symlink install rules.
> +
> +The python symlink installation will be handled by Buildroot itself, because
> +Buildroot needs to control to what python interpreter (python2 or python3) the
> +python symlink points to.
> +
> +Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> +
> +diff -purN a/Makefile.pre.in b/Makefile.pre.in
> +--- a/Makefile.pre.in	2014-03-02 17:56:56.529132499 +0100
> ++++ b/Makefile.pre.in	2014-03-02 19:24:02.346491849 +0100
> +@@ -857,17 +857,10 @@ $(DESTSHARED):
> + #  $(PYTHON) -> python2 -> python$(VERSION))
> + # Also create equivalent chains for other installed files
> + bininstall:	altbininstall
> +-	-if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
> +-	then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
> +-	else true; \
> +-	fi
> +-	(cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(EXE) $(PYTHON))
> + 	-rm -f $(DESTDIR)$(BINDIR)/python2$(EXE)
> + 	(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python2$(EXE))
> + 	-rm -f $(DESTDIR)$(BINDIR)/python2-config
> + 	(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python2-config)
> +-	-rm -f $(DESTDIR)$(BINDIR)/python-config
> +-	(cd $(DESTDIR)$(BINDIR); $(LN) -s python2-config python-config)
> + 	-test -d $(DESTDIR)$(LIBPC) || $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC)
> + 	-rm -f $(DESTDIR)$(LIBPC)/python2.pc
> + 	(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python2.pc)

I guess this patch can't go upstream, of course.

But what about adding a configure flag --enable-install-symlinks to
decide whether to install or not to install the symlinks? Such a patch
is probably more involved, of course, but may have a chance of being
accepted upstream.

This comment should not bar this changeset to be applied.

> diff --git a/package/python/python.mk b/package/python/python.mk
> index 216448e..ec9a6d3 100644
> --- a/package/python/python.mk
> +++ b/package/python/python.mk
> @@ -175,8 +175,40 @@ endef
>  
>  PYTHON_POST_INSTALL_TARGET_HOOKS += PYTHON_ENSURE_LIBPYTHON_STRIPPED
>  
> +#
> +# Always install the python symlink in the target tree
> +#

I know there two other such comments, but the leading and following
empty comment lines are overkill, and most othe comments are not
following this syntax (which I find particularly ugly. Ditto for the
comments below.

> +define PYTHON_INSTALL_TARGET_PYTHON_SYMLINK
> +	ln -sf python2 $(TARGET_DIR)/usr/bin/python
> +endef
> +
> +PYTHON_POST_INSTALL_TARGET_HOOKS += PYTHON_INSTALL_TARGET_PYTHON_SYMLINK
> +
> +#
> +# Always install the python-config symlink in the staging tree
> +#
> +define PYTHON_INSTALL_STAGING_PYTHON_CONFIG_SYMLINK
> +	ln -sf python2-config $(STAGING_DIR)/usr/bin/python-config
> +endef
> +
> +PYTHON_POST_INSTALL_STAGING_HOOKS += PYTHON_INSTALL_STAGING_PYTHON_CONFIG_SYMLINK
> +
>  PYTHON_AUTORECONF = YES
>  
> +#
> +# Some packages may have build scripts requiring python2.
> +# Only install the python symlink in the host tree if python(2) is enabled

Why 'python(2)' and not simply 'python2'? We know BR2_PACKAGE_PYTHON is
python2. I found this confusing.

> +# for the target.
> +#
> +ifeq ($(BR2_PACKAGE_PYTHON),y)
> +define HOST_PYTHON_INSTALL_PYTHON_SYMLINK
> +	ln -sf python2 $(HOST_DIR)/usr/bin/python
> +	ln -sf python2-config $(HOST_DIR)/usr/bin/python-config
> +endef
> +
> +HOST_PYTHON_POST_INSTALL_HOOKS += HOST_PYTHON_INSTALL_PYTHON_SYMLINK
> +endif
> +
>  # Provided to other packages
>  PYTHON_PATH = $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/sysconfigdata/:$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages/
>  
> -- 
> 1.9.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2014-03-29 11:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05 22:04 [Buildroot] [PATCH 0/6] host-python2 hard dependency Samuel Martin
2014-03-05 22:04 ` [Buildroot] [PATCH 1/6] python: rework python symlinks installation Samuel Martin
2014-03-29 11:05   ` Yann E. MORIN [this message]
2014-03-05 22:04 ` [Buildroot] [PATCH 2/6] python3: " Samuel Martin
2014-03-29 11:23   ` Yann E. MORIN
2014-03-05 22:04 ` [Buildroot] [PATCH 3/6] pkg-python: support host-python dependency different from the python in the target Samuel Martin
2014-03-29 11:47   ` Yann E. MORIN
2014-03-29 13:26     ` Thomas Petazzoni
2014-03-29 13:58       ` Yann E. MORIN
2014-03-05 22:04 ` [Buildroot] [PATCH 4/6] scons: force host-python dependency to be python2 Samuel Martin
2014-03-29 11:50   ` Yann E. MORIN
2014-03-05 22:04 ` [Buildroot] [PATCH 5/6] python-m2crypto: requires host-python2 Samuel Martin
2014-03-29 11:51   ` Yann E. MORIN
2014-03-05 22:04 ` [Buildroot] [PATCH 6/6] crda: override python interperter Samuel Martin
2014-03-29 11:56   ` Yann E. MORIN
2014-04-05 15:42 ` [Buildroot] [PATCH 0/6] host-python2 hard dependency Thomas Petazzoni

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=20140329110516.GB3227@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /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