4 # A script for turning a generic Ubuntu system into a master for
9 from Command
import CommandRunner
, Usage
25 'libreadline-gplv2-dev',
43 # additional packages that Bill Deegan's web page suggests
50 'python3-sphinx-rtd-theme',
54 DOCUMENTATION_PACKAGES
= [
80 'python3-line-profiler',
89 'texlive-extra-utils',
91 'texlive-latex-extra',
92 'texlive-bibtex-extra',
116 short_options
= 'hnqy'
117 long_options
= ['help', 'no-exec', 'password=', 'quiet', 'username=',
121 Usage: scons_dev_master.py [-hnqy] [--password PASSWORD] [--username USER]
124 ACTIONS (in default order):
125 upgrade Upgrade the system
126 checkout Check out SCons
127 building Install packages for building SCons
128 testing Install packages for testing SCons
129 scons-versions Install versions of SCons
130 python-versions Install versions of Python
133 buildbot Install packages for running BuildBot
136 scons_url
= 'https://github.com/SCons/scons.git'
144 opts
, args
= getopt
.getopt(argv
[1:], short_options
, long_options
)
145 except getopt
.error
as msg
:
149 if o
in ('-h', '--help'):
152 elif o
in ('-n', '--no-exec'):
153 CommandRunner
.execute
= CommandRunner
.do_not_execute
154 elif o
== '--password':
156 elif o
in ('-q', '--quiet'):
157 CommandRunner
.display
= CommandRunner
.do_not_display
158 elif o
== '--username':
160 elif o
in ('-y', '--yes', '--assume-yes'):
163 sys
.stderr
.write(str(err
.msg
) + '\n')
164 sys
.stderr
.write('use -h to get help\n')
170 initial_packages
= ' '.join(INITIAL_PACKAGES
)
171 install_packages
= ' '.join(INSTALL_PACKAGES
)
172 building_packages
= ' '.join(BUILDING_PACKAGES
)
173 testing_packages
= ' '.join(TESTING_PACKAGES
)
174 buildbot_packages
= ' '.join(BUILDBOT_PACKAGES
)
175 python_packages
= ' '.join(PYTHON_PACKAGES
)
176 doc_packages
= ' '.join(DOCUMENTATION_PACKAGES
)
178 cmd
= CommandRunner(locals())
182 cmd
.run('%(sudo)s apt-get %(yesflag)s upgrade')
183 elif arg
== 'checkout':
184 cmd
.run('%(sudo)s apt-get %(yesflag)s install %(initial_packages)s')
185 cmd
.run('git clone" %(scons_url)s')
186 elif arg
== 'building':
187 cmd
.run('%(sudo)s apt-get %(yesflag)s install %(building_packages)s')
189 cmd
.run('%(sudo)s apt-get %(yesflag)s install %(doc_packages)s')
190 elif arg
== 'testing':
191 cmd
.run('%(sudo)s apt-get %(yesflag)s install %(testing_packages)s')
192 #TODO: maybe copy ipkg-build from openwrt git
193 #cmd.run('%(sudo)s wget https://raw.githubusercontent.com/openwrt/openwrt/master/scripts/ipkg-build SOMEWHERE')
194 elif arg
== 'buildbot':
195 cmd
.run('%(sudo)s apt-get %(yesflag)s install %(buildbot_packages)s')
196 elif arg
== 'python-versions':
198 cmd
.run('%(sudo)s apt-get %(yesflag)s install %(install_packages)s')
199 install_packages
= None
200 cmd
.run('%(sudo)s apt-get %(yesflag)s install %(python_packages)s')
202 import install_python
204 msg
= 'Could not import install_python; skipping python-versions.\n'
205 sys
.stderr
.write(msg
)
207 install_python
.main(['install_python.py', '-a'])
208 elif arg
== 'scons-versions':
210 cmd
.run('%(sudo)s apt-get %(yesflag)s install %(install_packages)s')
211 install_packages
= None
215 msg
= 'Could not import install_scons; skipping scons-versions.\n'
216 sys
.stderr
.write(msg
)
218 install_scons
.main(['install_scons.py', '-a'])
220 msg
= '%s: unknown argument %s\n'
221 sys
.stderr
.write(msg
% (argv
[0], repr(arg
)))
224 if __name__
== "__main__":
229 # indent-tabs-mode:nil
231 # vim: set expandtab tabstop=4 shiftwidth=4: