Mercurial > dotfiles
comparison install.py @ 471:31079b060068
Update mutt config.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 09 Apr 2019 19:09:04 -0700 |
parents | 3b9394a0a58b |
children | 97412ea9b3fa |
comparison
equal
deleted
inserted
replaced
470:3b9394a0a58b | 471:31079b060068 |
---|---|
17 if sys.platform == "win32": | 17 if sys.platform == "win32": |
18 is_nix = False | 18 is_nix = False |
19 is_windows = True | 19 is_windows = True |
20 if sys.platform == 'darwin': | 20 if sys.platform == 'darwin': |
21 is_mac = True | 21 is_mac = True |
22 | |
23 | |
24 def _is_executable(fpath): | |
25 return os.path.isfile(fpath) and os.access(fpath, os.X_OK) | |
26 | |
27 | |
28 def which(exename): | |
29 for path in os.environ.get("PATH", "").split(os.pathsep): | |
30 exepath = os.path.join(path, exename) | |
31 if _is_executable(exepath): | |
32 return exepath | |
33 return None | |
22 | 34 |
23 | 35 |
24 def _p(*paths, force_unix=False): | 36 def _p(*paths, force_unix=False): |
25 res = os.path.join(dotfiles_dir, *paths) | 37 res = os.path.join(dotfiles_dir, *paths) |
26 if force_unix: | 38 if force_unix: |
240 mklink('weechat', '~/.weechat') | 252 mklink('weechat', '~/.weechat') |
241 | 253 |
242 | 254 |
243 @only_on_nix | 255 @only_on_nix |
244 def install_mutt(): | 256 def install_mutt(): |
257 if which('gpg2'): | |
258 gpgbin = 'gpg2' | |
259 else: | |
260 if not which('gpg'): | |
261 print("WARNING: no GPG tools seem to be installed!") | |
262 gpgbin = 'gpg' | |
245 writelines('~/.muttrc', [ | 263 writelines('~/.muttrc', [ |
246 'source "gpg2 -dq %s |"' % _p('mutt/variables.gpg'), | 264 'source "%s -dq %s |"' % (gpgbin, _p('mutt/variables.gpg')), |
247 'source "%s"' % _p('mutt/muttrc'), | 265 'source "%s"' % _p('mutt/muttrc'), |
248 'source "%s"' % _p('lib/mutt/mutt-colors-solarized/' | 266 'source "%s"' % _p('lib/mutt/mutt-colors-solarized/' |
249 'mutt-colors-solarized-dark-256.muttrc') | 267 'mutt-colors-solarized-dark-256.muttrc') |
250 ]) | 268 ]) |
251 | 269 |