Skip to content

Commit 389636a

Browse files
committed
Fix build error with PyQt <= 3.14 [1851364] - MGD
svn path=/branches/v0_91_maint/; revision=5108
1 parent 03d4ae9 commit 389636a

File tree

2 files changed

+42
-34
lines changed

2 files changed

+42
-34
lines changed

CHANGELOG

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2008-05-02 On PyQt <= 3.14 there is no way to determine the underlying
2+
Qt version. [1851364] - MGD
3+
14
2008-05-02 Don't call sys.exit() when pyemf is not found [1924199] -
25
MGD
36

setupext.py

+39-34
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,20 @@
100100
numpy_inc_dirs = []
101101

102102
# matplotlib build options, which can be altered using setup.cfg
103-
options = {'display_status': True,
104-
'verbose': False,
105-
'provide_pytz': 'auto',
106-
'provide_dateutil': 'auto',
107-
'provide_configobj': 'auto',
108-
'provide_traits': 'auto',
109-
'build_agg': True,
110-
'build_gtk': 'auto',
111-
'build_gtkagg': 'auto',
112-
'build_tkagg': 'auto',
113-
'build_wxagg': 'auto',
114-
'build_image': True,
115-
'build_windowing': True,
116-
'backend': None,
103+
options = {'display_status': True,
104+
'verbose': False,
105+
'provide_pytz': 'auto',
106+
'provide_dateutil': 'auto',
107+
'provide_configobj': 'auto',
108+
'provide_traits': 'auto',
109+
'build_agg': True,
110+
'build_gtk': 'auto',
111+
'build_gtkagg': 'auto',
112+
'build_tkagg': 'auto',
113+
'build_wxagg': 'auto',
114+
'build_image': True,
115+
'build_windowing': True,
116+
'backend': None,
117117
'numerix': None}
118118

119119
# Based on the contents of setup.cfg, determine the build options
@@ -351,8 +351,13 @@ def check_for_qt():
351351
print_status("Qt", "no")
352352
return False
353353
else:
354+
try:
355+
qt_version = pyqtconfig.Configuration().qt_version
356+
qt_version = convert_qt_version(qt_version)
357+
except AttributeError:
358+
qt_version = "<unknown>"
354359
print_status("Qt", "Qt: %s, PyQt: %s" %
355-
(convert_qt_version(pyqtconfig.Configuration().qt_version),
360+
(qt_version,
356361
pyqtconfig.Configuration().pyqt_version_str))
357362
return True
358363

@@ -813,7 +818,7 @@ def check_for_tk():
813818
explanation = "Tcl/Tk v8.3 or later required"
814819
else:
815820
gotit = True
816-
821+
817822
if gotit:
818823
module = Extension('test', [])
819824
try:
@@ -830,7 +835,7 @@ def check_for_tk():
830835
else:
831836
explanation = message
832837
gotit = False
833-
838+
834839
if gotit:
835840
print_status("Tkinter", "Tkinter: %s, Tk: %s, Tcl: %s" %
836841
(Tkinter.__version__.split()[-2], Tkinter.TkVersion, Tkinter.TclVersion))
@@ -849,7 +854,7 @@ def query_tcltk():
849854
# Use cached values if they exist, which ensures this function only executes once
850855
if TCL_TK_CACHE is not None:
851856
return TCL_TK_CACHE
852-
857+
853858
# By this point, we already know that Tkinter imports correctly
854859
import Tkinter
855860
tcl_lib_dir = ''
@@ -875,14 +880,14 @@ def query_tcltk():
875880
tk.withdraw()
876881
tcl_lib_dir = str(tk.getvar('tcl_library'))
877882
tk_lib_dir = str(tk.getvar('tk_library'))
878-
883+
879884
# Save directories and version string to cache
880885
TCL_TK_CACHE = tcl_lib_dir, tk_lib_dir, str(Tkinter.TkVersion)[:3]
881886
return TCL_TK_CACHE
882887

883888
def add_tk_flags(module):
884889
'Add the module flags to build extensions which use tk'
885-
message = None
890+
message = None
886891
if sys.platform == 'win32':
887892
major, minor1, minor2, s, tmp = sys.version_info
888893
if major == 2 and minor1 in [3, 4, 5]:
@@ -894,19 +899,19 @@ def add_tk_flags(module):
894899
else:
895900
raise RuntimeError('No tk/win32 support for this python version yet')
896901
module.library_dirs.extend([os.path.join(sys.prefix, 'dlls')])
897-
902+
898903
elif sys.platform == 'darwin':
899904
# this config section lifted directly from Imaging - thanks to
900905
# the effbot!
901-
906+
902907
# First test for a MacOSX/darwin framework install
903908
from os.path import join, exists
904909
framework_dirs = [
905910
join(os.getenv('HOME'), '/Library/Frameworks'),
906911
'/Library/Frameworks',
907912
'/System/Library/Frameworks/',
908913
]
909-
914+
910915
# Find the directory that contains the Tcl.framework and Tk.framework
911916
# bundles.
912917
# XXX distutils should support -F!
@@ -931,7 +936,7 @@ def add_tk_flags(module):
931936
for fw in 'Tcl', 'Tk'
932937
for H in 'Headers', 'Versions/Current/PrivateHeaders'
933938
]
934-
939+
935940
# For 8.4a2, the X11 headers are not included. Rather than include a
936941
# complicated search, this is a hard-coded path. It could bail out
937942
# if X11 libs are not found...
@@ -940,31 +945,31 @@ def add_tk_flags(module):
940945
module.include_dirs.extend(tk_include_dirs)
941946
module.extra_link_args.extend(frameworks)
942947
module.extra_compile_args.extend(frameworks)
943-
948+
944949
# you're still here? ok we'll try it this way...
945950
else:
946951
# Query Tcl/Tk system for library paths and version string
947952
tcl_lib_dir, tk_lib_dir, tk_ver = query_tcltk() # todo: try/except
948-
953+
949954
# Process base directories to obtain include + lib dirs
950-
if tcl_lib_dir != '' and tk_lib_dir != '':
955+
if tcl_lib_dir != '' and tk_lib_dir != '':
951956
tcl_lib = os.path.normpath(os.path.join(tcl_lib_dir, '../'))
952957
tk_lib = os.path.normpath(os.path.join(tk_lib_dir, '../'))
953-
tcl_inc = os.path.normpath(os.path.join(tcl_lib_dir,
958+
tcl_inc = os.path.normpath(os.path.join(tcl_lib_dir,
954959
'../../include/tcl' + tk_ver))
955960
if not os.path.exists(tcl_inc):
956-
tcl_inc = os.path.normpath(os.path.join(tcl_lib_dir,
961+
tcl_inc = os.path.normpath(os.path.join(tcl_lib_dir,
957962
'../../include'))
958-
tk_inc = os.path.normpath(os.path.join(tk_lib_dir,
963+
tk_inc = os.path.normpath(os.path.join(tk_lib_dir,
959964
'../../include/tk' + tk_ver))
960965
if not os.path.exists(tk_inc):
961-
tk_inc = os.path.normpath(os.path.join(tk_lib_dir,
966+
tk_inc = os.path.normpath(os.path.join(tk_lib_dir,
962967
'../../include'))
963-
968+
964969
if ((not os.path.exists(os.path.join(tk_inc,'tk.h'))) and
965970
os.path.exists(os.path.join(tcl_inc,'tk.h'))):
966971
tk_inc = tcl_inc
967-
972+
968973
if not os.path.exists(tcl_inc):
969974
# this is a hack for suse linux, which is broken
970975
if (sys.platform.startswith('linux') and
@@ -986,7 +991,7 @@ def add_tk_flags(module):
986991
module.include_dirs.extend([tcl_inc, tk_inc])
987992
module.library_dirs.extend([tcl_lib, tk_lib])
988993
module.libraries.extend(['tk' + tk_ver, 'tcl' + tk_ver])
989-
994+
990995
return message
991996

992997
def add_windowing_flags(module):

0 commit comments

Comments
 (0)