kwsysDateStamp.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/python
  2. #=============================================================================
  3. # KWSys - Kitware System Library
  4. # Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  5. #
  6. # Distributed under the OSI-approved BSD License (the "License");
  7. # see accompanying file Copyright.txt for details.
  8. #
  9. # This software is distributed WITHOUT ANY WARRANTY; without even the
  10. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. # See the License for more information.
  12. #=============================================================================
  13. import sys,os
  14. import time
  15. # Get the path to the directory containing this script.
  16. if __name__ == '__main__':
  17. selfdir = os.path.abspath(sys.path[0] or os.curdir)
  18. else:
  19. selfdir = os.path.abspath(os.path.dirname(__file__))
  20. # Open the CMake code file.
  21. fname = os.path.join(selfdir, 'kwsysDateStamp.cmake')
  22. fout = open(fname, 'w');
  23. # Get the current time.
  24. ct = time.localtime()
  25. # Write the CMake code describing the date.
  26. fout.write("""# Do not edit! Generated by kwsysDateStamp.py
  27. #=============================================================================
  28. # KWSys - Kitware System Library
  29. # Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  30. #
  31. # Distributed under the OSI-approved BSD License (the "License");
  32. # see accompanying file Copyright.txt for details.
  33. #
  34. # This software is distributed WITHOUT ANY WARRANTY; without even the
  35. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  36. # See the License for more information.
  37. #=============================================================================
  38. # KWSys version date year component. Format is CCYY.
  39. SET(KWSYS_DATE_STAMP_YEAR %04u)
  40. # KWSys version date month component. Format is MM.
  41. SET(KWSYS_DATE_STAMP_MONTH %02u)
  42. # KWSys version date day component. Format is DD.
  43. SET(KWSYS_DATE_STAMP_DAY %02u)
  44. """ % (ct.tm_year, ct.tm_mon, ct.tm_mday))
  45. fout.close()