Move things from module level to a main() function and add to gpaw command line tool

parent 55711af6
This diff is collapsed.
......@@ -17,7 +17,8 @@ functions = {'xc': 'gpaw.xc.xc',
'diag': 'gpaw.fulldiag.fulldiag',
'quick': 'gpaw.cli.quick.quick',
'dataset': 'gpaw.atom.generator2.main',
'symmetry': 'gpaw.symmetry.analyze_atoms'}
'symmetry': 'gpaw.symmetry.analyze_atoms',
'install-data': 'gpaw.cli.install_data.main'}
def main():
......@@ -46,7 +47,10 @@ def main():
parser1.print_help()
raise SystemExit
command = args1[0]
modulename, funcname = functions.get(command, command).rsplit('.', 1)
try:
modulename, funcname = functions[command].rsplit('.', 1)
except KeyError:
parser1.error('Unknown command: ' + command)
module = __import__(modulename, globals(), locals(), [funcname])
func = getattr(module, funcname)
kwargs = {}
......
......@@ -201,7 +201,7 @@ if hdf5:
extra_objects=extra_objects)
extensions.append(hdf5_extension)
files = ['gpaw-analyse-basis', 'gpaw-basis', 'gpaw-install-setups',
files = ['gpaw-analyse-basis', 'gpaw-basis',
'gpaw-mpisim', 'gpaw-plot-parallel-timings', 'gpaw-runscript',
'gpaw-setup', 'gpaw-test', 'gpaw-upfplot', 'gpaw']
scripts = [join('tools', script) for script in files]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment