view python/install_config.py @ 38:10fc72a4e6ca

upgrade hotkeys to use the new mozilla pastebin.py (can probably throw away HOME/bin/pastebin.sh)
author Jeff Hammel <k0scist@gmail.com>
date Thu, 18 Mar 2010 17:26:44 -0700
parents d83f35b9b799
children eda848575afb
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'],
             ['hg', 'clone', 'http://bitbucket.org/ianb/virtualenv'],

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

def execute(*commands):
    for command in commands:
        print ' '.join(command)
        code = subprocess.call(command)
        if code:
            sys.exit(code)

execute(*commands)

def install_develop(package):
    src = 'http://k0s.org/hg/%s' % package
    commands = [ ['virtualenv/virtualenv.py', package],
                 ['mkdir', '%s/src' % package],
                 ['hg', 'clone', src, '%s/src/%s' % (package, package)],
                 ['%s/bin/python' % package, '%s/src/%s/setup.py' % (package, package), 'develop'] ]
    execute(*commands)

# install some python
install_develop('smartopen')

postinstall_commands = [ ['ln', '-s', os.path.join(HOME, 'smartopen', 'bin', 'smartopen'), os.path.join(HOME, 'bin', 'smartopen') ] ]

execute(*postinstall_commands)

# TODO:
# - ubuntu packages to install:
PACKAGES="unison fluxbox antiword xclip"
echo "Ensure the following packages are installed:"
echo "sudo apt-get install $PACKAGES"