annotate python/install_config.py @ 6:524f9e7fa224

be backwards compatible
author k0s <k0scist@gmail.com>
date Wed, 09 Dec 2009 13:05:28 -0500
parents f58e8e81e16b
children c38d875a3b78
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env python
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
2 """
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
3 installs config to a user's home directory
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
4 this can be done with
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
5 curl http://k0s.org/hg/config/python/install-config.py | python
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
6 """
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
7
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
8 SRC='http://k0s.org/hg/config'
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
9 import os
6
524f9e7fa224 be backwards compatible
k0s <k0scist@gmail.com>
parents: 1
diff changeset
10 import sys
1
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
11 os.chdir(os.environ['HOME'])
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
12
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
13 # make the current directory a repository
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
14 import subprocess
6
524f9e7fa224 be backwards compatible
k0s <k0scist@gmail.com>
parents: 1
diff changeset
15
524f9e7fa224 be backwards compatible
k0s <k0scist@gmail.com>
parents: 1
diff changeset
16 commands = [ ['hg', 'init'],
524f9e7fa224 be backwards compatible
k0s <k0scist@gmail.com>
parents: 1
diff changeset
17 ['hg', 'pull', SRC],
524f9e7fa224 be backwards compatible
k0s <k0scist@gmail.com>
parents: 1
diff changeset
18 ['hg', 'update', '-C' ] ]
524f9e7fa224 be backwards compatible
k0s <k0scist@gmail.com>
parents: 1
diff changeset
19
524f9e7fa224 be backwards compatible
k0s <k0scist@gmail.com>
parents: 1
diff changeset
20 for command in commands:
524f9e7fa224 be backwards compatible
k0s <k0scist@gmail.com>
parents: 1
diff changeset
21 code = subprocess.call(command)
524f9e7fa224 be backwards compatible
k0s <k0scist@gmail.com>
parents: 1
diff changeset
22 if code:
524f9e7fa224 be backwards compatible
k0s <k0scist@gmail.com>
parents: 1
diff changeset
23 sys.exit(code)
1
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
24
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
25
6
524f9e7fa224 be backwards compatible
k0s <k0scist@gmail.com>
parents: 1
diff changeset
26