Mercurial > hg > config
annotate python/install_config.py @ 20:03fc1f76db91
adding dotpath python helper
author | k0s <k0scist@gmail.com> |
---|---|
date | Mon, 22 Feb 2010 13:59:07 -0500 |
parents | 57298ea7a7f1 |
children | 8da594377f18 |
rev | line source |
---|---|
1 | 1 #!/usr/bin/env python |
2 """ | |
3 installs config to a user's home directory | |
4 this can be done with | |
16 | 5 curl http://k0s.org/hg/config/raw-file/tip/python/install_config.py | python |
1 | 6 """ |
7 | |
8 SRC='http://k0s.org/hg/config' | |
9 import os | |
6 | 10 import sys |
14
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
11 HOME=os.environ['HOME'] |
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
12 os.chdir(HOME) |
1 | 13 |
14 # make the current directory a repository | |
15 import subprocess | |
6 | 16 |
17 commands = [ ['hg', 'init'], | |
18 ['hg', 'pull', SRC], | |
14
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
19 ['hg', 'update', '-C'], |
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
20 |
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
21 # site-specific files |
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
22 ['rm', '.subversion/config'], |
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
23 ['ln', '-s', os.path.join(HOME, '.subversion_config/config'), os.path.join(HOME, '.subversion/config')], |
ac34d580c6d7
make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents:
7
diff
changeset
|
24 ] |
6 | 25 |
26 for command in commands: | |
27 code = subprocess.call(command) | |
28 if code: | |
29 sys.exit(code) | |
1 | 30 |
31 | |
6 | 32 |