1 |
Author: zmedico |
2 |
Date: 2008-07-01 12:53:07 +0000 (Tue, 01 Jul 2008) |
3 |
New Revision: 10874 |
4 |
|
5 |
Modified: |
6 |
main/trunk/bin/dispatch-conf |
7 |
main/trunk/bin/dohtml |
8 |
main/trunk/bin/glsa-check |
9 |
main/trunk/bin/repoman |
10 |
Log: |
11 |
Py3k compatibility patch #5 by Ali Polatel <hawking@g.o>. |
12 |
Replace dict.has_key() calls with "in" and "not in" operators. |
13 |
|
14 |
|
15 |
Modified: main/trunk/bin/dispatch-conf |
16 |
=================================================================== |
17 |
--- main/trunk/bin/dispatch-conf 2008-07-01 12:50:41 UTC (rev 10873) |
18 |
+++ main/trunk/bin/dispatch-conf 2008-07-01 12:53:07 UTC (rev 10874) |
19 |
@@ -72,7 +72,7 @@ |
20 |
|
21 |
self.options = portage.dispatch_conf.read_config(MANDATORY_OPTS) |
22 |
|
23 |
- if self.options.has_key("log-file"): |
24 |
+ if "log-file" in self.options: |
25 |
if os.path.isfile(self.options["log-file"]): |
26 |
shutil.copy(self.options["log-file"], self.options["log-file"] + '.old') |
27 |
if os.path.isfile(self.options["log-file"]) \ |
28 |
@@ -270,7 +270,7 @@ |
29 |
show_new_diff = 1 |
30 |
continue |
31 |
elif c == 'e': |
32 |
- if not os.environ.has_key('EDITOR'): |
33 |
+ if 'EDITOR' not in os.environ: |
34 |
os.environ['EDITOR']='nano' |
35 |
os.system(os.environ['EDITOR'] + ' ' + newconf) |
36 |
continue |
37 |
@@ -334,7 +334,7 @@ |
38 |
conf = re.sub (r'\._cfg\d+_', '', nconf) |
39 |
dir = re.match (r'^(.+)/', nconf).group (1) |
40 |
|
41 |
- if h.has_key (conf): |
42 |
+ if conf in h: |
43 |
mrgconf = re.sub(r'\._cfg', '._mrg', h[conf]['new']) |
44 |
if os.path.exists(mrgconf): |
45 |
os.unlink(mrgconf) |
46 |
|
47 |
Modified: main/trunk/bin/dohtml |
48 |
=================================================================== |
49 |
--- main/trunk/bin/dohtml 2008-07-01 12:50:41 UTC (rev 10873) |
50 |
+++ main/trunk/bin/dohtml 2008-07-01 12:53:07 UTC (rev 10874) |
51 |
@@ -86,11 +86,11 @@ |
52 |
self.D = "" |
53 |
self.DOCDESTTREE = "" |
54 |
|
55 |
- if os.environ.has_key("PF"): |
56 |
+ if "PF" in os.environ: |
57 |
self.PF = os.environ["PF"] |
58 |
- if os.environ.has_key("D"): |
59 |
+ if "D" in os.environ: |
60 |
self.D = os.environ["D"] |
61 |
- if os.environ.has_key("_E_DOCDESTTREE_"): |
62 |
+ if "_E_DOCDESTTREE_" in os.environ: |
63 |
self.DOCDESTTREE = os.environ["_E_DOCDESTTREE_"] |
64 |
|
65 |
self.allowed_exts = [ 'htm', 'html', 'css', 'js', |
66 |
|
67 |
Modified: main/trunk/bin/glsa-check |
68 |
=================================================================== |
69 |
--- main/trunk/bin/glsa-check 2008-07-01 12:50:41 UTC (rev 10873) |
70 |
+++ main/trunk/bin/glsa-check 2008-07-01 12:53:07 UTC (rev 10874) |
71 |
@@ -293,12 +293,12 @@ |
72 |
# color doesn't make any sense for mail |
73 |
nocolor() |
74 |
|
75 |
- if portage.settings.has_key("PORTAGE_ELOG_MAILURI"): |
76 |
+ if "PORTAGE_ELOG_MAILURI" in portage.settings: |
77 |
myrecipient = portage.settings["PORTAGE_ELOG_MAILURI"].split()[0] |
78 |
else: |
79 |
myrecipient = "root@localhost" |
80 |
|
81 |
- if portage.settings.has_key("PORTAGE_ELOG_MAILFROM"): |
82 |
+ if "PORTAGE_ELOG_MAILFROM" in portage.settings: |
83 |
myfrom = portage.settings["PORTAGE_ELOG_MAILFROM"] |
84 |
else: |
85 |
myfrom = "glsa-check" |
86 |
|
87 |
Modified: main/trunk/bin/repoman |
88 |
=================================================================== |
89 |
--- main/trunk/bin/repoman 2008-07-01 12:50:41 UTC (rev 10873) |
90 |
+++ main/trunk/bin/repoman 2008-07-01 12:53:07 UTC (rev 10874) |
91 |
@@ -662,7 +662,7 @@ |
92 |
if not os.path.isdir(portdir+"/profiles/"+arch[1]): |
93 |
print "Invalid "+arch[2]+" profile ("+arch[1]+") for arch "+arch[0] |
94 |
continue |
95 |
- if profiles.has_key(arch[0]): |
96 |
+ if arch[0] in profiles: |
97 |
profiles[arch[0]]+= [[arch[1], arch[2]]] |
98 |
else: |
99 |
profiles[arch[0]] = [[arch[1], arch[2]]] |
100 |
@@ -670,7 +670,7 @@ |
101 |
for x in repoman_settings.archlist(): |
102 |
if x[0] == "~": |
103 |
continue |
104 |
- if not profiles.has_key(x): |
105 |
+ if x not in profiles: |
106 |
print red("\""+x+"\" doesn't have a valid profile listed in profiles.desc.") |
107 |
print red("You need to either \"cvs update\" your profiles dir or follow this") |
108 |
print red("up with the "+x+" team.") |
109 |
@@ -1335,7 +1335,7 @@ |
110 |
|
111 |
# uselist checks - local |
112 |
mykey = portage.dep_getkey(catpkg) |
113 |
- if luselist.has_key(mykey): |
114 |
+ if mykey in luselist: |
115 |
for mypos in range(len(myuse)-1,-1,-1): |
116 |
if myuse[mypos] and (myuse[mypos] in luselist[mykey]): |
117 |
del myuse[mypos] |
118 |
@@ -1380,7 +1380,7 @@ |
119 |
if myskey not in kwlist: |
120 |
stats["KEYWORDS.invalid"] += 1 |
121 |
fails["KEYWORDS.invalid"].append(x+"/"+y+".ebuild: %s" % mykey) |
122 |
- elif not profiles.has_key(myskey): |
123 |
+ elif myskey not in profiles: |
124 |
stats["KEYWORDS.invalid"] += 1 |
125 |
fails["KEYWORDS.invalid"].append(x+"/"+y+".ebuild: %s (profile invalid)" % mykey) |
126 |
|
127 |
@@ -1420,7 +1420,7 @@ |
128 |
|
129 |
for keyword,arch,groups in arches: |
130 |
|
131 |
- if not profiles.has_key(arch): |
132 |
+ if arch not in profiles: |
133 |
# A missing profile will create an error further down |
134 |
# during the KEYWORDS verification. |
135 |
continue |
136 |
@@ -1833,7 +1833,7 @@ |
137 |
if "PORTAGE_GPG_KEY" not in repoman_settings: |
138 |
raise portage.exception.MissingParameter("PORTAGE_GPG_KEY is unset!") |
139 |
if "PORTAGE_GPG_DIR" not in repoman_settings: |
140 |
- if os.environ.has_key("HOME"): |
141 |
+ if "HOME" in os.environ: |
142 |
repoman_settings["PORTAGE_GPG_DIR"] = os.path.join(os.environ["HOME"], ".gnupg") |
143 |
logging.info("Automatically setting PORTAGE_GPG_DIR to %s" % repoman_settings["PORTAGE_GPG_DIR"]) |
144 |
else: |
145 |
@@ -1848,7 +1848,7 @@ |
146 |
repoman_settings["PORTAGE_GPG_DIR"]) |
147 |
gpgcmd = "gpg --sign --clearsign --yes " |
148 |
gpgcmd+= "--default-key "+repoman_settings["PORTAGE_GPG_KEY"] |
149 |
- if repoman_settings.has_key("PORTAGE_GPG_DIR"): |
150 |
+ if "PORTAGE_GPG_DIR" in repoman_settings: |
151 |
gpgcmd += " --homedir "+repoman_settings["PORTAGE_GPG_DIR"] |
152 |
if options.pretend: |
153 |
print "("+gpgcmd+" "+filename+")" |
154 |
|
155 |
-- |
156 |
gentoo-commits@l.g.o mailing list |