Mercurial > dotfiles
annotate install.py @ 432:06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 02 Apr 2018 09:01:46 -0700 |
parents | e0bb52007402 |
children | 8986ec3a9c1c |
rev | line source |
---|---|
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
1 import os |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
2 import os.path |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
3 import sys |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
4 import stat |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
5 import shutil |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
6 import argparse |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
7 import functools |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
8 import subprocess |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
9 import configparser |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
10 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
11 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
12 dotfiles_dir = os.path.abspath(os.path.dirname(__file__)) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
13 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
14 is_nix = True |
431
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
15 is_mac = False |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
16 is_windows = False |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
17 if sys.platform == "win32": |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
18 is_nix = False |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
19 is_windows = True |
431
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
20 if sys.platform == 'darwin': |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
21 is_mac = True |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
22 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
23 |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
24 def _p(*paths, force_unix=False): |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
25 res = os.path.join(dotfiles_dir, *paths) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
26 if force_unix: |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
27 res = res.replace('\\', '/') |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
28 else: |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
29 res = res.replace('/', os.sep) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
30 return res |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
31 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
32 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
33 def nixslash(path): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
34 return path.replace('\\', '/') |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
35 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
36 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
37 def ensure_dir(path): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
38 full_path = os.path.abspath(os.path.expanduser(path)) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
39 if not os.path.isdir(full_path): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
40 os.makedirs(full_path, mode=0o700) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
41 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
42 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
43 def mklink(orig_rel_path, link_path, mode=None): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
44 orig_full_path = os.path.join(dotfiles_dir, orig_rel_path) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
45 link_full_path = os.path.abspath(os.path.expanduser(link_path)) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
46 if os.path.islink(link_full_path): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
47 print("Unlinking %s" % link_full_path) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
48 os.unlink(link_full_path) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
49 elif os.path.exists(link_full_path): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
50 print("Removing %s" % link_full_path) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
51 os.remove(link_full_path) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
52 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
53 print("%s -> %s" % (link_full_path, orig_full_path)) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
54 os.symlink(orig_full_path, link_full_path) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
55 if mode is not None: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
56 os.chmod(link_full_path, mode) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
57 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
58 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
59 def writelines(path, lines): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
60 full_path = os.path.abspath(os.path.expanduser(path)) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
61 print("%d lines to %s" % (len(lines), full_path)) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
62 with open(full_path, 'w') as fp: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
63 for l in lines: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
64 fp.write(l) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
65 fp.write('\n') |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
66 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
67 |
432
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
68 def _on_rmtree_err(func, name, excinfo): |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
69 os.chmod(name, stat.S_IWUSR | stat.S_IWGRP) |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
70 os.remove(name) |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
71 |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
72 |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
73 def rmtree(dirpath): |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
74 shutil.rmtree(dirpath, onerror=_on_rmtree_err) |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
75 |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
76 |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
77 def only_on_nix(f): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
78 @functools.wraps(f) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
79 def decorator(*args, **kwargs): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
80 if is_nix: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
81 return f(*args, **kwargs) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
82 return decorator |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
83 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
84 |
431
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
85 def only_on_mac(f): |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
86 @functools.wraps(f) |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
87 def decorator(*args, **kwargs): |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
88 if is_mac: |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
89 return f(*args, **kwargs) |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
90 return decorator |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
91 |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
92 |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
93 def only_on_win(f): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
94 @functools.wraps(f) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
95 def decorator(*args, **kwargs): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
96 if is_windows: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
97 return f(*args, **kwargs) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
98 return decorator |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
99 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
100 |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
101 def supports_forcing(f): |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
102 f.__dotfiles_supports_forcing__ = True |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
103 return f |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
104 |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
105 |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
106 def needs_config(f): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
107 f.__dotfiles_needs_config__ = True |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
108 return f |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
109 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
110 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
111 def run_priority(prio): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
112 def wrapper(f): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
113 f.__dotfiles_priority__ = prio |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
114 return f |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
115 return wrapper |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
116 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
117 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
118 @only_on_nix |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
119 def install_bash(): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
120 mklink('bashrc/bashrc', '.bashrc') |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
121 mklink('bashrc/bash_profile', '.bash_profile') |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
122 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
123 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
124 @only_on_nix |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
125 def install_fish(): |
425
350f7a55ff33
Improve fish configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
417
diff
changeset
|
126 ensure_dir('~/.config/fish') |
350f7a55ff33
Improve fish configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
417
diff
changeset
|
127 writelines('~/.config/fish/config.fish', |
350f7a55ff33
Improve fish configuration.
Ludovic Chabant <ludovic@chabant.com>
parents:
417
diff
changeset
|
128 ['source %s' % _p('fish', 'config.fish')]) |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
129 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
130 |
432
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
131 @needs_config |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
132 @supports_forcing |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
133 def install_vim(cfg, force=False): |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
134 vimrc_path = '~/.vimrc' |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
135 if is_windows: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
136 vimrc_path = '~/_vimrc' |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
137 writelines(vimrc_path, [ |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
138 'set runtimepath+=%s' % nixslash(_p('vim')), |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
139 'source %s' % nixslash(_p('vim', 'vimrc')) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
140 ]) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
141 |
432
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
142 if cfg.has_section('vimbundles'): |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
143 bundle_dir = _p('vim', 'bundle') |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
144 os.makedirs(bundle_dir, exist_ok=True) |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
145 existing_plugins = set(os.listdir(bundle_dir)) |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
146 |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
147 for name, url in cfg.items('vimbundles'): |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
148 path = os.path.join(bundle_dir, name) |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
149 if url.startswith('[git]'): |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
150 clone_git(url[len('[git]'):], path, force=force) |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
151 else: |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
152 clone_hg(url, path, force=force) |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
153 |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
154 existing_plugins.discard(name) |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
155 |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
156 for name in existing_plugins: |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
157 print("Removing plugin %s" % name) |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
158 path = os.path.join(bundle_dir, name) |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
159 rmtree(path) |
06a551d3fbb2
Move vim plugin subrepos to a separate config section, support cleaning up.
Ludovic Chabant <ludovic@chabant.com>
parents:
431
diff
changeset
|
160 |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
161 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
162 @run_priority(2) # Needs to run before `fish`. |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
163 def install_mercurial(): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
164 hgrc_path = '~/.hgrc' |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
165 if is_windows: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
166 hgrc_path = '~/mercurial.ini' |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
167 writelines(hgrc_path, [ |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
168 '%%include %s' % _p('hgrc/hgrc'), |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
169 '[ui]', |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
170 'ignore = %s' % _p('hgrc/hgignore'), |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
171 '[subrepos]', |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
172 'git:allowed = true', |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
173 '[extensions]', |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
174 'hggit = %s' % _p('lib/hg/hg-git/hggit/'), |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
175 'onsub = %s' % _p('lib/hg/onsub/onsub.py'), |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
176 'allpaths = %s' % _p('lib/hg/allpaths/mercurial_all_paths.py'), |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
177 'prompt = %s' % _p('lib/hg/hg-prompt/prompt.py'), |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
178 'evolve = %s' % _p('lib/hg/mutable-history/hgext3rd/evolve'), |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
179 'terse-status = %s' % _p('lib/hg/terse-status/terse-status.py') |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
180 ]) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
181 if is_nix: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
182 print("Building fast-hg-prompt...") |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
183 compile_ok = True |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
184 try: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
185 subprocess.check_call(['make'], cwd=_p('lib/hg/fast-hg-prompt')) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
186 except subprocess.CalledProcessError: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
187 compile_ok = False |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
188 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
189 for n in ['bookmark', 'remote', 'status']: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
190 link_path = os.path.expanduser('~/.local/bin/fast-hg-%s' % n) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
191 if compile_ok: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
192 mklink('lib/hg/fast-hg-prompt/fast-hg-%s' % n, link_path, |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
193 mode=(stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
194 elif os.path.islink(link_path): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
195 os.unlink(link_path) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
196 elif os.path.exists(link_path): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
197 os.remove(link_path) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
198 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
199 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
200 def install_git(): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
201 writelines('~/.gitconfig', [ |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
202 '[include]', |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
203 'path = %s' % _p('git/gitconfig', force_unix=True) |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
204 ]) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
205 if is_windows: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
206 subprocess.check_call( |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
207 ['setx', 'GIT_SSH', |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
208 '%USERPROFILE%\\Dropbox\\Utilities\\plink.exe'], |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
209 shell=True) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
210 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
211 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
212 @only_on_nix |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
213 def install_tmux(): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
214 mklink('tmux/tmux.conf', '~/.tmux.conf') |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
215 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
216 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
217 @only_on_nix |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
218 def install_weechat(): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
219 mklink('weechat', '~/.weechat') |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
220 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
221 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
222 @only_on_nix |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
223 def install_mutt(): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
224 writelines('~/.muttrc', [ |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
225 'source "gpg2 -dq %s |"' % _p('mutt/variables.gpg'), |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
226 'source "%s"' % _p('mutt/muttrc'), |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
227 'source "%s"' % _p('lib/mutt/mutt-colors-solarized/' |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
228 'mutt-colors-solarized-dark-256.muttrc') |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
229 ]) |
417
6dbef23ca6bd
Update subrepos if they're already cloned.
Ludovic Chabant <ludovic@chabant.com>
parents:
416
diff
changeset
|
230 |
6dbef23ca6bd
Update subrepos if they're already cloned.
Ludovic Chabant <ludovic@chabant.com>
parents:
416
diff
changeset
|
231 |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
232 def _on_error_try_make_readable(func, path, exc_info): |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
233 if not os.access(path, os.W_OK): |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
234 os.chmod(path, stat.S_IWUSR) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
235 func(path) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
236 else: |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
237 raise |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
238 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
239 |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
240 def clone_git(url, path, force=False): |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
241 if os.path.isdir(path): |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
242 if not force: |
417
6dbef23ca6bd
Update subrepos if they're already cloned.
Ludovic Chabant <ludovic@chabant.com>
parents:
416
diff
changeset
|
243 print("git pull origin master %s" % path) |
6dbef23ca6bd
Update subrepos if they're already cloned.
Ludovic Chabant <ludovic@chabant.com>
parents:
416
diff
changeset
|
244 subprocess.check_call(['git', 'pull', 'origin', 'master'], |
6dbef23ca6bd
Update subrepos if they're already cloned.
Ludovic Chabant <ludovic@chabant.com>
parents:
416
diff
changeset
|
245 cwd=path) |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
246 return |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
247 else: |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
248 print("Deleting existing: %s" % path) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
249 shutil.rmtree(path, onerror=_on_error_try_make_readable) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
250 |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
251 print("git clone %s %s" % (url, path)) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
252 ensure_dir(os.path.dirname(path)) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
253 subprocess.check_call(['git', 'clone', url, path]) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
254 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
255 |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
256 def clone_hg(url, path, force=False): |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
257 if os.path.isdir(path): |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
258 if not force: |
417
6dbef23ca6bd
Update subrepos if they're already cloned.
Ludovic Chabant <ludovic@chabant.com>
parents:
416
diff
changeset
|
259 print("hg pull -u %s" % path) |
6dbef23ca6bd
Update subrepos if they're already cloned.
Ludovic Chabant <ludovic@chabant.com>
parents:
416
diff
changeset
|
260 subprocess.check_call(['hg', 'pull', '-u'], cwd=path) |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
261 return |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
262 else: |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
263 print("Deleting existing: %s" % path) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
264 shutil.rmtree(path, onerror=_on_error_try_make_readable) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
265 |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
266 print("hg clone %s %s" % (url, path)) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
267 ensure_dir(os.path.dirname(path)) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
268 env = dict(os.environ) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
269 env.update({'HGPLAIN': '1'}) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
270 subprocess.check_call(['hg', 'clone', url, path], env=env) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
271 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
272 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
273 @needs_config |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
274 @supports_forcing |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
275 @run_priority(100) |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
276 def install_subrepos(cfg, force=False): |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
277 if not cfg.has_section('subrepos'): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
278 return |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
279 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
280 for path, url in cfg.items('subrepos'): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
281 full_path = _p(path) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
282 if url.startswith('[git]'): |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
283 clone_git(url[len('[git]'):], full_path, force=force) |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
284 else: |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
285 clone_hg(url, full_path, force=force) |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
286 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
287 |
431
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
288 @only_on_mac |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
289 @run_priority(210) |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
290 def install_xcode(): |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
291 if shutil.which('xcodebuild') is None: |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
292 print("Installing XCode") |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
293 subprocess.check_call(['xcode-select', '--install']) |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
294 subprocess.check_call(['sudo', 'xcodebuild', '-license', 'accept']) |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
295 |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
296 |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
297 @only_on_mac |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
298 @run_priority(209) |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
299 def install_homebrew(): |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
300 if shutil.which('brew') is None: |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
301 print("Installing Homebrew and Homebrew Cask") |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
302 subprocess.check_call([ |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
303 '/usr/bin/ruby', '-e', |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
304 "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"]) # NOQA |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
305 subprocess.check_call(['brew', 'tap', 'caskroom/fonts']) |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
306 |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
307 |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
308 @only_on_mac |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
309 @needs_config |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
310 @supports_forcing |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
311 @run_priority(208) |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
312 def install_mactools(cfg, force=False): |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
313 if not cfg.has_section('mactools'): |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
314 return |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
315 |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
316 for name, _ in cfg.items('mactools'): |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
317 args = ['brew', 'install', name] |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
318 if force: |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
319 args.append('--force') |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
320 subprocess.check_call(args) |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
321 |
e0bb52007402
Add installation of homebrew stuff on Mac.
Ludovic Chabant <ludovic@chabant.com>
parents:
425
diff
changeset
|
322 |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
323 def main(): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
324 print("dotfiles installer") |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
325 print("python %s" % sys.version) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
326 print("on %s" % sys.platform) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
327 print('') |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
328 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
329 cfg = configparser.ConfigParser() |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
330 cfg.read(_p('install.cfg')) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
331 |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
332 # Get all the methods in this module that are named `install_xxx`. |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
333 mod_names = ['all'] |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
334 this_mod = sys.modules[__name__] |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
335 for an in dir(this_mod): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
336 if not an.startswith('install_'): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
337 continue |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
338 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
339 name = an[len('install_'):] |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
340 mod_names.append(name) |
417
6dbef23ca6bd
Update subrepos if they're already cloned.
Ludovic Chabant <ludovic@chabant.com>
parents:
416
diff
changeset
|
341 |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
342 # See if we have any local install script. |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
343 local_mod = None |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
344 local_install_py = os.path.join(dotfiles_dir, 'local', |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
345 'local_install.py') |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
346 if os.path.isfile(local_install_py): |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
347 import importlib.util |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
348 spec = importlib.util.spec_from_file_location('local_install', |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
349 local_install_py) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
350 local_mod = importlib.util.module_from_spec(spec) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
351 spec.loader.exec_module(local_mod) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
352 sys.modules['local_install'] = local_mod |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
353 |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
354 # Create the parser, where you can specify one or more install target. |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
355 parser = argparse.ArgumentParser() |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
356 parser.add_argument( |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
357 'module', nargs='*', |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
358 choices=mod_names, |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
359 help="Which module(s) to install. Defaults to all modules.") |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
360 parser.add_argument( |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
361 '-f', '--force', action='store_true', |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
362 help="Force installation by overwriting things.") |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
363 args = parser.parse_args() |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
364 |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
365 # Get the list of methods to run. |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
366 funcs = [] |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
367 selected_mods = set(args.module) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
368 if 'all' in selected_mods: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
369 selected_mods = set(mod_names) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
370 selected_mods.remove('all') |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
371 for mn in selected_mods: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
372 func = getattr(this_mod, 'install_%s' % mn) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
373 funcs.append((mn, func)) |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
374 # See if there's a local method too for this. |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
375 if local_mod is not None: |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
376 local_func = getattr(local_mod, 'install_%s' % mn, None) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
377 if local_func is not None: |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
378 lmn = '%s (local)' % mn |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
379 funcs.append((lmn, local_func)) |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
380 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
381 funcs = sorted(funcs, key=_get_install_func_priority, reverse=True) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
382 for name, func in funcs: |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
383 print("Installing %s" % name) |
416
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
384 |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
385 f_args = [] |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
386 f_kwargs = {} |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
387 if getattr(func, '__dotfiles_needs_config__', False): |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
388 f_args.append(cfg) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
389 if getattr(func, '__dotfiles_supports_forcing__', False): |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
390 f_kwargs['force'] = args.force |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
391 |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
392 try: |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
393 func(*f_args, **f_kwargs) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
394 except Exception as ex: |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
395 print("ERROR: %s" % ex) |
222b477ad678
Install script improvements.
Ludovic Chabant <ludovic@chabant.com>
parents:
407
diff
changeset
|
396 print("Aborting install.") |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
397 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
398 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
399 def _get_install_func_priority(func_info): |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
400 func = func_info[1] |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
401 return getattr(func, '__dotfiles_priority__', 0) |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
402 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
403 |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
404 if __name__ == '__main__': |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
405 main() |