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 ""
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
f = open(spec)
for l in f:
- l = string.strip(l)
+ l = l.strip()
if l == "%changelog": break
# %bcond_with..
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