line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gentoo::Config; |
2
|
9
|
|
|
9
|
|
2936
|
use Carp; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
797
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our($VERSION)=q{1.0.6}; |
5
|
|
|
|
|
|
|
our(@ISA) = qw(Inline::Python::Object); |
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
41
|
use strict;$|=1; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
1117
|
|
8
|
|
|
|
|
|
|
BEGIN { |
9
|
9
|
|
|
9
|
|
43
|
my $dir = "$ENV{HOME}/.Inline"; |
10
|
9
|
50
|
0
|
|
|
164
|
-d "$dir" || mkdir "$dir" || die "cannot make $dir\n"; |
11
|
9
|
50
|
|
|
|
131
|
-o "$dir" || die "$dir ain't mine\n"; |
12
|
9
|
|
|
|
|
90
|
$ENV{PERL_INLINE_DIRECTORY}=$dir; |
13
|
9
|
|
|
|
|
304
|
$ENV{"PORTAGE_CALLER"} = "stealth_caller" |
14
|
|
|
|
|
|
|
}; |
15
|
9
|
|
|
9
|
|
5114
|
use Inline Python => <<'EOF'; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
import sys, os |
17
|
|
|
|
|
|
|
import portage |
18
|
|
|
|
|
|
|
class portset: |
19
|
|
|
|
|
|
|
def __init__(self): |
20
|
|
|
|
|
|
|
self.name = "portset" |
21
|
|
|
|
|
|
|
def keys(self): |
22
|
|
|
|
|
|
|
return portage.settings.keys() |
23
|
|
|
|
|
|
|
def put(self,x,y): |
24
|
|
|
|
|
|
|
portage.settings[x] = y |
25
|
|
|
|
|
|
|
def has_key(self,x): |
26
|
|
|
|
|
|
|
if x in self.keys(): |
27
|
|
|
|
|
|
|
return 1 |
28
|
|
|
|
|
|
|
return 0 |
29
|
|
|
|
|
|
|
def _get(self,x): |
30
|
|
|
|
|
|
|
return portage.settings[x] |
31
|
|
|
|
|
|
|
EOF |
32
|
|
|
|
|
|
|
sub get { |
33
|
|
|
|
|
|
|
my $self = shift; |
34
|
|
|
|
|
|
|
my $key = shift; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
if ( $key eq 'KEYS' ) { |
37
|
|
|
|
|
|
|
return $self->keys(); |
38
|
|
|
|
|
|
|
} elsif ( $self->has_key($key) ) { |
39
|
|
|
|
|
|
|
return $self->_get($key); |
40
|
|
|
|
|
|
|
} elsif ( @_ ) { |
41
|
|
|
|
|
|
|
return shift @_; |
42
|
|
|
|
|
|
|
} else { |
43
|
|
|
|
|
|
|
croak("No value for $key, and no default provided"); |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
sub new { |
47
|
|
|
|
|
|
|
my ($class) = map { ref $_ || $_ } $_[0]; |
48
|
|
|
|
|
|
|
my $body = Inline::Python::Object->new('__main__','portset'); |
49
|
|
|
|
|
|
|
return bless($body,$class); |
50
|
|
|
|
|
|
|
}; |
51
|
|
|
|
|
|
|
1; |