Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f9cef5d

Browse files
committed
fixed qt version reporting in setupext.py
svn path=/trunk/matplotlib/; revision=3782
1 parent 63224f2 commit f9cef5d

2 files changed

Lines changed: 23 additions & 13 deletions

File tree

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2007-09-05 Fixed Qt version reporting in setupext.py - DSD
2+
13
2007-09-04 Embedding Type 1 fonts in PDF, and thus usetex support
24
via dviread, sort of works. To test, enable it by
35
renaming _draw_tex to draw_tex. - JKS

setupext.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,14 @@ def getoutput(s):
278278
ret = os.popen(s).read().strip()
279279
return ret
280280

281+
def convert_qt_version(version):
282+
version = '%x'%version
283+
temp = []
284+
while len(version) > 0:
285+
version, chunk = version[:-2], version[-2:]
286+
temp.insert(0, str(int(chunk, 16)))
287+
return '.'.join(temp)
288+
281289
def check_for_qt():
282290
try:
283291
import pyqtconfig
@@ -286,20 +294,20 @@ def check_for_qt():
286294
return False
287295
else:
288296
print_status("Qt", "Qt: %s, pyqt: %s" %
289-
(pyqtconfig.Configuration().pyqt_version_str,
290-
pyqtconfig.Configuration().qt_version))
297+
(convert_qt_version(pyqtconfig.Configuration().qt_version),
298+
pyqtconfig.Configuration().pyqt_version_str))
291299
return True
292300

293301
def check_for_qt4():
294302
try:
295-
import PyQt4.pyqtconfig
303+
from PyQt4 import pyqtconfig
296304
except ImportError:
297305
print_status("Qt4", "no")
298306
return False
299307
else:
300308
print_status("Qt4", "Qt: %s, pyqt: %s" %
301-
(PyQt4.pyqtconfig.Configuration().pyqt_version_str,
302-
PyQt4.pyqtconfig.Configuration().qt_version))
309+
(convert_qt_version(pyqtconfig.Configuration().qt_version),
310+
pyqtconfig.Configuration().pyqt_version_str))
303311
return True
304312

305313
def check_for_cairo():
@@ -455,14 +463,14 @@ def add_pygtk_flags(module):
455463
if not os.environ.has_key('PKG_CONFIG_PATH'):
456464
# If Gtk+ is installed, pkg-config is required to be installed
457465
os.environ['PKG_CONFIG_PATH'] = 'C:\GTK\lib\pkgconfig'
458-
459-
pygtkIncludes = getoutput('pkg-config --cflags-only-I pygtk-2.0').split()
460-
gtkIncludes = getoutput('pkg-config --cflags-only-I gtk+-2.0').split()
461-
includes = pygtkIncludes + gtkIncludes
462-
module.include_dirs.extend([include[2:] for include in includes])
463-
464-
pygtkLinker = getoutput('pkg-config --libs pygtk-2.0').split()
465-
gtkLinker = getoutput('pkg-config --libs gtk+-2.0').split()
466+
467+
pygtkIncludes = getoutput('pkg-config --cflags-only-I pygtk-2.0').split()
468+
gtkIncludes = getoutput('pkg-config --cflags-only-I gtk+-2.0').split()
469+
includes = pygtkIncludes + gtkIncludes
470+
module.include_dirs.extend([include[2:] for include in includes])
471+
472+
pygtkLinker = getoutput('pkg-config --libs pygtk-2.0').split()
473+
gtkLinker = getoutput('pkg-config --libs gtk+-2.0').split()
466474
linkerFlags = pygtkLinker + gtkLinker
467475

468476
module.libraries.extend(

0 commit comments

Comments
 (0)