Changeset: 4a798db904a7 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4a798db904a7 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: Feb2013 Log Message:
Merged from Oct2012 diffs (truncated from 1424 to 300 lines): diff --git a/buildtools/autogen/autogen.py b/buildtools/autogen/autogen.py --- a/buildtools/autogen/autogen.py +++ b/buildtools/autogen/autogen.py @@ -92,7 +92,7 @@ def read_makefile(p, cwd): lineno = 0 for line in fileinput.input(os.path.join(cwd, 'Makefile.ag')): if line.lstrip()[0:1] != "#": - for token in string.split(line): + for token in line.split(): p.parse(token, lineno, line) p.parse("\n", lineno, line) lineno = lineno + 1 @@ -109,19 +109,19 @@ def expand_subdirs(subdirs): res = [] for subdir in subdirs: if "?" in subdir: - parts = string.split(subdir, "?") + parts = subdir.split("?") if len(parts) == 2: - dirs = string.split(parts[1], ":") + dirs = parts[1].split(":") if len(dirs) > 2: - print "!ERROR:syntax error in conditional subdir:", subdir + print("!ERROR:syntax error in conditional subdir: " + subdir) else: cond = parts[0] for d in dirs: - if string.strip(d) != "": + if d.strip() != "": res.append((d, cond)) cond = "!" + cond else: - print "!ERROR:syntax error in conditional subdir:", subdir + print("!ERROR:syntax error in conditional subdir: " + subdir) else: res.append((subdir, None)) return res @@ -172,18 +172,7 @@ def filter(st): return st + '\n' return '' -def dirlen(l, r): - if string.count(l, os.sep) < string.count(r, os.sep): - return -1 - elif string.count(l, os.sep) > string.count(r, os.sep): - return 1 - elif l < r: - return -1 - elif l > r: - return 1 - return 0 - -OutList.sort(dirlen) +OutList.sort(key=lambda x: x.count(os.sep)) OutList = map(filter, OutList) OutListFd = open("acout.in", "w") OutListFd.writelines(OutList) 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 @@ -17,6 +17,8 @@ import os import posixpath +import sys +sys.path.insert(0, os.path.dirname(os.path.realpath(__file__))) from codegen import find_org import re @@ -74,7 +76,7 @@ def am_sort_libs(libs, tree): # does lib depend on another library if tree.has_key('lib_'+ lib): v = tree['lib_'+lib] - if v.has_key("LIBS"): + if "LIBS" in v: for l in v['LIBS']: if len(l) > 3: l = l[3:] # strip lib prefix @@ -84,7 +86,7 @@ def am_sort_libs(libs, tree): after = pos elif tree.has_key('LIBS'): v = tree['LIBS'] - if v.has_key(lib[1:] + "_DLIBS"): + if lib[1:] + "_DLIBS" in v: for l in v[lib[1:] + '_DLIBS']: if len(l) > 3: l = l[3:] # strip lib prefix @@ -157,14 +159,14 @@ def am_find_srcs(target, deps, am, cond) base, ext = split_filename(target) f = target pf = f - while ext != "h" and deps.has_key(f): + while ext != "h" and f in deps: f = deps[f][0] b, ext = split_filename(f) if ext in automake_ext: pf = f # built source if has dep and ext != cur ext - if not(cond) and deps.has_key(pf) and pf not in am['BUILT_SOURCES']: + if not(cond) and pf in deps and pf not in am['BUILT_SOURCES']: pfb, pfext = split_filename(pf) sfb, sfext = split_filename(deps[pf][0]) if sfext != pfext: @@ -178,7 +180,7 @@ def am_find_srcs(target, deps, am, cond) return dist, "" def am_find_hdrs_r(am, target, deps, hdrs, hdrs_ext, map): - if deps.has_key(target): + if target in deps: tdeps = deps[target] for dtarget in tdeps: t, ext = split_filename(dtarget) @@ -189,7 +191,7 @@ def am_find_hdrs_r(am, target, deps, hdr am_find_hdrs_r(am, dtarget, deps, hdrs, hdrs_ext, map) def am_find_hdrs(am, map): - if map.has_key('HEADERS'): + if 'HEADERS' in map: hdrs_ext = map['HEADERS'] for target in map['TARGETS']: t, ext = split_filename(target) @@ -312,11 +314,11 @@ def am_scripts(fd, var, scripts, am): s, ext = var.split('_', 1) ext = [ ext ] - if scripts.has_key("EXT"): + if "EXT" in scripts: ext = scripts["EXT"] # list of extentions sd = "bindir" - if scripts.has_key("DIR"): + if "DIR" in scripts: sd = scripts["DIR"][0] # use first name given sd = am_translate_dir(sd, am) @@ -331,7 +333,7 @@ def am_scripts(fd, var, scripts, am): cond = '' s = script scriptname = "script_" + script - if scripts.has_key('COND'): + if 'COND' in scripts: condname = '+'.join(scripts['COND']) mkname = am_normalize(script.replace('.', '_')) cond = '#' + condname @@ -376,7 +378,7 @@ def am_scripts(fd, var, scripts, am): fd.write("uninstall-local-%s: \n" % script) fd.write("\t$(RM) $(DESTDIR)%s/%s\n\n" % (sd, script)) - if not scripts.has_key('NOINST'): + if 'NOINST' not in scripts: am['INSTALL'].append(s) am['UNINSTALL'].append(s) am['InstallList'].append("\t"+sd+"/"+script+cond+"\n") @@ -398,7 +400,7 @@ def uniq(l): def am_headers(fd, var, headers, am): sd = "includedir" - if headers.has_key("DIR"): + if "DIR" in headers: sd = headers["DIR"][0] # use first name given sd = am_translate_dir(sd, am) @@ -415,7 +417,7 @@ def am_headers(fd, var, headers, am): continue cond = '' h = header - if headers.has_key('COND'): + if 'COND' in headers: cond = '#' + '+'.join(headers['COND']) mkname = am_normalize(header.replace('.', '_')) for condname in headers['COND']: @@ -496,25 +498,25 @@ def am_binary(fd, var, binmap, am): SCRIPTS = [] scripts_ext = [] - if binmap.has_key('SCRIPTS'): + if 'SCRIPTS' in binmap: scripts_ext = binmap['SCRIPTS'] name = var[4:] - if binmap.has_key("NAME"): + if "NAME" in binmap: binname = binmap['NAME'][0] else: binname = name norm_binname = am_normalize(binname) bd = 'bindir' - if binmap.has_key("DIR"): + if "DIR" in binmap: bd = binmap["DIR"][0] # use first name given bd = am_translate_dir(bd, am) fd.write("%sdir = %s\n" % (norm_binname, bd)) cname = name cond = '' - if binmap.has_key('COND'): + if 'COND' in binmap: for condname in binmap['COND']: fd.write("if %s\n" % condname) cond = '#' + '+'.join(binmap['COND']) @@ -523,7 +525,7 @@ def am_binary(fd, var, binmap, am): for condname in binmap['COND']: fd.write("endif\n") cname = "$(C_" + name + ")" - elif binmap.has_key('CONDINST'): + elif 'CONDINST' in binmap: for condname in binmap['CONDINST']: fd.write("if %s\n" % condname) cond = '#' + '+'.join(binmap['CONDINST']) @@ -543,25 +545,25 @@ def am_binary(fd, var, binmap, am): cname = "$(C_noinst_" + name + ")" am['NBINS'].append(cname) cname = '' - elif binmap.has_key('NOINST'): + elif 'NOINST' in binmap: am['NBINS'].append(binname) else: am['BINS'].append(binname) am['InstallList'].append("\t%s/%s%s\n" % (bd, binname, cond)) - if binmap.has_key('MTSAFE'): + if 'MTSAFE' in binmap: fd.write("CFLAGS %s $(THREAD_SAVE_FLAGS)\n" % am_assign) - if binmap.has_key("LIBS"): + if "LIBS" in binmap: fd.write(am_additional_libs(norm_binname, "", "BIN", binmap["LIBS"], am)) - if binmap.has_key("LDFLAGS"): + if "LDFLAGS" in binmap: ldflags = binmap["LDFLAGS"][:] else: ldflags = [] ldflags.append('-export-dynamic') - if binmap.has_key('NOINST'): + if 'NOINST' in binmap: ldflags.append('-no-install') fd.write(am_additional_flags(norm_binname, "", "BIN", ldflags, am)) @@ -602,20 +604,20 @@ def am_bins(fd, var, binsmap, am): lbins = [] scripts_ext = [] - if binsmap.has_key('SCRIPTS'): + if 'SCRIPTS' in binsmap: scripts_ext = binsmap['SCRIPTS'] name = "" - if binsmap.has_key("NAME"): + if "NAME" in binsmap: name = binsmap["NAME"][0] # use first name given - if binsmap.has_key('MTSAFE'): + if 'MTSAFE' in binsmap: fd.write("CFLAGS %s $(THREAD_SAVE_FLAGS)\n" % am_assign) for binsrc in binsmap['SOURCES']: SCRIPTS = [] bin, ext = split_filename(binsrc) am['EXTRA_DIST'].append(binsrc) - if binsmap.has_key('CONDINST'): + if 'CONDINST' in binsmap: for condname in binsmap['CONDINST']: fd.write("if %s\n" % condname) cond = '#' + '+'.join(binsmap['CONDINST']) @@ -636,24 +638,24 @@ def am_bins(fd, var, binsmap, am): cname = "$(C_noinst_" + bin + ")" am['NBINS'].append(cname) cname = '' - elif binsmap.has_key('NOINST'): + elif 'NOINST' in binsmap: am['NBINS'].append(bin) else: am['BINS'].append(bin) - if binsmap.has_key("DIR"): + if "DIR" in binsmap: lbins.append(bin) - if binsmap.has_key(bin + "_LIBS"): + if bin + "_LIBS" in binsmap: fd.write(am_additional_libs(bin, "", "BIN", binsmap[bin + "_LIBS"], am)) - elif binsmap.has_key("LIBS"): + elif "LIBS" in binsmap: fd.write(am_additional_libs(bin, "", "BIN", binsmap["LIBS"], am)) - if binsmap.has_key("LDFLAGS"): + if "LDFLAGS" in binsmap: ldflags = binsmap["LDFLAGS"][:] else: ldflags = [] ldflags.append('-export-dynamic') - if binsmap.has_key('NOINST'): + if 'NOINST' in binsmap: ldflags.append('-no-install') fd.write(am_additional_flags(bin, "", "BIN", ldflags, am)) @@ -691,7 +693,7 @@ def am_bins(fd, var, binsmap, am): for bn in lbins: _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list