@@ -135,23 +135,25 @@ def __call__(self, target, source, env):
135
135
out_sources = source [:]
136
136
137
137
for obj in source :
138
- if isinstance (obj ,basestring ): # big kludge!
139
- print "scons: qt5: '%s' MAYBE USING AN OLD SCONS VERSION AND NOT CONVERTED TO 'File'. Discarded." % str (obj )
138
+ if isinstance (obj ,str ): # big kludge!
139
+ print ( "scons: qt5: '%s' MAYBE USING AN OLD SCONS VERSION AND NOT CONVERTED TO 'File'. Discarded." % str (obj ) )
140
140
continue
141
141
if not obj .has_builder ():
142
142
# binary obj file provided
143
143
if debug :
144
- print "scons: qt: '%s' seems to be a binary. Discarded." % str (obj )
144
+ print ( "scons: qt: '%s' seems to be a binary. Discarded." % str (obj ) )
145
145
continue
146
146
cpp = obj .sources [0 ]
147
147
if not splitext (str (cpp ))[1 ] in cxx_suffixes :
148
148
if debug :
149
- print "scons: qt: '%s' is no cxx file. Discarded." % str (cpp )
149
+ print ( "scons: qt: '%s' is no cxx file. Discarded." % str (cpp ) )
150
150
# c or fortran source
151
151
continue
152
152
#cpp_contents = comment.sub('', cpp.get_contents())
153
153
try :
154
154
cpp_contents = cpp .get_contents ()
155
+ if not isinstance (cpp_contents , str ):
156
+ cpp_contents = str (cpp_contents )
155
157
except : continue # may be an still not generated source
156
158
h = None
157
159
for h_ext in header_extensions :
@@ -161,27 +163,29 @@ def __call__(self, target, source, env):
161
163
h = find_file (hname , (cpp .get_dir (),), env .File )
162
164
if h :
163
165
if debug :
164
- print "scons: qt: Scanning '%s' (header of '%s')" % (str (h ), str (cpp ))
166
+ print ( "scons: qt: Scanning '%s' (header of '%s')" % (str (h ), str (cpp ) ))
165
167
#h_contents = comment.sub('', h.get_contents())
166
168
h_contents = h .get_contents ()
169
+ if not isinstance (h_contents , str ):
170
+ h_contents = str (h_contents )
167
171
break
168
172
if not h and debug :
169
- print "scons: qt: no header for '%s'." % (str (cpp ))
173
+ print ( "scons: qt: no header for '%s'." % (str (cpp ) ))
170
174
if h and q_object_search .search (h_contents ):
171
175
# h file with the Q_OBJECT macro found -> add moc_cpp
172
176
moc_cpp = env .Moc5 (h )
173
177
moc_o = objBuilder (moc_cpp )
174
178
out_sources .append (moc_o )
175
179
#moc_cpp.target_scanner = SCons.Defaults.CScan
176
180
if debug :
177
- print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str (h ), str (moc_cpp ))
181
+ print ( "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str (h ), str (moc_cpp ) ))
178
182
if cpp and q_object_search .search (cpp_contents ):
179
183
# cpp file with Q_OBJECT macro found -> add moc
180
184
# (to be included in cpp)
181
185
moc = env .Moc5 (cpp )
182
186
env .Ignore (moc , moc )
183
187
if debug :
184
- print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str (cpp ), str (moc ))
188
+ print ( "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str (cpp ), str (moc ) ))
185
189
#moc.source_scanner = SCons.Defaults.CScan
186
190
# restore the original env attributes (FIXME)
187
191
objBuilder .env = objBuilderEnv
@@ -303,6 +307,8 @@ def recursiveFiles(basepath, path) :
303
307
result .append (itemPath )
304
308
return result
305
309
contents = node .get_contents ()
310
+ if not isinstance (contents , str ):
311
+ contents = str (contents )
306
312
includes = qrcinclude_re .findall (contents )
307
313
qrcpath = os .path .dirname (node .path )
308
314
dirs = [included for included in includes if os .path .isdir (os .path .join (qrcpath ,included ))]
@@ -475,4 +481,4 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :
475
481
return
476
482
477
483
def exists (env ):
478
- return _detect (env )
484
+ return _detect (env )
0 commit comments