[Yum-devel] [UG] [PATCH] handle non-integer sub-versions
Martin Pool
mbp at sourcefrog.net
Thu May 19 00:53:51 UTC 2005
Aaron identified this bug in urlgrabber, which is used (and much
appreciated) in bazaar-ng.
(Actually I think you may need to do hasattr(sys, 'version_info') to
handle 1.x pythons.)
Thanks
----- Forwarded message from Aaron Bentley <aaron.bentley at utoronto.ca> -----
From: Aaron Bentley <aaron.bentley at utoronto.ca>
Subject: [PATCH] handle non-integer sub-versions
Date: Wed, 18 May 2005 14:16:21 -0400
To: bazaar-ng at lists.canonical.com
User-Agent: Mozilla Thunderbird 0.6 (X11/20040530)
X-Spam-Status: No, score=-102.6 required=3.2 tests=AWL,BAYES_00,
USER_IN_WHITELIST autolearn=ham version=3.0.3
urlgrabber parses the Python version string, but doesn't handle all
possibilities correctly; it assumes all integers, and some python
installs will have something different. For my install, sys.version
reads: "2.3.4c1 (#4, Jul 20 2004, 08:57:39)
[GCC 2.95.4 20011002 (Debian prerelease)]"
The same info is available pre-parsed from sys.version_info. Here's a
patch that just does that:
*** modified file 'urlgrabber/keepalive.py'
--- urlgrabber/keepalive.py
+++ urlgrabber/keepalive.py
@@ -110,7 +110,7 @@
def DBPRINT(*args): print ' '.join(args)
import sys
-_python_version = map(int, sys.version.split()[0].split('.'))
+_python_version = sys.version_info
if _python_version < [2, 4]: HANDLE_ERRORS = 1
else: HANDLE_ERRORS = 0
If for some reason you really want to parse it yourself, you can do
_python_version = map(int, sys.version.split()[0].split('.')[:2])
Aaron
----- End forwarded message -----
--
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.baseurl.org/pipermail/yum-devel/attachments/20050519/9e5e2450/attachment.pgp
More information about the Yum-devel
mailing list