]> TLD Linux GIT Repositories - tld-builder.git/blobdiff - TLD_Builder/get_br.py
- python 3.x fixes
[tld-builder.git] / TLD_Builder / get_br.py
index 933548c172d60c81a6c5034172fefcef0fd9f58b..867e233af1cf1383447bd7256139ca0a18e61df2 100644 (file)
@@ -13,10 +13,10 @@ def get_build_requires(spec, bconds_with, bconds_without):
     def expand_conds(l):
         def expand_one(m):
             if m.group(1) == "?":
-                if macros.has_key(m.group(2)):
+                if m.group(2) in macros:
                     return m.group(3)
             else:
-                if not macros.has_key(m.group(2)):
+                if not m.group(2) in macros:
                     return m.group(3)
             return ""
 
@@ -29,8 +29,8 @@ def get_build_requires(spec, bconds_with, bconds_without):
     macro_rx = re.compile(r"%\{([a-zA-Z0-9_+]+)\}")
     def expand_macros(l):
         def expand_one(m):
-            if macros.has_key(m.group(1)):
-                return string.strip(macros[m.group(1)])
+            if m.group(1) in macros:
+                return macros[m.group(1)].strip()
             else:
                 return m.group(0) # don't change
 
@@ -63,7 +63,7 @@ def get_build_requires(spec, bconds_with, bconds_without):
 
     f = open(spec)
     for l in f:
-        l = string.strip(l)
+        l = l.strip()
         if l == "%changelog": break
 
         # %bcond_with..
@@ -71,10 +71,10 @@ def get_build_requires(spec, bconds_with, bconds_without):
         if m:
             bcond = m.group(2)
             if m.group(1) == "with":
-                if macros.has_key("_with_%s" % bcond):
+                if "_with_%s" % bcond in macros:
                     macros["with_%s" % bcond] = 1
             else:
-                if not macros.has_key("_without_%s" % bcond):
+                if not "_without_%s" % bcond in macros:
                     macros["with_%s" % bcond] = 1
             continue