__init__.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. appname = "Pwman3"
  22. version = "0.5-dev"
  23. website = "http://github.com/pwman3/pwman3"
  24. author = "Oz Nahum"
  25. authoremail = "nahumoz@gmail.com"
  26. description = "Pwman -a command line password management application."
  27. keywords = "password management sqlite crypto"
  28. import os
  29. def get_ui_platform(platform):
  30. if 'darwin' in platform:
  31. from ui.mac import PwmanCliMacNew as PwmanCliNew
  32. OSX = True
  33. elif 'win' in platform:
  34. from ui.win import PwmanCliWinNew as PwmanCliNew
  35. OSX = False
  36. else:
  37. from ui.cli import PwmanCliNew
  38. OSX = False
  39. return PwmanCliNew, OSX
  40. def which(cmd):
  41. _, cmdname = os.path.split(cmd)
  42. for path in os.environ["PATH"].split(os.pathsep):
  43. cmd = os.path.join(path, cmdname)
  44. if os.path.isfile(cmd) and os.access(cmd, os.X_OK): # pragma: no cover
  45. return cmd
  46. config_dir = os.path.expanduser("~/.pwman")
  47. default_config = {'Global': {'umask': '0100', 'colors': 'yes',
  48. 'cls_timeout': '5'
  49. },
  50. 'Database': {'type': 'SQLite',
  51. 'filename': os.path.join(config_dir,
  52. "pwman.db")},
  53. 'Encryption': {'algorithm': 'AES'},
  54. 'Readline': {'history': os.path.join(config_dir,
  55. "history")}
  56. }