Bug#598432: python-apt: upgrade fails
I also faced the same problem as Cameron after modifying
/usr/share/pycentral-data/pyversions.py to allow single digit version
numbers with this patch:
--- /usr/share/pycentral-data/pyversions.py.orig 2010-09-29 12:10:27.000000000 +0200
+++ /usr/share/pycentral-data/pyversions.py 2010-09-29 12:11:04.000000000 +0200
@@ -54,7 +54,7 @@
vinfo['current'] = field
continue
vinfo.setdefault('versions', set())
- ve = re.compile('(>=|<=|<<|=)? *(\d\.\d)$')
+ ve = re.compile('(>=|<=|<<|=)? *(\d(?:\.\d)?)$')
m = ve.match(field)
try:
op, v = m.group(1), m.group(2)
The following errors alle seem to be caused by "print" being changed
from statement to function in python3:
http://docs.python.org/release/3.0.1/whatsnew/3.0.html#print-is-a-function
Setting up python-apt (0.7.98) ...
Compiling /usr/lib/python3/dist-packages/apt/debfile.py ...
SyntaxError: ('invalid syntax', ('/usr/lib/python3/dist-packages/apt/debfile.py', 575, 28, ' print(msg, file=sys.stderr)\n'))
Compiling /usr/lib/python3/dist-packages/apt/progress/gtk2.py ...
SyntaxError: ('invalid syntax', ('/usr/lib/python3/dist-packages/apt/progress/gtk2.py', 510, 47, ' print("Exception happened:", exc, file=sys.stderr)\n'))
Compiling /usr/lib/python3/dist-packages/apt/progress/old.py ...
SyntaxError: ('invalid syntax', ('/usr/lib/python3/dist-packages/apt/progress/old.py', 158, 32, ' print("\\r%s" % (s), end=\' \')\n'))
pycentral: pycentral pkginstall: error byte-compiling files (17)
pycentral pkginstall: error byte-compiling files (17)
I have no idea how this should be handled to actually support both
python 2.x and python 3.x, but this patch does at least let me install
python-apt (0.7.98) without errors (but do note that it removes the
progress indicator in old.py):
--- /usr/lib/python3/dist-packages/apt/debfile.py.orig 2010-09-28 16:56:50.000000000 +0200
+++ /usr/lib/python3/dist-packages/apt/debfile.py 2010-09-29 12:16:14.000000000 +0200
@@ -572,7 +572,7 @@
def _dbg(self, level, msg):
"""Write debugging output to sys.stderr."""
if level <= self.debug:
- print(msg, file=sys.stderr)
+ sys.stderr.write(msg)
def install(self, install_progress=None):
"""Install the package."""
--- /usr/lib/python3/dist-packages/apt/progress/gtk2.py.orig 2010-09-28 16:56:52.000000000 +0200
+++ /usr/lib/python3/dist-packages/apt/progress/gtk2.py 2010-09-29 12:16:51.000000000 +0200
@@ -507,7 +507,7 @@
try:
cache.commit(apt_progress.acquire, apt_progress.install)
except Exception as exc:
- print("Exception happened:", exc, file=sys.stderr)
+ sys.stderr.write("Exception happened:", exc)
if len(sys.argv) > 1:
deb = DebPackage(sys.argv[1], cache)
deb.install(apt_progress.dpkg_install)
--- /usr/lib/python3/dist-packages/apt/progress/old.py.orig 2010-09-28 16:56:51.000000000 +0200
+++ /usr/lib/python3/dist-packages/apt/progress/old.py 2010-09-29 12:27:39.000000000 +0200
@@ -153,9 +153,10 @@
s = "[%2.f%%] %sB/s %s" % (self.percent,
apt_pkg.size_to_str(int(self.currentCPS)),
apt_pkg.time_to_str(int(self.eta)))
- else:
- s = "%2.f%% [Working]" % (self.percent)
- print("\r%s" % (s), end=' ')
+
+# else:
+# s = "%2.f%% [Working]" % (self.percent)
+# print("\r%s" % (s), end=' ')
sys.stdout.flush()
return True
Bjørn ("I have not python clue whatsoever, and I intend to continue like that")
Reply to: