__init__.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #============================================================================
  2. # This file is part of Pwman3.
  3. #
  4. # Pwman3 is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License, version 2
  6. # as published by the Free Software Foundation;
  7. #
  8. # Pwman3 is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with Pwman3; if not, write to the Free Software
  15. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. #============================================================================
  17. # Copyright (C) 2012 Oz Nahum <nahumoz@gmail.com>
  18. #============================================================================
  19. # Copyright (C) 2006 Ivan Kelly <ivan@ivankelly.net>
  20. #============================================================================
  21. import os
  22. import pkg_resources
  23. appname = "Pwman3"
  24. try:
  25. version = pkg_resources.get_distribution('pwman3').version
  26. except pkg_resources.DistributionNotFound: # pragma: no cover
  27. version = "0.5-dev"
  28. website = "http://github.com/pwman3/pwman3"
  29. author = "Oz Nahum"
  30. authoremail = "nahumoz@gmail.com"
  31. description = "Pwman -a command line password management application."
  32. keywords = "password management sqlite crypto"
  33. def which(cmd):
  34. _, cmdname = os.path.split(cmd)
  35. for path in os.environ["PATH"].split(os.pathsep):
  36. cmd = os.path.join(path, cmdname)
  37. if os.path.isfile(cmd) and os.access(cmd, os.X_OK): # pragma: no cover
  38. return cmd
  39. config_dir = os.path.expanduser("~/.pwman")
  40. default_config = {'Global': {'umask': '0100', 'colors': 'yes',
  41. 'cls_timeout': '5'
  42. },
  43. 'Database': {'type': 'SQLite',
  44. 'filename': os.path.join(config_dir,
  45. "pwman.db")},
  46. 'Encryption': {'algorithm': 'AES'},
  47. 'Readline': {'history': os.path.join(config_dir,
  48. "history")}
  49. }