Skip to content

Commit cb8771e

Browse files
committed
make setup.py run with python 3, fix mentioned in issue #9
git-svn-id: https://python-poppler-qt4.googlecode.com/svn/trunk/python-poppler-qt4@49 83130c62-50b3-82d2-30ac-6e1d6613df04
1 parent dd3d405 commit cb8771e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ def pkg_config(package, attrs=None, include_only=False):
6767
except OSError:
6868
return attrs
6969
flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
70+
# for python3 turn bytes back to string
71+
if sys.version_info.major > 2:
72+
output = output.decode('utf-8')
7073
for flag in shlex.split(output):
7174
option, path = flag[:2], flag[2:]
7275
if option in flag_map:
@@ -80,6 +83,9 @@ def pkg_config_version(package):
8083
cmd = ['pkg-config', '--modversion', package]
8184
try:
8285
output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
86+
# for python3 turn bytes back to string
87+
if sys.version_info.major > 2:
88+
output = output.decode('utf-8')
8389
return tuple(map(int, re.findall(r'\d+', output)))
8490
except OSError:
8591
sys.stderr.write("Can't determine version of %s\n" % package)

0 commit comments

Comments
 (0)