Mercurial > hg > config
annotate python/install_config.py @ 598:e21c49e32b95
new
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Wed, 29 Jan 2014 13:30:13 -0800 |
parents | 4b79ee6c8539 |
children | fd50f457185c |
rev | line source |
---|---|
1 | 1 #!/usr/bin/env python |
234
761e7dfc675e
updates from most recent usage
Jeff Hammel <jhammel@mozilla.com>
parents:
219
diff
changeset
|
2 |
1 | 3 """ |
4 installs config to a user's home directory | |
5 this can be done with | |
16 | 6 curl http://k0s.org/hg/config/raw-file/tip/python/install_config.py | python |
1 | 7 """ |
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) |
591
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
14 # - scp k0s.org:~/web/sync.ini ~/.silvermirror |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
15 # - make idempotent |
595
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
16 # - step to install (and setup) firefox |
579
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
17 |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
18 # imports |
218 | 19 import imp |
408 | 20 import optparse |
1 | 21 import os |
131
52cf3e146a4c
make the install script slightly nicer
Jeff Hammel <jhammel@mozilla.com>
parents:
130
diff
changeset
|
22 import subprocess |
6 | 23 import sys |
131
52cf3e146a4c
make the install script slightly nicer
Jeff Hammel <jhammel@mozilla.com>
parents:
130
diff
changeset
|
24 |
579
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
25 # globals |
590
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
26 SRC = 'http://k0s.org/hg/config' # config repository |
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
27 HOME = os.environ['HOME'] # home directory |
1 | 28 |
591
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
29 |
410 | 30 ### standalone functions |
31 | |
591
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
32 def class_mapping(_type): |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
33 """returns a dict of (name, class) for objects in the current globals() of _type""" |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
34 return {name:cls for name, cls in globals().items() if cls.issubclass(_type)} |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
35 |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
36 |
590
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
37 def execute(*commands, **kwargs): |
131
52cf3e146a4c
make the install script slightly nicer
Jeff Hammel <jhammel@mozilla.com>
parents:
130
diff
changeset
|
38 """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
|
39 for command in commands: |
591
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
40 print (subprocess.list2cmdline(' '.join(command))) |
590
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
41 code = subprocess.call(command, **kwargs) |
591
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
42 if code: |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
43 raise subprocess.CalledProcessError(code, command) |
29
8344c7a9847c
install smartopen by default and some other cleanup (untested)
Jeff Hammel <k0scist@gmail.com>
parents:
22
diff
changeset
|
44 |
592
33b313fa1eb0
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
591
diff
changeset
|
45 |
410 | 46 def install_develop(package): |
47 """install k0s.ware for development""" | |
48 | |
49 src = 'http://k0s.org/hg/%s' % package | |
50 directory = '%s/src/%s' % (package, package) | |
590
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
51 commands = [['virtualenv/virtualenv.py', package], |
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
52 ['mkdir', '-p', directory ], |
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
53 ['hg', 'clone', src, directory] ] |
410 | 54 execute(*commands) |
55 old_directory = os.getcwd() | |
56 os.chdir(directory) | |
57 command = ['../../bin/python', 'setup.py', 'develop'] | |
58 execute(command) | |
59 os.chdir(old_directory) | |
60 | |
591
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
61 |
584 | 62 ### generic step framework |
410 | 63 |
592
33b313fa1eb0
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
591
diff
changeset
|
64 class StepGraph(object): |
33b313fa1eb0
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
591
diff
changeset
|
65 """a bunch of steps""" |
33b313fa1eb0
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
591
diff
changeset
|
66 |
408 | 67 class Step(object): |
68 @classmethod | |
69 def check(cls): | |
70 """checks if the step may be run""" | |
584 | 71 @classmethod |
72 def name(cls): | |
73 return cls.__name__ | |
74 __str__ = name | |
408 | 75 def __call__(self): |
76 execute(*self.commands) | |
77 | |
595
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
78 |
584 | 79 class Command(object): |
80 """require a command""" | |
81 | |
595
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
82 #@require(Virtualenv) |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
83 class InstallVirtualenv(Step): |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
84 """ABC for installing packages in a virtualenv""" |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
85 # TODO: move install_develop sctuff to here |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
86 |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
87 |
584 | 88 ### process steps |
89 | |
408 | 90 class InitializeRepository(Step): |
91 """make the home directory a repository""" | |
409 | 92 commands = [ |
93 ['hg', 'init'], | |
94 ['hg', 'pull', SRC], | |
95 ['hg', 'update', '-C'], | |
96 ] | |
577 | 97 @classmethod |
410 | 98 def write_hgrc(self): |
584 | 99 """make a (correct) .hg/hgrc file for $HOME""" |
100 | |
410 | 101 hgrc = """[paths] |
102 default = http://k0s.org/hg/config | |
103 default-push = ssh://k0s.org/hg/config | |
104 """ | |
577 | 105 with file('.hg/hgrc', 'w') as f: |
410 | 106 f.write(hgrc) |
595
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
107 |
410 | 108 def __call__(self): |
109 Step.__call__(self) | |
110 self.write_hgrc() | |
408 | 111 |
584 | 112 # get the which command |
113 sys.path.append(os.path.join(HOME, 'python')) | |
114 from which import which | |
579
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
115 |
411 | 116 #@requires(Command('git')) |
590
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
117 class ConfigureGit(Step): |
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
118 """configure git""" |
595
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
119 commands = [ |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
120 # setup git's global ignore, since git is silly about this |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
121 # and doesn't look for the file in the right place |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
122 ['git', 'config', '--global', 'core.excludesfile', os.path.join(HOME, '.gitignore')] |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
123 ] |
590
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
124 |
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
125 #@requires(Command('git')) |
584 | 126 class InstallVirtualenv(Step): |
127 commands = [['git', 'clone', 'https://github.com/pypa/virtualenv.git'], | |
590
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
128 ['ln', '-s', |
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
129 os.path.join(HOME, 'virtualenv/virtualenv.py'), |
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
130 os.path.join(HOME, 'bin', 'virtualenv.py')] |
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
131 ] |
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
132 |
595
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
133 class InstallKWare(In): |
590
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
134 """install k0s.ware""" |
595
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
135 # TODO |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
136 # from legacy |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
137 # # install some python |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
138 # install_develop('smartopen') |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
139 # install_develop('silvermirror') # XXX this won't actually work since python-dev isn't installed; install it first |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
140 |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
141 # postinstall_commands = [['ln', '-s', os.path.join(HOME, 'smartopen', 'bin', 'smartopen'), os.path.join(HOME, 'bin', 'smartopen') ], |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
142 # ['ln', '-s', os.path.join(HOME, 'silvermirror', 'bin', 'silvermirror'), os.path.join(HOME, 'bin', 'silvermirror') ], |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
143 # ] |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
144 # execute(*postinstall_commands) |
4b79ee6c8539
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
594
diff
changeset
|
145 |
577 | 146 |
582 | 147 class DebianPackages(Step): |
578 | 148 """ubuntu packages to install""" |
584 | 149 # TODO: actually install packages |
578 | 150 |
593
dbdc68d85986
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
592
diff
changeset
|
151 PACKAGES=["antiword", |
594
98ccb704e241
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
593
diff
changeset
|
152 "arandr", |
98ccb704e241
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
593
diff
changeset
|
153 "curl", |
98ccb704e241
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
593
diff
changeset
|
154 "emacs", |
593
dbdc68d85986
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
592
diff
changeset
|
155 "fluxbox", |
594
98ccb704e241
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
593
diff
changeset
|
156 "git", |
98ccb704e241
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
593
diff
changeset
|
157 "gkrellm", |
98ccb704e241
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
593
diff
changeset
|
158 "graphviz", |
98ccb704e241
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
593
diff
changeset
|
159 "graphviz-dev", |
98ccb704e241
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
593
diff
changeset
|
160 "irssi", |
593
dbdc68d85986
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
592
diff
changeset
|
161 "mercurial", |
594
98ccb704e241
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
593
diff
changeset
|
162 "python-dev", |
98ccb704e241
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
593
diff
changeset
|
163 "python-lxml", |
593
dbdc68d85986
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
592
diff
changeset
|
164 "libxml2" |
dbdc68d85986
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
592
diff
changeset
|
165 "libxml2-dev", |
dbdc68d85986
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
592
diff
changeset
|
166 "libxslt1-dev", |
579
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
167 "unison", |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
168 "xclip", |
594
98ccb704e241
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
593
diff
changeset
|
169 ] |
98ccb704e241
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
593
diff
changeset
|
170 |
579
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
171 def __call__(self): |
594
98ccb704e241
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
593
diff
changeset
|
172 # TODO: actually install this shit |
579
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
173 print "Ensure the following packages are installed:" |
582 | 174 print "sudo apt-get install %s" % ' '.join(self.PACKAGES) |
590
e93b81d8a586
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
584
diff
changeset
|
175 |
579
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
176 |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
177 ### legacy -v- |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
178 |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
179 def legacy(): |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
180 """legacy : TO DEPRECATE!""" |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
181 |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
182 # do git stuff |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
183 git = which('git') |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
184 if git: |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
185 |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
186 else: |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
187 print "git not installed" |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
188 |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
189 |
582 | 190 ### CLI |
416 | 191 |
408 | 192 def main(args=sys.argv[1:]): |
578 | 193 |
194 # go home | |
195 os.chdir(HOME) | |
196 | |
197 # parse command line | |
408 | 198 usage = '%prog [options]' |
199 parser = optparse.OptionParser(usage=usage, description=__doc__) | |
578 | 200 parser.add_option('--deb', '--dpkg', '--debian-packages', |
201 dest='debian_packages', | |
202 action='store_true', default=False, | |
203 help="display debian packages to install") | |
579
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
204 parser.add_option('-l', '--list', '--list-steps', |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
205 dest='list_steps', |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
206 action='store_true', default=False, |
580
b563a9c1f2b7
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
579
diff
changeset
|
207 help="list steps to be run and exit") |
591
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
208 parser.add_option('--all', dest='all', |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
209 action='store_true', default=False, |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
210 help="list all actions") |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
211 parser.add_option('--run', dest='run', |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
212 action='append', |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
213 help="run particular actions, in order") |
408 | 214 options, args = parser.parse_args() |
215 | |
578 | 216 # plan steps |
582 | 217 steps = [InitializeRepository, DebianPackages] |
579
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
218 if options.debian_packages: |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
219 steps = [DebianPackages] |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
220 |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
221 if options.list_steps: |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
222 # list steps if specified |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
223 for step in steps: |
584 | 224 print(step.name()) |
580
b563a9c1f2b7
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
579
diff
changeset
|
225 parser.exit() |
578 | 226 |
591
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
227 if options.all: |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
228 # list available steps |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
229 for sorted([]): |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
230 raise NotImplementedError("TODO") |
542d329835ec
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
590
diff
changeset
|
231 |
578 | 232 # execute steps |
409 | 233 for step in steps: |
579
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
234 instance = step() |
f894bd779943
STUB: python/install_config.py
Jeff Hammel <k0scist@gmail.com>
parents:
578
diff
changeset
|
235 instance() |
416 | 236 |
408 | 237 if __name__ == '__main__': |
238 main() |