view 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
line wrap: on
line source

#!/usr/bin/env python
"""
installs config to a user's home directory
this can be done with
curl http://k0s.org/hg/config/python/install-config.py | python
"""

SRC='http://k0s.org/hg/config'
import os
import sys
os.chdir(os.environ['HOME'])

# make the current directory a repository
import subprocess

commands = [ ['hg', 'init'],
             ['hg', 'pull', SRC],
             ['hg', 'update', '-C' ] ]

for command in commands:
    code = subprocess.call(command)
    if code:
        sys.exit(code)