changeset 590:e93b81d8a586

STUB: python/install_config.py
author Jeff Hammel <k0scist@gmail.com>
date Fri, 24 Jan 2014 17:53:23 -0800
parents 680071699d35
children 542d329835ec
files python/install_config.py
diffstat 1 files changed, 23 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/python/install_config.py	Fri Jan 24 12:08:05 2014 -0800
+++ b/python/install_config.py	Fri Jan 24 17:53:23 2014 -0800
@@ -20,27 +20,25 @@
 import sys
 
 # globals
-SRC='http://k0s.org/hg/config' # config repository
-HOME=os.environ['HOME']
+SRC = 'http://k0s.org/hg/config' # config repository
+HOME = os.environ['HOME'] # home directory
 
 ### standalone functions
 
-def execute(*commands):
+def execute(*commands, **kwargs):
     """execute a series of commands"""
     for command in commands:
-        print ' '.join(command)
-        code = subprocess.call(command)
-        if code:
-            sys.exit(code)
+        print (subprocess.list2cmdline(' '.join(command))
+        code = subprocess.call(command, **kwargs)
 
 def install_develop(package):
     """install k0s.ware for development"""
 
     src = 'http://k0s.org/hg/%s' % package
     directory = '%s/src/%s' % (package, package)
-    commands = [ ['virtualenv/virtualenv.py', package],
-                 ['mkdir', '-p', directory ],
-                 ['hg', 'clone', src, directory] ]
+    commands = [['virtualenv/virtualenv.py', package],
+                ['mkdir', '-p', directory ],
+                ['hg', 'clone', src, directory] ]
     execute(*commands)
     old_directory = os.getcwd()
     os.chdir(directory)
@@ -50,6 +48,8 @@
 
 ### generic step framework
 
+
+
 class Step(object):
     @classmethod
     def check(cls):
@@ -92,12 +92,20 @@
         from which import which
 
 #@requires(Command('git'))
+class ConfigureGit(Step):
+    """configure git"""
+    commands = [['git', 'config', '--global', 'core.excludesfile', os.path.join(HOME, '.gitignore')]]
+
+#@requires(Command('git'))
 class InstallVirtualenv(Step):
     commands = [['git', 'clone', 'https://github.com/pypa/virtualenv.git'],
-                ['ln', '-s', 
-                 os.path.join(HOME, 'virtualenv/virtualenv.py'), 
-                 os.path.join(HOME, 'bin/')]
-            ]
+                ['ln', '-s',
+                 os.path.join(HOME, 'virtualenv/virtualenv.py'),
+                 os.path.join(HOME, 'bin', 'virtualenv.py')]
+    ]
+
+class InstallKWare(Step):
+    """install k0s.ware"""
 
 class DebianPackages(Step):
     """ubuntu packages to install"""
@@ -119,7 +127,7 @@
     def __call__(self):
         print "Ensure the following packages are installed:"
         print "sudo apt-get install %s" % ' '.join(self.PACKAGES)
-    
+
 
 ### legacy -v-
 
@@ -130,13 +138,8 @@
     git = which('git')
     if git:
 
-        # get virtual env
-        virtualenv_
-        execute(*virtualenv_commands)
-
         # setup git's global ignore, since git is silly about this
         # and doesn't look for the file in the right place
-        execute(['git', 'config', '--global', 'core.excludesfile', os.path.join(HOME, '.gitignore')])
 
         # install some python
         install_develop('smartopen')