You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.3 KiB

6 years ago
  1. """SCons.Scanner.RC
  2. This module implements the dependency scanner for RC (Interface
  3. Definition Language) files.
  4. """
  5. #
  6. # Copyright (c) 2001 - 2017 The SCons Foundation
  7. #
  8. # Permission is hereby granted, free of charge, to any person obtaining
  9. # a copy of this software and associated documentation files (the
  10. # "Software"), to deal in the Software without restriction, including
  11. # without limitation the rights to use, copy, modify, merge, publish,
  12. # distribute, sublicense, and/or sell copies of the Software, and to
  13. # permit persons to whom the Software is furnished to do so, subject to
  14. # the following conditions:
  15. #
  16. # The above copyright notice and this permission notice shall be included
  17. # in all copies or substantial portions of the Software.
  18. #
  19. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
  20. # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  21. # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  22. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  23. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  24. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  25. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26. #
  27. __revision__ = "src/engine/SCons/Scanner/RC.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
  28. import re
  29. import SCons.Node.FS
  30. import SCons.Scanner
  31. def no_tlb(nodes):
  32. """
  33. Filter out .tlb files as they are binary and shouldn't be scanned
  34. """
  35. # print("Nodes:%s"%[str(n) for n in nodes])
  36. return [n for n in nodes if str(n)[-4:] != '.tlb']
  37. def RCScan():
  38. """Return a prototype Scanner instance for scanning RC source files"""
  39. res_re= r'^(?:\s*#\s*(?:include)|' \
  40. '.*?\s+(?:ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)' \
  41. '\s*.*?)' \
  42. '\s*(<|"| )([^>"\s]+)(?:[>"\s])*$'
  43. resScanner = SCons.Scanner.ClassicCPP("ResourceScanner",
  44. "$RCSUFFIXES",
  45. "CPPPATH",
  46. res_re,
  47. recursive=no_tlb)
  48. return resScanner
  49. # Local Variables:
  50. # tab-width:4
  51. # indent-tabs-mode:nil
  52. # End:
  53. # vim: set expandtab tabstop=4 shiftwidth=4: