Changeset: 47ce7cf48448 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=47ce7cf48448 Modified Files: buildtools/autogen/autogen.py buildtools/autogen/autogen/am.py buildtools/autogen/autogen/codegen.py buildtools/autogen/autogen/msc.py buildtools/autogen/autogen/var.py Branch: Oct2012 Log Message:
has_key is gone, use __contains__ for Python3 compatibility. Also fixes a bug in the creation of the Windows makefiles. diffs (110 lines): diff --git a/buildtools/autogen/autogen.py b/buildtools/autogen/autogen.py --- a/buildtools/autogen/autogen.py +++ b/buildtools/autogen/autogen.py @@ -77,7 +77,7 @@ class parser: elif self.state == "=" and isName(token): if token == '""': token = "" - if self.top.has_key(token): + if token in self.top: for i in self.top[token]: self.curvar.append(i) else: @@ -133,7 +133,7 @@ def main(cwd, topdir, automake, incdirsm codegen(p.curvar, cwd, topdir, incdirsmap) (InstallList, DocList, OutList) = am.output(p.curvar, cwd, topdir, automake, conditional) msc.output(p.curvar, cwd, topdir) - if p.curvar.has_key('SUBDIRS'): + if 'SUBDIRS' in p.curvar: for (dir, cond) in expand_subdirs(p.curvar['SUBDIRS']): d = os.path.join(cwd, dir) if os.path.exists(d): diff --git a/buildtools/autogen/autogen/am.py b/buildtools/autogen/autogen/am.py --- a/buildtools/autogen/autogen/am.py +++ b/buildtools/autogen/autogen/am.py @@ -74,7 +74,7 @@ def am_sort_libs(libs, tree): for (pref,lib,sep,cond) in libs: after = -1 # does lib depend on another library - if tree.has_key('lib_'+ lib): + if 'lib_'+ lib in tree: v = tree['lib_'+lib] if "LIBS" in v: for l in v['LIBS']: @@ -84,7 +84,7 @@ def am_sort_libs(libs, tree): pos = res.index(l) if pos > after: after = pos - elif tree.has_key('LIBS'): + elif 'LIBS' in tree: v = tree['LIBS'] if lib[1:] + "_DLIBS" in v: for l in v[lib[1:] + '_DLIBS']: @@ -1181,11 +1181,11 @@ AUTOMAKE_OPTIONS = no-dependencies 1.4 f if cwd == topdir: fd.write('ACLOCAL_AMFLAGS = -I buildtools/conf\n') - if not tree.has_key('INCLUDES'): + if 'INCLUDES' not in tree: tree.add('INCLUDES', []) am = {} - if tree.has_key('NAME'): + if 'NAME' in tree: am['NAME'] = tree['NAME'] else: if cwd != topdir: diff --git a/buildtools/autogen/autogen/codegen.py b/buildtools/autogen/autogen/codegen.py --- a/buildtools/autogen/autogen/codegen.py +++ b/buildtools/autogen/autogen/codegen.py @@ -454,7 +454,7 @@ def collect_includes(incdirs, cwd, topdi def codegen(tree, cwd, topdir, incdirsmap): includes = {} incmap = {} - if tree.has_key("INCLUDES"): + if 'INCLUDES' in tree: includes,incmap = collect_includes(tree["INCLUDES"],cwd, topdir) deps = {} diff --git a/buildtools/autogen/autogen/msc.py b/buildtools/autogen/autogen/msc.py --- a/buildtools/autogen/autogen/msc.py +++ b/buildtools/autogen/autogen/msc.py @@ -1124,7 +1124,7 @@ def output(tree, cwd, topdir): fd.write(MAKEFILE_HEAD) - if tree.has_key('INCLUDES'): + if 'INCLUDES' not in tree: tree.add('INCLUDES', []) msc = {} @@ -1156,7 +1156,7 @@ def output(tree, cwd, topdir): fd.write("TOPDIR = %s\n" % reldir.replace('/', '\\')) fd.write("srcdir = $(TOPDIR)\\..%s\n" % srcdir.replace('/', '\\')) fd.write("!INCLUDE $(TOPDIR)\\..\\NT\\rules.msc\n") - if tree.has_key("SUBDIRS"): + if 'SUBDIRS' in tree: fd.write("all: build-all\n") fd.write("check: check-recursive check-msc\n") fd.write("install: install-recursive install-msc\n") @@ -1197,7 +1197,7 @@ def output(tree, cwd, topdir): fd.write(" %s" % v) fd.write("\n") - if tree.has_key('SUBDIRS'): + if 'SUBDIRS' in tree: fd.write('build-all: $(BUILT_SOURCES) all-recursive all-msc\n') ## fd.write("EXTRA_DIST = Makefile.ag Makefile.msc") diff --git a/buildtools/autogen/autogen/var.py b/buildtools/autogen/autogen/var.py --- a/buildtools/autogen/autogen/var.py +++ b/buildtools/autogen/autogen/var.py @@ -44,7 +44,7 @@ class groupvar(var): def items(self): return self._values.items() - def has_key(self,key): + def __contains__(self,key): return key in self._values def __getitem__(self,key): _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list