blob: eca776b5a4c40a574d17985cf07c8475cfa1cd9b [file] [log] [blame]
mblighfa29a2a2008-05-16 22:48:09 +00001#!/usr/bin/python -u
mblighe8819cd2008-02-15 16:48:40 +00002
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -08003import os, sys, re, tempfile
mblighb090f142008-02-27 21:33:46 +00004from optparse import OptionParser
mbligh9b907d62008-05-13 17:56:24 +00005import common
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -08006from autotest_lib.client.common_lib import utils
showard0e73c852008-10-03 10:15:50 +00007from autotest_lib.database import database_connection
mblighe8819cd2008-02-15 16:48:40 +00008
9MIGRATE_TABLE = 'migrate_info'
showard50c0e712008-09-22 16:20:37 +000010
11_AUTODIR = os.path.join(os.path.dirname(__file__), '..')
12_MIGRATIONS_DIRS = {
13 'AUTOTEST_WEB' : os.path.join(_AUTODIR, 'frontend', 'migrations'),
14 'TKO' : os.path.join(_AUTODIR, 'tko', 'migrations'),
15}
16_DEFAULT_MIGRATIONS_DIR = 'migrations' # use CWD
mblighe8819cd2008-02-15 16:48:40 +000017
mblighe8819cd2008-02-15 16:48:40 +000018class Migration(object):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -080019 """Represents a database migration."""
showardeca1f212009-05-13 20:28:12 +000020 _UP_ATTRIBUTES = ('migrate_up', 'UP_SQL')
21 _DOWN_ATTRIBUTES = ('migrate_down', 'DOWN_SQL')
22
23 def __init__(self, name, version, module):
24 self.name = name
25 self.version = version
26 self.module = module
27 self._check_attributes(self._UP_ATTRIBUTES)
28 self._check_attributes(self._DOWN_ATTRIBUTES)
29
30
31 @classmethod
32 def from_file(cls, filename):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -080033 """Instantiates a Migration from a file.
34
35 @param filename: Name of a migration file.
36
37 @return An instantiated Migration object.
38
39 """
showardeca1f212009-05-13 20:28:12 +000040 version = int(filename[:3])
41 name = filename[:-3]
42 module = __import__(name, globals(), locals(), [])
43 return cls(name, version, module)
44
45
46 def _check_attributes(self, attributes):
47 method_name, sql_name = attributes
48 assert (hasattr(self.module, method_name) or
49 hasattr(self.module, sql_name))
50
51
52 def _execute_migration(self, attributes, manager):
53 method_name, sql_name = attributes
54 method = getattr(self.module, method_name, None)
55 if method:
56 assert callable(method)
57 method(manager)
58 else:
59 sql = getattr(self.module, sql_name)
60 assert isinstance(sql, basestring)
61 manager.execute_script(sql)
showarddecbe502008-03-28 16:31:10 +000062
63
jadmanski0afbb632008-06-06 21:10:57 +000064 def migrate_up(self, manager):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -080065 """Performs an up migration (to a newer version).
66
67 @param manager: A MigrationManager object.
68
69 """
showardeca1f212009-05-13 20:28:12 +000070 self._execute_migration(self._UP_ATTRIBUTES, manager)
showarddecbe502008-03-28 16:31:10 +000071
72
jadmanski0afbb632008-06-06 21:10:57 +000073 def migrate_down(self, manager):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -080074 """Performs a down migration (to an older version).
75
76 @param manager: A MigrationManager object.
77
78 """
showardeca1f212009-05-13 20:28:12 +000079 self._execute_migration(self._DOWN_ATTRIBUTES, manager)
mblighe8819cd2008-02-15 16:48:40 +000080
81
82class MigrationManager(object):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -080083 """Managest database migrations."""
jadmanski0afbb632008-06-06 21:10:57 +000084 connection = None
85 cursor = None
86 migrations_dir = None
mblighe8819cd2008-02-15 16:48:40 +000087
showard0e73c852008-10-03 10:15:50 +000088 def __init__(self, database_connection, migrations_dir=None, force=False):
89 self._database = database_connection
showard50c0e712008-09-22 16:20:37 +000090 self.force = force
showard12454c62010-01-15 19:15:14 +000091 # A boolean, this will only be set to True if this migration should be
92 # simulated rather than actually taken. For use with migrations that
93 # may make destructive queries
94 self.simulate = False
showard0e73c852008-10-03 10:15:50 +000095 self._set_migrations_dir(migrations_dir)
96
97
98 def _set_migrations_dir(self, migrations_dir=None):
jamesren92afa562010-03-23 00:19:26 +000099 config_section = self._config_section()
jadmanski0afbb632008-06-06 21:10:57 +0000100 if migrations_dir is None:
showard50c0e712008-09-22 16:20:37 +0000101 migrations_dir = os.path.abspath(
showard0e73c852008-10-03 10:15:50 +0000102 _MIGRATIONS_DIRS.get(config_section, _DEFAULT_MIGRATIONS_DIR))
jadmanski0afbb632008-06-06 21:10:57 +0000103 self.migrations_dir = migrations_dir
104 sys.path.append(migrations_dir)
showard0e73c852008-10-03 10:15:50 +0000105 assert os.path.exists(migrations_dir), migrations_dir + " doesn't exist"
mblighe8819cd2008-02-15 16:48:40 +0000106
107
jamesren92afa562010-03-23 00:19:26 +0000108 def _config_section(self):
109 return self._database.global_config_section
110
111
showardeab66ce2009-12-23 00:03:56 +0000112 def get_db_name(self):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800113 """Gets the database name."""
showard0e73c852008-10-03 10:15:50 +0000114 return self._database.get_database_info()['db_name']
mblighe8819cd2008-02-15 16:48:40 +0000115
116
jadmanski0afbb632008-06-06 21:10:57 +0000117 def execute(self, query, *parameters):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800118 """Executes a database query.
119
120 @param query: The query to execute.
121 @param parameters: Associated parameters for the query.
122
123 @return The result of the query.
124
125 """
showard0e73c852008-10-03 10:15:50 +0000126 return self._database.execute(query, parameters)
mblighe8819cd2008-02-15 16:48:40 +0000127
128
jadmanski0afbb632008-06-06 21:10:57 +0000129 def execute_script(self, script):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800130 """Executes a set of database queries.
131
132 @param script: A string of semicolon-separated queries.
133
134 """
showardb1e51872008-10-07 11:08:18 +0000135 sql_statements = [statement.strip()
136 for statement in script.split(';')
137 if statement.strip()]
jadmanski0afbb632008-06-06 21:10:57 +0000138 for statement in sql_statements:
showardb1e51872008-10-07 11:08:18 +0000139 self.execute(statement)
mblighe8819cd2008-02-15 16:48:40 +0000140
141
jadmanski0afbb632008-06-06 21:10:57 +0000142 def check_migrate_table_exists(self):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800143 """Checks whether the migration table exists."""
jadmanski0afbb632008-06-06 21:10:57 +0000144 try:
145 self.execute("SELECT * FROM %s" % MIGRATE_TABLE)
146 return True
showard0e73c852008-10-03 10:15:50 +0000147 except self._database.DatabaseError, exc:
148 # we can't check for more specifics due to differences between DB
149 # backends (we can't even check for a subclass of DatabaseError)
150 return False
mblighe8819cd2008-02-15 16:48:40 +0000151
152
jadmanski0afbb632008-06-06 21:10:57 +0000153 def create_migrate_table(self):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800154 """Creates the migration table."""
jadmanski0afbb632008-06-06 21:10:57 +0000155 if not self.check_migrate_table_exists():
156 self.execute("CREATE TABLE %s (`version` integer)" %
157 MIGRATE_TABLE)
158 else:
159 self.execute("DELETE FROM %s" % MIGRATE_TABLE)
160 self.execute("INSERT INTO %s VALUES (0)" % MIGRATE_TABLE)
showard0e73c852008-10-03 10:15:50 +0000161 assert self._database.rowcount == 1
mblighe8819cd2008-02-15 16:48:40 +0000162
163
jadmanski0afbb632008-06-06 21:10:57 +0000164 def set_db_version(self, version):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800165 """Sets the database version.
166
167 @param version: The version to which to set the database.
168
169 """
jadmanski0afbb632008-06-06 21:10:57 +0000170 assert isinstance(version, int)
171 self.execute("UPDATE %s SET version=%%s" % MIGRATE_TABLE,
172 version)
showard0e73c852008-10-03 10:15:50 +0000173 assert self._database.rowcount == 1
mblighe8819cd2008-02-15 16:48:40 +0000174
175
jadmanski0afbb632008-06-06 21:10:57 +0000176 def get_db_version(self):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800177 """Gets the database version.
178
179 @return The database version.
180
181 """
jadmanski0afbb632008-06-06 21:10:57 +0000182 if not self.check_migrate_table_exists():
183 return 0
showard0e73c852008-10-03 10:15:50 +0000184 rows = self.execute("SELECT * FROM %s" % MIGRATE_TABLE)
jadmanski0afbb632008-06-06 21:10:57 +0000185 if len(rows) == 0:
186 return 0
187 assert len(rows) == 1 and len(rows[0]) == 1
188 return rows[0][0]
mblighe8819cd2008-02-15 16:48:40 +0000189
190
jadmanski0afbb632008-06-06 21:10:57 +0000191 def get_migrations(self, minimum_version=None, maximum_version=None):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800192 """Gets the list of migrations to perform.
193
194 @param minimum_version: The minimum database version.
195 @param maximum_version: The maximum database version.
196
197 @return A list of Migration objects.
198
199 """
jadmanski0afbb632008-06-06 21:10:57 +0000200 migrate_files = [filename for filename
201 in os.listdir(self.migrations_dir)
202 if re.match(r'^\d\d\d_.*\.py$', filename)]
203 migrate_files.sort()
showardeca1f212009-05-13 20:28:12 +0000204 migrations = [Migration.from_file(filename)
205 for filename in migrate_files]
jadmanski0afbb632008-06-06 21:10:57 +0000206 if minimum_version is not None:
207 migrations = [migration for migration in migrations
208 if migration.version >= minimum_version]
209 if maximum_version is not None:
210 migrations = [migration for migration in migrations
211 if migration.version <= maximum_version]
212 return migrations
mblighe8819cd2008-02-15 16:48:40 +0000213
214
jadmanski0afbb632008-06-06 21:10:57 +0000215 def do_migration(self, migration, migrate_up=True):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800216 """Performs a migration.
217
218 @param migration: The Migration to perform.
219 @param migrate_up: Whether to migrate up (if not, then migrates down).
220
221 """
jadmanski0afbb632008-06-06 21:10:57 +0000222 print 'Applying migration %s' % migration.name, # no newline
223 if migrate_up:
224 print 'up'
225 assert self.get_db_version() == migration.version - 1
226 migration.migrate_up(self)
227 new_version = migration.version
228 else:
229 print 'down'
230 assert self.get_db_version() == migration.version
231 migration.migrate_down(self)
232 new_version = migration.version - 1
233 self.set_db_version(new_version)
mblighe8819cd2008-02-15 16:48:40 +0000234
235
jadmanski0afbb632008-06-06 21:10:57 +0000236 def migrate_to_version(self, version):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800237 """Performs a migration to a specified version.
238
239 @param version: The version to which to migrate the database.
240
241 """
jadmanski0afbb632008-06-06 21:10:57 +0000242 current_version = self.get_db_version()
jamesren92afa562010-03-23 00:19:26 +0000243 if current_version == 0 and self._config_section() == 'AUTOTEST_WEB':
244 self._migrate_from_base()
245 current_version = self.get_db_version()
246
jadmanski0afbb632008-06-06 21:10:57 +0000247 if current_version < version:
248 lower, upper = current_version, version
249 migrate_up = True
250 else:
251 lower, upper = version, current_version
252 migrate_up = False
mblighe8819cd2008-02-15 16:48:40 +0000253
jadmanski0afbb632008-06-06 21:10:57 +0000254 migrations = self.get_migrations(lower + 1, upper)
255 if not migrate_up:
256 migrations.reverse()
257 for migration in migrations:
258 self.do_migration(migration, migrate_up)
mblighe8819cd2008-02-15 16:48:40 +0000259
jadmanski0afbb632008-06-06 21:10:57 +0000260 assert self.get_db_version() == version
261 print 'At version', version
mblighe8819cd2008-02-15 16:48:40 +0000262
263
jamesren92afa562010-03-23 00:19:26 +0000264 def _migrate_from_base(self):
265 self.confirm_initialization()
266
267 migration_script = utils.read_file(
268 os.path.join(os.path.dirname(__file__), 'schema_051.sql'))
jamesrenef692982010-04-05 18:14:07 +0000269 migration_script = migration_script % (
270 dict(username=self._database.get_database_info()['username']))
jamesren92afa562010-03-23 00:19:26 +0000271 self.execute_script(migration_script)
272
273 self.create_migrate_table()
274 self.set_db_version(51)
275
276
277 def confirm_initialization(self):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800278 """Confirms with the user that we should initialize the database.
279
280 @raises Exception, if the user chooses to abort the migration.
281
282 """
jamesren92afa562010-03-23 00:19:26 +0000283 if not self.force:
284 response = raw_input(
285 'Your %s database does not appear to be initialized. Do you '
286 'want to recreate it (this will result in loss of any existing '
287 'data) (yes/No)? ' % self.get_db_name())
288 if response != 'yes':
289 raise Exception('User has chosen to abort migration')
290
291
jadmanski0afbb632008-06-06 21:10:57 +0000292 def get_latest_version(self):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800293 """Gets the latest database version."""
jadmanski0afbb632008-06-06 21:10:57 +0000294 migrations = self.get_migrations()
295 return migrations[-1].version
showardd2d4e2c2008-03-12 21:32:46 +0000296
297
jadmanski0afbb632008-06-06 21:10:57 +0000298 def migrate_to_latest(self):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800299 """Migrates the database to the latest version."""
jadmanski0afbb632008-06-06 21:10:57 +0000300 latest_version = self.get_latest_version()
301 self.migrate_to_version(latest_version)
mblighe8819cd2008-02-15 16:48:40 +0000302
303
jadmanski0afbb632008-06-06 21:10:57 +0000304 def initialize_test_db(self):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800305 """Initializes a test database."""
showardeab66ce2009-12-23 00:03:56 +0000306 db_name = self.get_db_name()
showard0e73c852008-10-03 10:15:50 +0000307 test_db_name = 'test_' + db_name
jadmanski0afbb632008-06-06 21:10:57 +0000308 # first, connect to no DB so we can create a test DB
showard0e73c852008-10-03 10:15:50 +0000309 self._database.connect(db_name='')
jadmanski0afbb632008-06-06 21:10:57 +0000310 print 'Creating test DB', test_db_name
311 self.execute('CREATE DATABASE ' + test_db_name)
showard0e73c852008-10-03 10:15:50 +0000312 self._database.disconnect()
jadmanski0afbb632008-06-06 21:10:57 +0000313 # now connect to the test DB
showard0e73c852008-10-03 10:15:50 +0000314 self._database.connect(db_name=test_db_name)
mblighe8819cd2008-02-15 16:48:40 +0000315
316
jadmanski0afbb632008-06-06 21:10:57 +0000317 def remove_test_db(self):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800318 """Removes a test database."""
jadmanski0afbb632008-06-06 21:10:57 +0000319 print 'Removing test DB'
showardeab66ce2009-12-23 00:03:56 +0000320 self.execute('DROP DATABASE ' + self.get_db_name())
showard0e73c852008-10-03 10:15:50 +0000321 # reset connection back to real DB
322 self._database.disconnect()
323 self._database.connect()
mblighe8819cd2008-02-15 16:48:40 +0000324
325
jadmanski0afbb632008-06-06 21:10:57 +0000326 def get_mysql_args(self):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800327 """Returns the mysql arguments as a string."""
showard0e73c852008-10-03 10:15:50 +0000328 return ('-u %(username)s -p%(password)s -h %(host)s %(db_name)s' %
329 self._database.get_database_info())
mblighe8819cd2008-02-15 16:48:40 +0000330
331
jadmanski0afbb632008-06-06 21:10:57 +0000332 def migrate_to_version_or_latest(self, version):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800333 """Migrates to either a specified version, or the latest version.
334
335 @param version: The version to which to migrate the database,
336 or None in order to migrate to the latest version.
337
338 """
jadmanski0afbb632008-06-06 21:10:57 +0000339 if version is None:
340 self.migrate_to_latest()
341 else:
342 self.migrate_to_version(version)
mblighaa383b72008-03-12 20:11:56 +0000343
344
jadmanski0afbb632008-06-06 21:10:57 +0000345 def do_sync_db(self, version=None):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800346 """Migrates the database.
347
348 @param version: The version to which to migrate the database.
349
350 """
showardeab66ce2009-12-23 00:03:56 +0000351 print 'Migration starting for database', self.get_db_name()
jadmanski0afbb632008-06-06 21:10:57 +0000352 self.migrate_to_version_or_latest(version)
353 print 'Migration complete'
mblighe8819cd2008-02-15 16:48:40 +0000354
355
jadmanski0afbb632008-06-06 21:10:57 +0000356 def test_sync_db(self, version=None):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800357 """Create a fresh database and run all migrations on it.
358
359 @param version: The version to which to migrate the database.
360
jadmanski0afbb632008-06-06 21:10:57 +0000361 """
362 self.initialize_test_db()
363 try:
showardeab66ce2009-12-23 00:03:56 +0000364 print 'Starting migration test on DB', self.get_db_name()
jadmanski0afbb632008-06-06 21:10:57 +0000365 self.migrate_to_version_or_latest(version)
366 # show schema to the user
367 os.system('mysqldump %s --no-data=true '
368 '--add-drop-table=false' %
369 self.get_mysql_args())
370 finally:
371 self.remove_test_db()
372 print 'Test finished successfully'
mblighe8819cd2008-02-15 16:48:40 +0000373
374
jadmanski0afbb632008-06-06 21:10:57 +0000375 def simulate_sync_db(self, version=None):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800376 """Creates a fresh DB, copies existing DB to it, then synchronizes it.
377
378 @param version: The version to which to migrate the database.
379
jadmanski0afbb632008-06-06 21:10:57 +0000380 """
jadmanski0afbb632008-06-06 21:10:57 +0000381 db_version = self.get_db_version()
jadmanski0afbb632008-06-06 21:10:57 +0000382 # don't do anything if we're already at the latest version
383 if db_version == self.get_latest_version():
384 print 'Skipping simulation, already at latest version'
385 return
386 # get existing data
showard12454c62010-01-15 19:15:14 +0000387 self.initialize_and_fill_test_db()
388 try:
389 print 'Starting migration test on DB', self.get_db_name()
390 self.migrate_to_version_or_latest(version)
391 finally:
392 self.remove_test_db()
393 print 'Test finished successfully'
394
395
396 def initialize_and_fill_test_db(self):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800397 """Initializes and fills up a test database."""
jadmanski0afbb632008-06-06 21:10:57 +0000398 print 'Dumping existing data'
399 dump_fd, dump_file = tempfile.mkstemp('.migrate_dump')
jadmanski0afbb632008-06-06 21:10:57 +0000400 os.system('mysqldump %s >%s' %
401 (self.get_mysql_args(), dump_file))
402 # fill in test DB
403 self.initialize_test_db()
404 print 'Filling in test DB'
405 os.system('mysql %s <%s' % (self.get_mysql_args(), dump_file))
showard0e73c852008-10-03 10:15:50 +0000406 os.close(dump_fd)
jadmanski0afbb632008-06-06 21:10:57 +0000407 os.remove(dump_file)
mblighe8819cd2008-02-15 16:48:40 +0000408
409
mblighc2f24452008-03-31 16:46:13 +0000410USAGE = """\
411%s [options] sync|test|simulate|safesync [version]
412Options:
413 -d --database Which database to act on
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800414 -f --force Don't ask for confirmation
415 --debug Print all DB queries"""\
mblighc2f24452008-03-31 16:46:13 +0000416 % sys.argv[0]
mblighe8819cd2008-02-15 16:48:40 +0000417
418
419def main():
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800420 """Main function for the migration script."""
jadmanski0afbb632008-06-06 21:10:57 +0000421 parser = OptionParser()
422 parser.add_option("-d", "--database",
423 help="which database to act on",
jamesren92afa562010-03-23 00:19:26 +0000424 dest="database",
425 default="AUTOTEST_WEB")
showard50c0e712008-09-22 16:20:37 +0000426 parser.add_option("-f", "--force", help="don't ask for confirmation",
427 action="store_true")
showard049b0fd2009-05-29 18:39:07 +0000428 parser.add_option('--debug', help='print all DB queries',
429 action='store_true')
jadmanski0afbb632008-06-06 21:10:57 +0000430 (options, args) = parser.parse_args()
showard250d84d2010-01-12 21:59:48 +0000431 manager = get_migration_manager(db_name=options.database,
432 debug=options.debug, force=options.force)
jadmanski0afbb632008-06-06 21:10:57 +0000433
434 if len(args) > 0:
435 if len(args) > 1:
436 version = int(args[1])
437 else:
438 version = None
439 if args[0] == 'sync':
440 manager.do_sync_db(version)
441 elif args[0] == 'test':
showard12454c62010-01-15 19:15:14 +0000442 manager.simulate=True
jadmanski0afbb632008-06-06 21:10:57 +0000443 manager.test_sync_db(version)
444 elif args[0] == 'simulate':
showard12454c62010-01-15 19:15:14 +0000445 manager.simulate=True
jadmanski0afbb632008-06-06 21:10:57 +0000446 manager.simulate_sync_db(version)
447 elif args[0] == 'safesync':
448 print 'Simluating migration'
showard12454c62010-01-15 19:15:14 +0000449 manager.simulate=True
jadmanski0afbb632008-06-06 21:10:57 +0000450 manager.simulate_sync_db(version)
451 print 'Performing real migration'
showard12454c62010-01-15 19:15:14 +0000452 manager.simulate=False
jadmanski0afbb632008-06-06 21:10:57 +0000453 manager.do_sync_db(version)
454 else:
455 print USAGE
456 return
457
458 print USAGE
mblighe8819cd2008-02-15 16:48:40 +0000459
460
showard250d84d2010-01-12 21:59:48 +0000461def get_migration_manager(db_name, debug, force):
Dennis Jeffreyd65bbd12013-03-05 10:59:18 -0800462 """Creates a MigrationManager object.
463
464 @param db_name: The database name.
465 @param debug: Whether to print debug messages.
466 @param force: Whether to force migration without asking for confirmation.
467
468 @return A created MigrationManager object.
469
470 """
showard250d84d2010-01-12 21:59:48 +0000471 database = database_connection.DatabaseConnection(db_name)
472 database.debug = debug
473 database.reconnect_enabled = False
474 database.connect()
475 return MigrationManager(database, force=force)
476
477
mblighe8819cd2008-02-15 16:48:40 +0000478if __name__ == '__main__':
jadmanski0afbb632008-06-06 21:10:57 +0000479 main()