yunlian | 8a3bdcb | 2013-02-19 20:42:48 +0000 | [diff] [blame] | 1 | #!/usr/bin/python |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 2 | # |
| 3 | # Copyright 2010 Google Inc. All Rights Reserved. |
| 4 | |
yunlian | 52a6c57 | 2013-02-19 20:42:07 +0000 | [diff] [blame] | 5 | """Script to lock/unlock machines.""" |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 6 | |
| 7 | __author__ = "asharif@google.com (Ahmad Sharif)" |
| 8 | |
| 9 | import datetime |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 10 | import fcntl |
asharif | da8e93b | 2013-02-15 22:49:27 +0000 | [diff] [blame] | 11 | import getpass |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 12 | import glob |
yunlian | 8a3bdcb | 2013-02-19 20:42:48 +0000 | [diff] [blame] | 13 | import json |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 14 | import optparse |
| 15 | import os |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 16 | import socket |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 17 | import sys |
| 18 | import time |
yunlian | 52a6c57 | 2013-02-19 20:42:07 +0000 | [diff] [blame] | 19 | |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 20 | from utils import logger |
| 21 | |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 22 | LOCK_SUFFIX = "_check_lock_liveness" |
| 23 | |
| 24 | |
| 25 | def FileCheckName(name): |
| 26 | return name + LOCK_SUFFIX |
| 27 | |
| 28 | |
| 29 | def OpenLiveCheck(file_name): |
| 30 | with FileCreationMask(0000): |
| 31 | fd = open(file_name, "a+w") |
| 32 | try: |
| 33 | fcntl.lockf(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) |
| 34 | except IOError: |
| 35 | raise |
| 36 | return fd |
| 37 | |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 38 | |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 39 | class FileCreationMask(object): |
| 40 | def __init__(self, mask): |
| 41 | self._mask = mask |
| 42 | |
| 43 | def __enter__(self): |
| 44 | self._old_mask = os.umask(self._mask) |
| 45 | |
| 46 | def __exit__(self, type, value, traceback): |
| 47 | os.umask(self._old_mask) |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 48 | |
| 49 | |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 50 | class LockDescription(object): |
yunlian | 8a3bdcb | 2013-02-19 20:42:48 +0000 | [diff] [blame] | 51 | """The description of the lock.""" |
| 52 | |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 53 | def __init__(self, desc=None): |
yunlian | 8a3bdcb | 2013-02-19 20:42:48 +0000 | [diff] [blame] | 54 | try: |
| 55 | self.owner = desc["owner"] |
| 56 | self.exclusive = desc["exclusive"] |
| 57 | self.counter = desc["counter"] |
| 58 | self.time = desc["time"] |
| 59 | self.reason = desc["reason"] |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 60 | self.auto = desc["auto"] |
yunlian | 8a3bdcb | 2013-02-19 20:42:48 +0000 | [diff] [blame] | 61 | except (KeyError, TypeError): |
| 62 | self.owner = "" |
| 63 | self.exclusive = False |
| 64 | self.counter = 0 |
| 65 | self.time = 0 |
| 66 | self.reason = "" |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 67 | self.auto = False |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 68 | |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 69 | def IsLocked(self): |
| 70 | return self.counter or self.exclusive |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 71 | |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 72 | def __str__(self): |
| 73 | return " ".join(["Owner: %s" % self.owner, |
| 74 | "Exclusive: %s" % self.exclusive, |
| 75 | "Counter: %s" % self.counter, |
| 76 | "Time: %s" % self.time, |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 77 | "Reason: %s" % self.reason, |
| 78 | "Auto: %s" % self.auto]) |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 79 | |
| 80 | |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 81 | class FileLock(object): |
yunlian | 8a3bdcb | 2013-02-19 20:42:48 +0000 | [diff] [blame] | 82 | """File lock operation class.""" |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 83 | FILE_OPS = [] |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 84 | |
| 85 | def __init__(self, lock_filename): |
yunlian | 52a6c57 | 2013-02-19 20:42:07 +0000 | [diff] [blame] | 86 | self._filepath = lock_filename |
| 87 | lock_dir = os.path.dirname(lock_filename) |
| 88 | assert os.path.isdir(lock_dir), ( |
| 89 | "Locks dir: %s doesn't exist!" % lock_dir) |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 90 | self._file = None |
| 91 | |
| 92 | @classmethod |
| 93 | def AsString(cls, file_locks): |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 94 | stringify_fmt = "%-30s %-15s %-4s %-4s %-15s %-40s %-4s" |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 95 | header = stringify_fmt % ("machine", "owner", "excl", "ctr", |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 96 | "elapsed", "reason", "auto") |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 97 | lock_strings = [] |
| 98 | for file_lock in file_locks: |
| 99 | |
| 100 | elapsed_time = datetime.timedelta( |
| 101 | seconds=int(time.time() - file_lock._description.time)) |
| 102 | elapsed_time = "%s ago" % elapsed_time |
| 103 | lock_strings.append(stringify_fmt % |
| 104 | (os.path.basename(file_lock._filepath), |
| 105 | file_lock._description.owner, |
| 106 | file_lock._description.exclusive, |
| 107 | file_lock._description.counter, |
| 108 | elapsed_time, |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 109 | file_lock._description.reason, |
| 110 | file_lock._description.auto)) |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 111 | table = "\n".join(lock_strings) |
| 112 | return "\n".join([header, table]) |
| 113 | |
| 114 | @classmethod |
yunlian | 52a6c57 | 2013-02-19 20:42:07 +0000 | [diff] [blame] | 115 | def ListLock(cls, pattern, locks_dir): |
| 116 | if not locks_dir: |
| 117 | locks_dir = Machine.LOCKS_DIR |
| 118 | full_pattern = os.path.join(locks_dir, pattern) |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 119 | file_locks = [] |
| 120 | for lock_filename in glob.glob(full_pattern): |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 121 | if LOCK_SUFFIX in lock_filename: |
| 122 | continue |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 123 | file_lock = FileLock(lock_filename) |
| 124 | with file_lock as lock: |
| 125 | if lock.IsLocked(): |
| 126 | file_locks.append(file_lock) |
| 127 | logger.GetLogger().LogOutput("\n%s" % cls.AsString(file_locks)) |
| 128 | |
| 129 | def __enter__(self): |
| 130 | with FileCreationMask(0000): |
| 131 | try: |
| 132 | self._file = open(self._filepath, "a+") |
| 133 | self._file.seek(0, os.SEEK_SET) |
| 134 | |
| 135 | if fcntl.flock(self._file.fileno(), fcntl.LOCK_EX) == -1: |
| 136 | raise IOError("flock(%s, LOCK_EX) failed!" % self._filepath) |
| 137 | |
| 138 | try: |
yunlian | 8a3bdcb | 2013-02-19 20:42:48 +0000 | [diff] [blame] | 139 | desc = json.load(self._file) |
| 140 | except (EOFError, ValueError): |
| 141 | desc = None |
| 142 | self._description = LockDescription(desc) |
| 143 | |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 144 | if self._description.exclusive and self._description.auto: |
| 145 | locked_byself = False |
| 146 | for fd in self.FILE_OPS: |
| 147 | if fd.name == FileCheckName(self._filepath): |
| 148 | locked_byself = True |
| 149 | break |
| 150 | if not locked_byself: |
| 151 | try: |
| 152 | fp = OpenLiveCheck(FileCheckName(self._filepath)) |
| 153 | except IOError: |
| 154 | pass |
| 155 | else: |
| 156 | self._description = LockDescription() |
| 157 | fcntl.lockf(fp, fcntl.LOCK_UN) |
| 158 | fp.close() |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 159 | return self._description |
| 160 | # Check this differently? |
| 161 | except IOError as ex: |
| 162 | logger.GetLogger().LogError(ex) |
| 163 | return None |
| 164 | |
| 165 | def __exit__(self, type, value, traceback): |
| 166 | self._file.truncate(0) |
yunlian | 8a3bdcb | 2013-02-19 20:42:48 +0000 | [diff] [blame] | 167 | self._file.write(json.dumps(self._description.__dict__, skipkeys=True)) |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 168 | self._file.close() |
| 169 | |
| 170 | def __str__(self): |
| 171 | return self.AsString([self]) |
| 172 | |
| 173 | |
| 174 | class Lock(object): |
yunlian | 77dc571 | 2013-02-19 21:13:33 +0000 | [diff] [blame] | 175 | def __init__(self, lock_file, auto=True): |
yunlian | 52a6c57 | 2013-02-19 20:42:07 +0000 | [diff] [blame] | 176 | self._to_lock = os.path.basename(lock_file) |
| 177 | self._lock_file = lock_file |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 178 | self._logger = logger.GetLogger() |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 179 | self._auto = auto |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 180 | |
| 181 | def NonBlockingLock(self, exclusive, reason=""): |
yunlian | 52a6c57 | 2013-02-19 20:42:07 +0000 | [diff] [blame] | 182 | with FileLock(self._lock_file) as lock: |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 183 | if lock.exclusive: |
| 184 | self._logger.LogError( |
| 185 | "Exclusive lock already acquired by %s. Reason: %s" % |
| 186 | (lock.owner, lock.reason)) |
| 187 | return False |
| 188 | |
| 189 | if exclusive: |
| 190 | if lock.counter: |
| 191 | self._logger.LogError("Shared lock already acquired") |
| 192 | return False |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 193 | lock_file_check = FileCheckName(self._lock_file) |
| 194 | fd = OpenLiveCheck(lock_file_check) |
| 195 | FileLock.FILE_OPS.append(fd) |
| 196 | |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 197 | lock.exclusive = True |
| 198 | lock.reason = reason |
asharif | da8e93b | 2013-02-15 22:49:27 +0000 | [diff] [blame] | 199 | lock.owner = getpass.getuser() |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 200 | lock.time = time.time() |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 201 | lock.auto = self._auto |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 202 | else: |
| 203 | lock.counter += 1 |
| 204 | self._logger.LogOutput("Successfully locked: %s" % self._to_lock) |
| 205 | return True |
| 206 | |
| 207 | def Unlock(self, exclusive, force=False): |
yunlian | 52a6c57 | 2013-02-19 20:42:07 +0000 | [diff] [blame] | 208 | with FileLock(self._lock_file) as lock: |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 209 | if not lock.IsLocked(): |
Caroline Tice | 570b2ce | 2013-08-07 12:46:30 -0700 | [diff] [blame^] | 210 | self._logger.LogWarning("Can't unlock unlocked machine!") |
| 211 | return True |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 212 | |
| 213 | if lock.exclusive != exclusive: |
| 214 | self._logger.LogError("shared locks must be unlocked with --shared") |
| 215 | return False |
| 216 | |
| 217 | if lock.exclusive: |
asharif | da8e93b | 2013-02-15 22:49:27 +0000 | [diff] [blame] | 218 | if lock.owner != getpass.getuser() and not force: |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 219 | self._logger.LogError("%s can't unlock lock owned by: %s" % |
asharif | da8e93b | 2013-02-15 22:49:27 +0000 | [diff] [blame] | 220 | (getpass.getuser(), lock.owner)) |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 221 | return False |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 222 | if lock.auto != self._auto: |
| 223 | self._logger.LogError("Can't unlock lock with different -a" |
| 224 | " parameter.") |
| 225 | return False |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 226 | lock.exclusive = False |
| 227 | lock.reason = "" |
| 228 | lock.owner = "" |
yunlian | b0eaee8 | 2013-02-19 21:13:28 +0000 | [diff] [blame] | 229 | |
| 230 | if self._auto: |
| 231 | del_list = [i for i in FileLock.FILE_OPS |
| 232 | if i.name == FileCheckName(self._lock_file)] |
| 233 | for i in del_list: |
| 234 | FileLock.FILE_OPS.remove(i) |
| 235 | for f in del_list: |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 236 | fcntl.lockf(f, fcntl.LOCK_UN) |
| 237 | f.close() |
yunlian | b0eaee8 | 2013-02-19 21:13:28 +0000 | [diff] [blame] | 238 | del del_list |
| 239 | os.remove(FileCheckName(self._lock_file)) |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 240 | |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 241 | else: |
| 242 | lock.counter -= 1 |
| 243 | return True |
| 244 | |
| 245 | |
| 246 | class Machine(object): |
yunlian | 52a6c57 | 2013-02-19 20:42:07 +0000 | [diff] [blame] | 247 | LOCKS_DIR = "/home/mobiletc-prebuild/locks" |
yunlian | 8a3bdcb | 2013-02-19 20:42:48 +0000 | [diff] [blame] | 248 | |
yunlian | 77dc571 | 2013-02-19 21:13:33 +0000 | [diff] [blame] | 249 | def __init__(self, name, locks_dir=LOCKS_DIR, auto=True): |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 250 | self._name = name |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 251 | self._auto = auto |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 252 | try: |
| 253 | self._full_name = socket.gethostbyaddr(name)[0] |
| 254 | except socket.error: |
| 255 | self._full_name = self._name |
yunlian | 52a6c57 | 2013-02-19 20:42:07 +0000 | [diff] [blame] | 256 | self._full_name = os.path.join(locks_dir, self._full_name) |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 257 | |
| 258 | def Lock(self, exclusive=False, reason=""): |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 259 | lock = Lock(self._full_name, self._auto) |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 260 | return lock.NonBlockingLock(exclusive, reason) |
| 261 | |
shenhan | e0a6d8a | 2013-02-19 20:42:29 +0000 | [diff] [blame] | 262 | def TryLock(self, timeout=300, exclusive=False, reason=""): |
| 263 | locked = False |
yunlian | 8a3bdcb | 2013-02-19 20:42:48 +0000 | [diff] [blame] | 264 | sleep = timeout / 10 |
shenhan | e0a6d8a | 2013-02-19 20:42:29 +0000 | [diff] [blame] | 265 | while True: |
| 266 | locked = self.Lock(exclusive, reason) |
| 267 | if locked or not timeout >= 0: |
| 268 | break |
| 269 | print "Lock not acquired for {0}, wait {1} seconds ...".format( |
yunlian | 8a3bdcb | 2013-02-19 20:42:48 +0000 | [diff] [blame] | 270 | self._name, sleep) |
shenhan | e0a6d8a | 2013-02-19 20:42:29 +0000 | [diff] [blame] | 271 | time.sleep(sleep) |
| 272 | timeout -= sleep |
| 273 | return locked |
| 274 | |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 275 | def Unlock(self, exclusive=False, ignore_ownership=False): |
yunlian | 8c9419b | 2013-02-19 21:11:29 +0000 | [diff] [blame] | 276 | lock = Lock(self._full_name, self._auto) |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 277 | return lock.Unlock(exclusive, ignore_ownership) |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 278 | |
| 279 | |
| 280 | def Main(argv): |
| 281 | """The main function.""" |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 282 | parser = optparse.OptionParser() |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 283 | parser.add_option("-r", |
| 284 | "--reason", |
| 285 | dest="reason", |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 286 | default="", |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 287 | help="The lock reason.") |
| 288 | parser.add_option("-u", |
| 289 | "--unlock", |
| 290 | dest="unlock", |
| 291 | action="store_true", |
| 292 | default=False, |
| 293 | help="Use this to unlock.") |
| 294 | parser.add_option("-l", |
| 295 | "--list_locks", |
| 296 | dest="list_locks", |
| 297 | action="store_true", |
| 298 | default=False, |
| 299 | help="Use this to list locks.") |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 300 | parser.add_option("-f", |
| 301 | "--ignore_ownership", |
| 302 | dest="ignore_ownership", |
| 303 | action="store_true", |
| 304 | default=False, |
| 305 | help="Use this to force unlock on a lock you don't own.") |
| 306 | parser.add_option("-s", |
| 307 | "--shared", |
| 308 | dest="shared", |
| 309 | action="store_true", |
| 310 | default=False, |
| 311 | help="Use this for a shared (non-exclusive) lock.") |
yunlian | 52a6c57 | 2013-02-19 20:42:07 +0000 | [diff] [blame] | 312 | parser.add_option("-d", |
| 313 | "--dir", |
| 314 | dest="locks_dir", |
| 315 | action="store", |
| 316 | default=Machine.LOCKS_DIR, |
| 317 | help="Use this to set different locks_dir") |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 318 | |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 319 | options, args = parser.parse_args(argv) |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 320 | |
yunlian | 52a6c57 | 2013-02-19 20:42:07 +0000 | [diff] [blame] | 321 | options.locks_dir = os.path.abspath(options.locks_dir) |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 322 | exclusive = not options.shared |
| 323 | |
| 324 | if not options.list_locks and len(args) != 2: |
| 325 | logger.GetLogger().LogError( |
| 326 | "Either --list_locks or a machine arg is needed.") |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 327 | return 1 |
| 328 | |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 329 | if len(args) > 1: |
yunlian | 77dc571 | 2013-02-19 21:13:33 +0000 | [diff] [blame] | 330 | machine = Machine(args[1], options.locks_dir, auto=False) |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 331 | else: |
| 332 | machine = None |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 333 | |
| 334 | if options.list_locks: |
yunlian | 52a6c57 | 2013-02-19 20:42:07 +0000 | [diff] [blame] | 335 | FileLock.ListLock("*", options.locks_dir) |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 336 | retval = True |
| 337 | elif options.unlock: |
| 338 | retval = machine.Unlock(exclusive, options.ignore_ownership) |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 339 | else: |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 340 | retval = machine.Lock(exclusive, options.reason) |
| 341 | |
| 342 | if retval: |
| 343 | return 0 |
| 344 | else: |
| 345 | return 1 |
asharif | b237bca | 2013-02-15 20:54:57 +0000 | [diff] [blame] | 346 | |
| 347 | if __name__ == "__main__": |
asharif | 455157b | 2013-02-15 21:15:05 +0000 | [diff] [blame] | 348 | sys.exit(Main(sys.argv)) |