@@ -0,0 +1,1527 @@
+#!/usr/bin/env python%0A# coding=UTF-8%0A%0Aimport os%0Afrom os.path import dirname, join, normpath, realpath%0Aimport sys%0A%0Ascript_directory = dirname(realpath(sys.argv%5B0%5D))%0Aroot_directory = join(script_directory, '..')%0Aroot_directory = normpath(root_directory)%0A%0Aelection_options = %5B%0A    e for e in os.listdir(join(root_directory, 'elections'))%0A    if not e.startswith('__init__.py')%0A%5D%0A%0Adef usage_and_exit():%0A    print %3E%3E sys.stderr, %22Usage: %25s %3CELECTION%3E%22 %25 (sys.argv%5B0%5D,)%0A    print %3E%3E sys.stderr, %22... where %3CELECTION%3E is one of:%22%0A    for election in election_options:%0A        print %3E%3E sys.stderr, %22  %22, election%0A    sys.exit(1)%0Aif len(sys.argv) != 2:%0A    usage_and_exit()%0A%0Arequested = sys.argv%5B1%5D%0A%0Aif requested not in election_options:%0A    usage_and_exit()%0A%0Ageneral_yml_symlink = os.path.join(root_directory, 'conf', 'general.yml')%0Ageneral_yml_target = 'general-' + requested + '.yml'%0A%0Adef switch_link(symlink_filename, target_filename):%0A    if not os.path.islink(symlink_filename):%0A        print %3E%3E sys.stderr, %22%25s was not a symlink, and should be%22 %25 (symlink_filename,)%0A        sys.exit(1)%0A    full_target_filename = os.path.join(os.path.dirname(symlink_filename),%0A                                        target_filename)%0A    if not os.path.exists(full_target_filename):%0A        print %3E%3E sys.stderr, %22The intended target of the symlink (%25s) didn't exist%22 %25 (target_filename,)%0A        sys.exit(1)%0A    os.unlink(symlink_filename)%0A    os.symlink(target_filename, symlink_filename)%0A%0Aswitch_link(general_yml_symlink, general_yml_target)%0A

Add a script to make it easier to switch between elections