1 |
Hi, |
2 |
|
3 |
during bootstrap on native gentoo-linux I encountered this error: |
4 |
|
5 |
Traceback (most recent call last): |
6 |
File "/eprefix/usr/lib/portage/bin/portageq", line 467, in ? |
7 |
main() |
8 |
File "/eprefix/usr/lib/portage/bin/portageq", line 450, in main |
9 |
except portage.exception.PermissionDenied, e: |
10 |
AttributeError: 'module' object has no attribute 'exception' |
11 |
|
12 |
This is because portageq tries to 'import portage', and only if it |
13 |
fails, it prepends sys.path with "/eprefix/usr/lib/portage/pym". |
14 |
|
15 |
Prepending sys.path unconditionally helps here, because it accidentally |
16 |
imported another portage: |
17 |
|
18 |
--- usr/lib/portage/bin/portageq.orig 2007-12-07 16:14:26.768371000 +0100 |
19 |
+++ usr/lib/portage/bin/portageq 2007-12-07 16:14:48.689741000 +0100 |
20 |
@@ -434,14 +434,11 @@ |
21 |
sys.stderr.flush() |
22 |
sys.exit(os.EX_USAGE) |
23 |
os.environ["ROOT"] = sys.argv[2] |
24 |
+ from os import path as osp |
25 |
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) |
26 |
+ global portage |
27 |
+ import portage |
28 |
try: |
29 |
- global portage |
30 |
- try: |
31 |
- import portage |
32 |
- except ImportError: |
33 |
- from os import path as osp |
34 |
- sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) |
35 |
- import portage |
36 |
if uses_root: |
37 |
sys.argv[2] = portage.root |
38 |
retval = function(sys.argv[2:]) |
39 |
|
40 |
IMO having portage-provided "executables" (like emerge (does it?), |
41 |
portageq, ...) relying on PYTHONPATH to "import portage" correctly is a |
42 |
pain - not only in prefix: think of calling /usr/bin/portageq (the |
43 |
"native" one) while prefix' PYTHONPATH is set up in environment... |
44 |
|
45 |
/haubi/ |
46 |
-- |
47 |
Michael Haubenwallner |
48 |
Gentoo on a different level |
49 |
|
50 |
-- |
51 |
gentoo-alt@g.o mailing list |