Shared Memory Dictionary utilizing Posix IPC semaphores and shared memory segments and offering permanent disk storage of data if required.
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.

37 lines
1.1KB

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. __version__ = "2019.08.21.20.19"
  4. __version_info__ = tuple([int(num) for num in __version__.split(".")])
  5. if __name__ == "__main__":
  6. from datetime import datetime
  7. # Open this file in read plus write mode
  8. with open(__file__, "r+") as file:
  9. contents = ""
  10. # Calculate the version strings
  11. old_version = __version__
  12. new_version = datetime.utcnow().strftime("%Y.%m.%d.%H.%M")
  13. # Read through current file and replace
  14. # the old datetime stamp with the new
  15. # UTC datetime stamp
  16. for line in file.read().split("\n"):
  17. if line.startswith("__version__ = "):
  18. line = '__version__ = "{}"'.format(new_version)
  19. contents = "{}{}\n".format(contents, line)
  20. # Remove extraneous newline from end of contents
  21. contents = contents[:-1]
  22. # Seek back to the beginning of the file
  23. file.seek(0)
  24. # Erase the contents
  25. file.truncate()
  26. # Write the new contents
  27. file.write(contents)
  28. print("Changing version from {} to {}".format(old_version, new_version))