File: fix-configparser-import

package info (click to toggle)
python-pkginfo 1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 416 kB
  • ctags: 354
  • sloc: python: 1,487; makefile: 76
file content (23 lines) | stat: -rw-r--r-- 822 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Description: Fix configparser import to work on python3
 This patch fixes the way the ConfigParser class is imported to work
 on both the python2.x stdlib and python3.x stdlib. 
Author: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Bug-Ubuntu: https://bugs.launchpad.net/pkginfo/+bug/1367434 
Forwarded: yes 
Last-Update: 2014-09-09

--- python-pkginfo-1.1.orig/pkginfo/commandline.py
+++ python-pkginfo-1.1/pkginfo/commandline.py
@@ -16,7 +16,11 @@ o a "develop" checkout:  in ths case,  '
 o an installed package:  in this case, 'path' should be the importable name
   of the package.
 """
-from ConfigParser import ConfigParser
+import sys
+if sys.version_info[0] == 3:
+    from configparser import ConfigParser
+else:
+    from ConfigParser import ConfigParser
 from csv import writer
 import optparse
 import os