]> scripts.mit.edu Git - wizard.git/blob - wizard/command/blacklist.py
36b2a9864ef19f4be057074fcfeb4a4195dc404a
[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     if not args:
12         reason = ""
13     else:
14         reason = args[0]
15     sh = shell.Shell()
16     if os.path.exists(".git/WIZARD_REPO"):
17         util.chdir(sh.eval('git', 'config', 'remote.origin.url'))
18     open('.scripts/blacklisted', 'w').write(reason + "\n")
19
20 def parse_args(argv, baton):
21     usage = """usage: %prog blacklist [ARGS] [REASON]
22
23 Touches .scripts/blacklisted so that we don't attempt
24 to upgrade the script in the future."""
25     parser = command.WizardOptionParser(usage)
26     options, args = parser.parse_all(argv)
27     if len(args) > 1:
28         parser.error("too many arguments")
29     return options, args
30