blob: 5ee2e2af8382e8ec36779a2852231e9766bec6b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# -*- coding: utf-8 -*-
#
# File: portato/backend/__init__.py
# This file is part of the Portato-Project, a graphical portage-frontend.
#
# Copyright (C) 2006 René 'Necoro' Neumann
# This is free software. You may redistribute copies of it under the terms of
# the GNU General Public License version 2.
# There is NO WARRANTY, to the extent permitted by law.
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
import sys, copy, os
from threading import Lock
# import portage
import portage
class PortageSettings:
def __init__ (self):
self.settingslock = Lock()
self.load()
def load(self):
kwargs = {}
for k, envvar in (("config_root", "PORTAGE_CONFIGROOT"), ("target_root", "ROOT")):
kwargs[k] = os.environ.get(envvar, None)
self.trees = portage.create_trees(trees=None, **kwargs)
self.settings = self.trees["/"]["vartree"].settings
for myroot in self.trees:
if myroot != "/":
self.settings = self.trees[myroot]["vartree"].settings
break
self.settings.unlock()
root = self.settings["ROOT"]
self.porttree = self.trees[root]["porttree"]
self.vartree = self.trees[root]["vartree"]
self.virtuals = self.trees[root]["virtuals"]
# portage tree vars
portage_settings = PortageSettings()
settingslock = portage_settings.settingslock
settings = portage_settings.settings
trees = portage_settings.trees
porttree = portage_settings.porttree
vartree = portage_settings.vartree
virtuals = portage_settings.virtuals
# this is set to "var/lib/portage/world" by default - so we add the leading /
portage.WORLD_FILE = portage.settings["ROOT"]+portage.WORLD_FILE
portage.settings = None # we use our own one ...
# import our packages
from exceptions import *
from package import *
from portage_helper import *
|