From 4a739a155b00e582435d7906840f58282ebf8f7d Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Wed, 27 Jul 2011 18:21:45 +0000 Subject: Consolidate all of the import voodoo for MySQLdb into a new module. svn path=/buildtools/make-python-executable.py; revision=3946 --- scripts/convert-https-to-http.py | 11 ++--------- scripts/upgrade-add-ghostbusters.py | 10 +--------- 2 files changed, 3 insertions(+), 18 deletions(-) (limited to 'scripts') diff --git a/scripts/convert-https-to-http.py b/scripts/convert-https-to-http.py index 821255c6..94f5ad5c 100644 --- a/scripts/convert-https-to-http.py +++ b/scripts/convert-https-to-http.py @@ -10,7 +10,7 @@ Default configuration file is myrpki.conf, override with --config option. $Id$ -Copyright (C) 2010 Internet Systems Consortium ("ISC") +Copyright (C) 2010-2011 Internet Systems Consortium ("ISC") Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -25,8 +25,6 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ -from __future__ import with_statement - import getopt, sys, os, warnings, lxml.etree, rpki.config cfg_file = "myrpki.conf" @@ -91,12 +89,7 @@ for root, dirs, files in os.walk(entitydb_dir): if convert_sql: - if hasattr(warnings, "catch_warnings"): - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - import MySQLdb - else: - import MySQLdb + from rpki.mysql_import import MySQLdb cfg = rpki.config.parser(cfg_file, "myrpki") diff --git a/scripts/upgrade-add-ghostbusters.py b/scripts/upgrade-add-ghostbusters.py index 06df2faa..8bfd5a81 100644 --- a/scripts/upgrade-add-ghostbusters.py +++ b/scripts/upgrade-add-ghostbusters.py @@ -19,17 +19,9 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ -from __future__ import with_statement import getopt, sys, rpki.config, warnings -if hasattr(warnings, "catch_warnings"): - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - import MySQLdb, _mysql_exceptions -else: - import MySQLdb, _mysql_exceptions - -warnings.simplefilter("error", _mysql_exceptions.Warning) +from rpki.mysql_import import MySQLdb def fix(name, *statements): db = MySQLdb.connect(db = cfg.get("sql-database", section = name), -- cgit v1.2.3