changeset 410:ffa08f0de165

fix a thing
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 04 Aug 2013 15:14:16 -0700
parents dc64beded724
children 9d6e7a471fc7
files .bashrc python/install_config.py
diffstat 2 files changed, 35 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/.bashrc	Sun Aug 04 10:57:10 2013 -0700
+++ b/.bashrc	Sun Aug 04 15:14:16 2013 -0700
@@ -61,7 +61,7 @@
 # Alt: PS2='☰'
 
 # PATHs
-export PATH=~/firefox:~/bin:~/bin/mozilla:~/python:$PATH:/usr/sbin:/usr/games/bin
+export PATH=~/firefox:~/bin:~/bin/mozilla:~/python:$PATH:/usr/sbin:/usr/games/bin:~/silvermirror/bin
 export PYTHONPATH=~/python:$PYTHONPATH:~/virtualenv
 
 ### functions
--- a/python/install_config.py	Sun Aug 04 10:57:10 2013 -0700
+++ b/python/install_config.py	Sun Aug 04 15:14:16 2013 -0700
@@ -19,6 +19,8 @@
 HOME=os.environ['HOME']
 os.chdir(HOME)
 
+### standalone functions
+
 def execute(*commands):
     """execute a series of commands"""
     for command in commands:
@@ -27,6 +29,24 @@
         if code:
             sys.exit(code)
 
+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] ]
+    execute(*commands)
+    old_directory = os.getcwd()
+    os.chdir(directory)
+    command = ['../../bin/python',  'setup.py', 'develop']
+    execute(command)
+    os.chdir(old_directory)
+
+
+### process steps
+
 class Step(object):
     @classmethod
     def check(cls):
@@ -41,6 +61,17 @@
         ['hg', 'pull', SRC],
         ['hg', 'update', '-C'],
         ]
+    @classmethd
+    def write_hgrc(self):
+        hgrc = """[paths]
+default = http://k0s.org/hg/config
+default-push = ssh://k0s.org/hg/config
+"""
+        with file('.hg/hgrc', 'w') as f
+            f.write(hgrc)
+    def __call__(self):
+        Step.__call__(self)
+        self.write_hgrc()
 
 commands = [
     ['hg', 'init'],
@@ -51,11 +82,6 @@
 execute(*commands)
 
 
-# get the which command
-sys.path.append(os.path.join(HOME, 'python'))
-from which import which
-
-
 # make a (correct) .hg/hgrc file for $HOME
 hgrc = """[paths]
 default = http://k0s.org/hg/config
@@ -65,20 +91,10 @@
 f.write(hgrc)
 f.close()
 
-def install_develop(package):
-    """install k0s.ware for development"""
+# get the which command
+sys.path.append(os.path.join(HOME, 'python'))
+from which import which
 
-    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] ]
-    execute(*commands)
-    old_directory = os.getcwd()
-    os.chdir(directory)
-    command = ['../../bin/python',  'setup.py', 'develop']
-    execute(command)
-    os.chdir(old_directory)
 
 # do git stuff
 git = which('git')