changeset 578:c16238544fca

move towards modern system
author Jeff Hammel <k0scist@gmail.com>
date Mon, 20 Jan 2014 16:35:03 -0800
parents 9b9b66c2c1fc
children f894bd779943
files python/install_config.py
diffstat 1 files changed, 19 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/python/install_config.py	Mon Jan 20 14:27:47 2014 -0800
+++ b/python/install_config.py	Mon Jan 20 16:35:03 2014 -0800
@@ -14,10 +14,7 @@
 
 # config repository
 SRC='http://k0s.org/hg/config'
-
-# go home
 HOME=os.environ['HOME']
-os.chdir(HOME)
 
 ### standalone functions
 
@@ -86,17 +83,17 @@
     ['hg', 'update', '-C'],
     ]
 
+os.chdir(HOME) # go home
+
 execute(*commands)
 
-
 # make a (correct) .hg/hgrc file for $HOME
 hgrc = """[paths]
 default = http://k0s.org/hg/config
 default-push = ssh://k0s.org/hg/config
 """
-f = file('.hg/hgrc', 'w')
-f.write(hgrc)
-f.close()
+with file(os.path.join(HOME, '.hg/hgrc', 'w')) as f:
+    f.write(hgrc)
 
 # get the which command
 sys.path.append(os.path.join(HOME, 'python'))
@@ -126,7 +123,9 @@
 else:
     print "git not installed"
 
-# - ubuntu packages to install:
+class UbuntuPackages(Step):
+    """ubuntu packages to install"""
+
 PACKAGES=["mercurial", "unison", "fluxbox", "antiword", "xclip",
           "graphviz", "python-dev", "python-lxml", "curl", "arandr",
           "git", "emacs", "irssi"]
@@ -140,12 +139,23 @@
 #   to have some base (e.g. .gkrellm2/user_config)
 
 def main(args=sys.argv[1:]):
+
+    # go home
+    os.chdir(HOME)
+
+    # parse command line
     usage = '%prog [options]'
     parser = optparse.OptionParser(usage=usage, description=__doc__)
+    parser.add_option('--deb', '--dpkg', '--debian-packages',
+                      dest='debian_packages',
+                      action='store_true', default=False,
+                      help="display debian packages to install")
     options, args = parser.parse_args()
-    return
 
+    # plan steps
     steps = [InitializeRepository]
+
+    # execute steps
     for step in steps:
         pass # TODO