On 5/21/2010 1:14 AM, Greg Stein wrote: > On Fri, May 21, 2010 at 00:23, Philip M. Gollucci > <[email protected]> wrote: >> Howdy, >> >> So >> http://docs.python.org/release/3.0.1/whatsnew/3.0.html#porting-to-python-3-0 >> >> specifically says not to try to >> if 2.x >> stuff >> else 3.x >> other stuff >> fi So I'm guessing they know what they are talking about. After making the import change suggested by gstien, I predictably get the error below b/c of the List API changes.
http://docs.python.org/release/3.0.1/whatsnew/3.0.html#views-and-iterators-instead-of-lists There are several more of these here as well. To me my earlier thought of keeping 2 copies makes more sense. Thoughts? See current patch attached thus far. $./buildconf buildconf: checking installation... buildconf: python version 3.1.2 (ok) buildconf: autoconf version 2.62 (ok) buildconf: libtool version 2.2.6b (ok) buildconf: copying libtool helper files using /usr/local/bin/libtoolize buildconf: creating include/arch/unix/apr_private.h.in ... buildconf: creating configure ... buildconf: generating 'make' outputs ... Traceback (most recent call last): File "build/gen-build.py", line 251, in <module> main() File "build/gen-build.py", line 67, in main objects, dirs = write_objects(f, legal_deps, h_deps, files) File "build/gen-build.py", line 205, in write_objects f.write('%s: %s .make.dirs %s\n' % (obj, file, string.join(vals))) AttributeError: 'module' object has no attribute 'join' buildconf: rebuilding rpm spec file -- ------------------------------------------------------------------------ 1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70 3F8C 75B8 8FFB DB9B 8C1C Philip M. Gollucci ([email protected]) c: 703.336.9354 VP Apache Infrastructure; Member, Apache Software Foundation Committer, FreeBSD Foundation Consultant, P6M7G8 Inc. Sr. System Admin, Ridecharge Inc. Work like you don't need the money, love like you'll never get hurt, and dance like nobody's watching.
Index: build/buildcheck.sh
===================================================================
--- build/buildcheck.sh (revision 947805)
+++ build/buildcheck.sh (working copy)
@@ -10,7 +10,7 @@
echo " to build APR from SVN."
exit 1
else
-py_version=`python -c 'import sys; print sys.version' 2>&1|sed 's/ .*//;q'`
+py_version=`python -c 'import sys; print(sys.version)' 2>&1|sed 's/ .*//;q'`
echo "buildconf: python version $py_version (ok)"
fi
Index: build/gen-build.py
===================================================================
--- build/gen-build.py (revision 947805)
+++ build/gen-build.py (working copy)
@@ -10,14 +10,17 @@
import os
-import ConfigParser
import getopt
import string
import glob
import re
-
#import ezt
+try:
+ from ConfigParser import ConfigParser
+except ImportError:
+ from configparser import ConfigParser
+
#
# legal platforms: aix, beos, netware, os2, os390, unix, win32
# 'make' users: aix, beos, os2, os390, unix, win32 (mingw)
@@ -36,7 +39,7 @@
def main():
- parser = ConfigParser.ConfigParser()
+ parser = ConfigParser()
parser.read('build.conf')
if parser.has_option('options', 'dsp'):
@@ -45,7 +48,7 @@
dsp_file = None
headers = get_files(parser.get('options', 'headers'))
-
+
# compute the relevant headers, along with the implied includes
legal_deps = { }
for fname in headers:
@@ -86,7 +89,7 @@
inherit_files[-1] = inherit_files[-1][:-2] + '.lo'
# replace the \\'s with /'s
inherit_line = '/'.join(inherit_files)
- if not inherit_parent.has_key(inherit_files[0]):
+ if inherit_files[0] not in inherit_parent:
inherit_parent[inherit_files[0]] = []
inherit_parent[inherit_files[0]].append(inherit_line)
@@ -106,7 +109,7 @@
files = get_files(path + '/*.c')
objects, _unused = write_objects(f, legal_deps, h_deps, files)
- if inherit_parent.has_key(subdir):
+ if subdir in inherit_parent:
objects = objects + inherit_parent[subdir]
symname = 'OBJECTS_%s_%s' % (subdir, platform)
@@ -125,7 +128,7 @@
f.write('OBJECTS_%s = %s\n\n' % (platform, string.join(group)))
f.write('HEADERS = $(top_srcdir)/%s\n\n' % string.join(headers, '
$(top_srcdir)/'))
- f.write('SOURCE_DIRS = %s $(EXTRA_SOURCE_DIRS)\n\n' %
string.join(dirs.keys()))
+ f.write('SOURCE_DIRS = %s $(EXTRA_SOURCE_DIRS)\n\n' %
string.join(list(dirs.keys())))
if parser.has_option('options', 'modules'):
modules = parser.get('options', 'modules')
@@ -163,14 +166,14 @@
# Build a list of all necessary directories in build tree
alldirs = { }
- for dir in dirs.keys():
+ for dir in list(dirs.keys()):
d = dir
while d:
alldirs[d] = None
d = os.path.dirname(d)
# Sort so 'foo' is before 'foo/bar'
- keys = alldirs.keys()
+ keys = list(alldirs.keys())
keys.sort()
f.write('BUILD_DIRS = %s\n\n' % string.join(keys))
@@ -194,10 +197,10 @@
# what headers does this file include, along with the implied headers
deps = extract_deps(file, legal_deps)
- for hdr in deps.keys():
+ for hdr in list(deps.keys()):
deps.update(h_deps.get(hdr, {}))
- vals = deps.values()
+ vals = list(deps.values())
vals.sort()
f.write('%s: %s .make.dirs %s\n' % (obj, file, string.join(vals)))
@@ -213,7 +216,7 @@
if line[:8] != '#include':
continue
inc = _re_include.match(line).group(1)
- if inc in legal_deps.keys():
+ if inc in list(legal_deps.keys()):
deps[inc] = legal_deps[inc]
return deps
_re_include = re.compile('#include *["<](.*)[">]')
@@ -224,10 +227,10 @@
altered = 1
while altered:
altered = 0
- for hdr, deps in header_deps.items():
+ for hdr, deps in list(header_deps.items()):
# print hdr, deps
start = len(deps)
- for dep in deps.keys():
+ for dep in list(deps.keys()):
deps.update(header_deps.get(dep, {}))
if len(deps) != start:
altered = 1
@@ -237,8 +240,9 @@
def get_files(patterns):
files = [ ]
- for pat in string.split(patterns):
- files.extend(map(clean_path, glob.glob(pat)))
+# for pat in string.split(patterns):
+ for pat in patterns.split():
+ files.extend(list(map(clean_path, glob.glob(pat))))
files.sort()
return files
signature.asc
Description: OpenPGP digital signature
