Gentoo Archives: gentoo-portage-dev

From: Brian <dol-sen@×××××.net>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] portage management node
Date: Sun, 09 Apr 2006 17:41:14
Message-Id: 1144604565.14148.30.camel@localhost
In Reply to: Re: [gentoo-portage-dev] portage management node by Zac Medico
1 On Sun, 2006-09-04 at 10:27 -0700, Zac Medico wrote:
2 > -----BEGIN PGP SIGNED MESSAGE-----
3 > Hash: SHA1
4 >
5 > Eldad Zack wrote:
6 > > I've came across another problem as well.
7 > > importing portage will go through its initialization, checking VDB and sorts,
8 > > so that if I'd like in to switch a VDB I'll have to re-import portage. Since
9 > > I do not know of a way to re-import portage in python, I've worked around
10 > > this by changing ROOT env and then call portage via os.system calls.
11 > > On my humble amd 2600 machine this yields a 8 seconds average per VDB change.
12 > >
13 > > Is there something I can do beside replicating the init code into a function,
14 > > change root and recall the init function again?
15 > >
16 > > Is there a better way of doing this?
17 >
18 > In python's built-in global function list you'll see one called reload(). If you call reload(portage), it causes a re-import of the module.
19 >
20 > Zac
21
22 Just a word of caution. I don't know why but sometimes after an upgrade
23 of portage a reload(portage) in porthole fails and porthole crashes. I
24 don't remember the details atm and have not investigated the reasons.
25 In all cases restarting porthole, all works fine again. It may not ever
26 happen to your code though.
27
28 --
29 Brian <dol-sen@×××××.net>
30
31 --
32 gentoo-portage-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-portage-dev] portage management node Zac Medico <zmedico@g.o>