view 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
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/raw-file/tip/python/install_config.py | python
"""

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

# make the current directory a repository
import subprocess

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

             # site-specific files
             ['rm', '.subversion/config'],
             ['ln', '-s', os.path.join(HOME, '.subversion_config/config'), os.path.join(HOME, '.subversion/config')],
             ]

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