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