@@ -135,23 +135,25 @@ def __call__(self, target, source, env):
135135 out_sources = source [:]
136136
137137 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 ) )
140140 continue
141141 if not obj .has_builder ():
142142 # binary obj file provided
143143 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 ) )
145145 continue
146146 cpp = obj .sources [0 ]
147147 if not splitext (str (cpp ))[1 ] in cxx_suffixes :
148148 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 ) )
150150 # c or fortran source
151151 continue
152152 #cpp_contents = comment.sub('', cpp.get_contents())
153153 try :
154154 cpp_contents = cpp .get_contents ()
155+ if not isinstance (cpp_contents , str ):
156+ cpp_contents = str (cpp_contents )
155157 except : continue # may be an still not generated source
156158 h = None
157159 for h_ext in header_extensions :
@@ -161,27 +163,29 @@ def __call__(self, target, source, env):
161163 h = find_file (hname , (cpp .get_dir (),), env .File )
162164 if h :
163165 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 ) ))
165167 #h_contents = comment.sub('', h.get_contents())
166168 h_contents = h .get_contents ()
169+ if not isinstance (h_contents , str ):
170+ h_contents = str (h_contents )
167171 break
168172 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 ) ))
170174 if h and q_object_search .search (h_contents ):
171175 # h file with the Q_OBJECT macro found -> add moc_cpp
172176 moc_cpp = env .Moc5 (h )
173177 moc_o = objBuilder (moc_cpp )
174178 out_sources .append (moc_o )
175179 #moc_cpp.target_scanner = SCons.Defaults.CScan
176180 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 ) ))
178182 if cpp and q_object_search .search (cpp_contents ):
179183 # cpp file with Q_OBJECT macro found -> add moc
180184 # (to be included in cpp)
181185 moc = env .Moc5 (cpp )
182186 env .Ignore (moc , moc )
183187 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 ) ))
185189 #moc.source_scanner = SCons.Defaults.CScan
186190 # restore the original env attributes (FIXME)
187191 objBuilder .env = objBuilderEnv
@@ -303,6 +307,8 @@ def recursiveFiles(basepath, path) :
303307 result .append (itemPath )
304308 return result
305309 contents = node .get_contents ()
310+ if not isinstance (contents , str ):
311+ contents = str (contents )
306312 includes = qrcinclude_re .findall (contents )
307313 qrcpath = os .path .dirname (node .path )
308314 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) :
475481 return
476482
477483def exists (env ):
478- return _detect (env )
484+ return _detect (env )
0 commit comments