Gentoo Archives: gentoo-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Python 2.7 status check?
Date: Tue, 30 Nov 2010 02:25:21
Message-Id: 4CF4605F.2050600@gentoo.org
In Reply to: Re: [gentoo-dev] Python 2.7 status check? by Sebastian Pipping
1 On 11/29/2010 01:14 PM, Sebastian Pipping wrote:
2 > On 11/29/10 18:33, Zac Medico wrote:
3 >> You could also cancel it out, by checking the state in pkg_preinst and
4 >> saving it in an environment variable so that you can restore it in
5 >> pkg_postinst.
6 >
7 > Could you show a mockup of that?
8 > I'm not really sure how that would work.
9 >
10 > Would it work for pkg_postrm code of already installed packages?
11 > That would great to have.
12
13 Yes, hopefully something like this will do it:
14
15 pkg_preinst() {
16 main_active_python=$(eselect python show)
17 }
18
19 pkg_postinst() {
20 if [[ -n $main_active_python &&
21 $main_active_python != $(eselect python show) ]] ; then
22 einfo "restoring active python interpreter"
23 eselect python set "$main_active_python"
24 fi
25 }
26
27 --
28 Thanks,
29 Zac

Replies

Subject Author
Re: [gentoo-dev] Python 2.7 status check? Sebastian Pipping <sping@g.o>
Re: [gentoo-dev] Python 2.7 status check? Sebastian Pipping <sping@g.o>