annotate python/install_config.py @ 584:ed99a36df540

wip
author Jeff Hammel <k0scist@gmail.com>
date Wed, 22 Jan 2014 20:17:12 -0800
parents 0295141d9eeb
children e93b81d8a586
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env python
234
761e7dfc675e updates from most recent usage
Jeff Hammel <jhammel@mozilla.com>
parents: 219
diff changeset
2
1
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
3 """
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
4 installs config to a user's home directory
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
5 this can be done with
16
57298ea7a7f1 fix string for how to install
k0s <k0scist@gmail.com>
parents: 14
diff changeset
6 curl http://k0s.org/hg/config/raw-file/tip/python/install_config.py | python
1
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
7 """
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
8
579
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
9 # TODO:
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
10 # - dl and get ~/web/sync.ini :
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
11 # ln -s /home/jhammel/web/sync.ini /home/jhammel/.silvermirror
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
12 # - handle cases where config is autogenerated BUT you still want
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
13 # to have some base (e.g. .gkrellm2/user_config)
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
14
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
15 # imports
218
e4221e45d6c1 update install script
Jeff Hammel <jhammel@mozilla.com>
parents: 174
diff changeset
16 import imp
408
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
17 import optparse
1
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
18 import os
131
52cf3e146a4c make the install script slightly nicer
Jeff Hammel <jhammel@mozilla.com>
parents: 130
diff changeset
19 import subprocess
6
524f9e7fa224 be backwards compatible
k0s <k0scist@gmail.com>
parents: 1
diff changeset
20 import sys
131
52cf3e146a4c make the install script slightly nicer
Jeff Hammel <jhammel@mozilla.com>
parents: 130
diff changeset
21
579
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
22 # globals
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
23 SRC='http://k0s.org/hg/config' # config repository
14
ac34d580c6d7 make symbolic links when necessary (should generalize)
k0s <k0scist@gmail.com>
parents: 7
diff changeset
24 HOME=os.environ['HOME']
1
f58e8e81e16b adding program to install config
k0s <k0scist@gmail.com>
parents:
diff changeset
25
410
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
26 ### standalone functions
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
27
29
8344c7a9847c install smartopen by default and some other cleanup (untested)
Jeff Hammel <k0scist@gmail.com>
parents: 22
diff changeset
28 def execute(*commands):
131
52cf3e146a4c make the install script slightly nicer
Jeff Hammel <jhammel@mozilla.com>
parents: 130
diff changeset
29 """execute a series of commands"""
29
8344c7a9847c install smartopen by default and some other cleanup (untested)
Jeff Hammel <k0scist@gmail.com>
parents: 22
diff changeset
30 for command in commands:
8344c7a9847c install smartopen by default and some other cleanup (untested)
Jeff Hammel <k0scist@gmail.com>
parents: 22
diff changeset
31 print ' '.join(command)
8344c7a9847c install smartopen by default and some other cleanup (untested)
Jeff Hammel <k0scist@gmail.com>
parents: 22
diff changeset
32 code = subprocess.call(command)
8344c7a9847c install smartopen by default and some other cleanup (untested)
Jeff Hammel <k0scist@gmail.com>
parents: 22
diff changeset
33 if code:
8344c7a9847c install smartopen by default and some other cleanup (untested)
Jeff Hammel <k0scist@gmail.com>
parents: 22
diff changeset
34 sys.exit(code)
8344c7a9847c install smartopen by default and some other cleanup (untested)
Jeff Hammel <k0scist@gmail.com>
parents: 22
diff changeset
35
410
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
36 def install_develop(package):
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
37 """install k0s.ware for development"""
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
38
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
39 src = 'http://k0s.org/hg/%s' % package
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
40 directory = '%s/src/%s' % (package, package)
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
41 commands = [ ['virtualenv/virtualenv.py', package],
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
42 ['mkdir', '-p', directory ],
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
43 ['hg', 'clone', src, directory] ]
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
44 execute(*commands)
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
45 old_directory = os.getcwd()
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
46 os.chdir(directory)
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
47 command = ['../../bin/python', 'setup.py', 'develop']
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
48 execute(command)
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
49 os.chdir(old_directory)
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
50
584
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
51 ### generic step framework
410
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
52
408
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
53 class Step(object):
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
54 @classmethod
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
55 def check(cls):
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
56 """checks if the step may be run"""
584
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
57 @classmethod
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
58 def name(cls):
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
59 return cls.__name__
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
60 __str__ = name
408
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
61 def __call__(self):
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
62 execute(*self.commands)
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
63
584
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
64 class Command(object):
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
65 """require a command"""
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
66
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
67 ### process steps
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
68
408
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
69 class InitializeRepository(Step):
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
70 """make the home directory a repository"""
409
dc64beded724 pt deux and such
Jeff Hammel <jhammel@mozilla.com>
parents: 408
diff changeset
71 commands = [
dc64beded724 pt deux and such
Jeff Hammel <jhammel@mozilla.com>
parents: 408
diff changeset
72 ['hg', 'init'],
dc64beded724 pt deux and such
Jeff Hammel <jhammel@mozilla.com>
parents: 408
diff changeset
73 ['hg', 'pull', SRC],
dc64beded724 pt deux and such
Jeff Hammel <jhammel@mozilla.com>
parents: 408
diff changeset
74 ['hg', 'update', '-C'],
dc64beded724 pt deux and such
Jeff Hammel <jhammel@mozilla.com>
parents: 408
diff changeset
75 ]
577
Jeff Hammel <k0scist@gmail.com>
parents: 427
diff changeset
76 @classmethod
410
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
77 def write_hgrc(self):
584
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
78 """make a (correct) .hg/hgrc file for $HOME"""
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
79
410
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
80 hgrc = """[paths]
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
81 default = http://k0s.org/hg/config
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
82 default-push = ssh://k0s.org/hg/config
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
83 """
577
Jeff Hammel <k0scist@gmail.com>
parents: 427
diff changeset
84 with file('.hg/hgrc', 'w') as f:
410
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
85 f.write(hgrc)
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
86 def __call__(self):
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
87 Step.__call__(self)
ffa08f0de165 fix a thing
Jeff Hammel <jhammel@mozilla.com>
parents: 409
diff changeset
88 self.write_hgrc()
408
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
89
584
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
90 # get the which command
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
91 sys.path.append(os.path.join(HOME, 'python'))
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
92 from which import which
579
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
93
411
Jeff Hammel <jhammel@mozilla.com>
parents: 410
diff changeset
94 #@requires(Command('git'))
584
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
95 class InstallVirtualenv(Step):
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
96 commands = [['git', 'clone', 'https://github.com/pypa/virtualenv.git'],
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
97 ['ln', '-s',
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
98 os.path.join(HOME, 'virtualenv/virtualenv.py'),
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
99 os.path.join(HOME, 'bin/')]
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
100 ]
577
Jeff Hammel <k0scist@gmail.com>
parents: 427
diff changeset
101
582
Jeff Hammel <k0scist@gmail.com>
parents: 580
diff changeset
102 class DebianPackages(Step):
578
c16238544fca move towards modern system
Jeff Hammel <k0scist@gmail.com>
parents: 577
diff changeset
103 """ubuntu packages to install"""
584
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
104 # TODO: actually install packages
578
c16238544fca move towards modern system
Jeff Hammel <k0scist@gmail.com>
parents: 577
diff changeset
105
579
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
106 PACKAGES=["mercurial",
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
107 "unison",
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
108 "fluxbox",
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
109 "antiword",
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
110 "xclip",
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
111 "graphviz",
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
112 "python-dev",
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
113 "python-lxml",
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
114 "curl",
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
115 "arandr",
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
116 "git",
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
117 "emacs",
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
118 "irssi"]
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
119 def __call__(self):
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
120 print "Ensure the following packages are installed:"
582
Jeff Hammel <k0scist@gmail.com>
parents: 580
diff changeset
121 print "sudo apt-get install %s" % ' '.join(self.PACKAGES)
584
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
122
579
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
123
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
124 ### legacy -v-
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
125
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
126 def legacy():
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
127 """legacy : TO DEPRECATE!"""
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
128
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
129 # do git stuff
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
130 git = which('git')
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
131 if git:
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
132
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
133 # get virtual env
584
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
134 virtualenv_
579
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
135 execute(*virtualenv_commands)
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
136
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
137 # setup git's global ignore, since git is silly about this
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
138 # and doesn't look for the file in the right place
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
139 execute(['git', 'config', '--global', 'core.excludesfile', os.path.join(HOME, '.gitignore')])
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
140
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
141 # install some python
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
142 install_develop('smartopen')
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
143 install_develop('silvermirror') # XXX this won't actually work since python-dev isn't installed; install it first
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
144
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
145 postinstall_commands = [['ln', '-s', os.path.join(HOME, 'smartopen', 'bin', 'smartopen'), os.path.join(HOME, 'bin', 'smartopen') ],
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
146 ['ln', '-s', os.path.join(HOME, 'silvermirror', 'bin', 'silvermirror'), os.path.join(HOME, 'bin', 'silvermirror') ],
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
147 ]
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
148 execute(*postinstall_commands)
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
149 else:
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
150 print "git not installed"
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
151
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
152
582
Jeff Hammel <k0scist@gmail.com>
parents: 580
diff changeset
153 ### CLI
416
Jeff Hammel <jhammel@mozilla.com>
parents: 411
diff changeset
154
408
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
155 def main(args=sys.argv[1:]):
578
c16238544fca move towards modern system
Jeff Hammel <k0scist@gmail.com>
parents: 577
diff changeset
156
c16238544fca move towards modern system
Jeff Hammel <k0scist@gmail.com>
parents: 577
diff changeset
157 # go home
c16238544fca move towards modern system
Jeff Hammel <k0scist@gmail.com>
parents: 577
diff changeset
158 os.chdir(HOME)
c16238544fca move towards modern system
Jeff Hammel <k0scist@gmail.com>
parents: 577
diff changeset
159
c16238544fca move towards modern system
Jeff Hammel <k0scist@gmail.com>
parents: 577
diff changeset
160 # parse command line
408
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
161 usage = '%prog [options]'
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
162 parser = optparse.OptionParser(usage=usage, description=__doc__)
578
c16238544fca move towards modern system
Jeff Hammel <k0scist@gmail.com>
parents: 577
diff changeset
163 parser.add_option('--deb', '--dpkg', '--debian-packages',
c16238544fca move towards modern system
Jeff Hammel <k0scist@gmail.com>
parents: 577
diff changeset
164 dest='debian_packages',
c16238544fca move towards modern system
Jeff Hammel <k0scist@gmail.com>
parents: 577
diff changeset
165 action='store_true', default=False,
c16238544fca move towards modern system
Jeff Hammel <k0scist@gmail.com>
parents: 577
diff changeset
166 help="display debian packages to install")
579
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
167 parser.add_option('-l', '--list', '--list-steps',
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
168 dest='list_steps',
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
169 action='store_true', default=False,
580
b563a9c1f2b7 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 579
diff changeset
170 help="list steps to be run and exit")
408
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
171 options, args = parser.parse_args()
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
172
578
c16238544fca move towards modern system
Jeff Hammel <k0scist@gmail.com>
parents: 577
diff changeset
173 # plan steps
582
Jeff Hammel <k0scist@gmail.com>
parents: 580
diff changeset
174 steps = [InitializeRepository, DebianPackages]
579
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
175 if options.debian_packages:
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
176 steps = [DebianPackages]
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
177
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
178 if options.list_steps:
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
179 # list steps if specified
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
180 for step in steps:
584
Jeff Hammel <k0scist@gmail.com>
parents: 582
diff changeset
181 print(step.name())
580
b563a9c1f2b7 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 579
diff changeset
182 parser.exit()
578
c16238544fca move towards modern system
Jeff Hammel <k0scist@gmail.com>
parents: 577
diff changeset
183
c16238544fca move towards modern system
Jeff Hammel <k0scist@gmail.com>
parents: 577
diff changeset
184 # execute steps
409
dc64beded724 pt deux and such
Jeff Hammel <jhammel@mozilla.com>
parents: 408
diff changeset
185 for step in steps:
579
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
186 instance = step()
f894bd779943 STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents: 578
diff changeset
187 instance()
416
Jeff Hammel <jhammel@mozilla.com>
parents: 411
diff changeset
188
408
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
189 if __name__ == '__main__':
705dc5cfd68d make this modular
Jeff Hammel <jhammel@mozilla.com>
parents: 268
diff changeset
190 main()