Mercurial > hg > config
annotate python/install_config.py @ 15:31023aedee9c
change spacing
author | k0s <k0scist@gmail.com> |
---|---|
date | Thu, 28 Jan 2010 21:22:12 -0500 |
parents | ac34d580c6d7 |
children | 57298ea7a7f1 |
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 | |
7 | 5 curl http://k0s.org/hg/config/raw/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 |