]> scripts.mit.edu Git - wizard.git/blob - wizard/command/blacklist.py
More bugfixes from running live.
[wizard.git] / wizard / command / blacklist.py
1 import logging
2 import os
3 import optparse
4 import sys
5 import distutils.version
6
7 from wizard import command, deploy, git, shell, util
8
9 def main(argv, baton):
10     options, args = parse_args(argv, baton)
11     reason = args[0]
12     sh = shell.Shell()
13     if os.path.exists(".git/WIZARD_REPO"):
14         util.chdir(sh.eval('git', 'config', 'remote.origin.url'))
15     open('.scripts/blacklisted', 'w').write(reason + "\n")
16
17 def parse_args(argv, baton):
18     usage = """usage: %prog blacklist [ARGS] REASON
19
20 Touches .scripts/blacklisted so that we don't attempt
21 to upgrade the script in the future."""
22     parser = command.WizardOptionParser(usage)
23     options, args = parser.parse_all(argv)
24     if len(args) > 2:
25         parser.error("too many arguments")
26     if len(args) < 1:
27         parser.error("must specify reason")
28     return options, args
29