scons-1.0.0-qt-handle-missing-moc-files.patch 1.2 KB

1234567891011121314151617181920212223242526
  1. Index: scons-1.3.0/engine/SCons/Tool/qt.py
  2. ===================================================================
  3. --- scons-1.3.0.orig/engine/SCons/Tool/qt.py
  4. +++ scons-1.3.0/engine/SCons/Tool/qt.py
  5. @@ -139,7 +139,10 @@ class _Automoc:
  6. # c or fortran source
  7. continue
  8. #cpp_contents = comment.sub('', cpp.get_text_contents())
  9. - cpp_contents = cpp.get_text_contents()
  10. + try:
  11. + cpp_contents = cpp.get_text_contents()
  12. + except AttributeError: # non-existant file
  13. + cpp_contents = None
  14. h=None
  15. for h_ext in header_extensions:
  16. # try to find the header file in the corresponding source
  17. @@ -162,7 +165,7 @@ class _Automoc:
  18. #moc_cpp.target_scanner = SCons.Defaults.CScan
  19. if debug:
  20. print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp))
  21. - if cpp and q_object_search.search(cpp_contents):
  22. + if cpp_contents and cpp and q_object_search.search(cpp_contents):
  23. # cpp file with Q_OBJECT macro found -> add moc
  24. # (to be included in cpp)
  25. moc = env.Moc(cpp)