From 73f37fe66b22e1d3a0676ab4b2c4ee2aa1dbbe53 Mon Sep 17 00:00:00 2001 From: Al Date: Mon, 15 Jun 2015 12:53:00 -0400 Subject: [PATCH] [fix] Moving default Geonames DB path to a shared module --- scripts/geodata/geonames/geonames_sqlite.py | 7 +------ scripts/geodata/geonames/paths.py | 9 +++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 scripts/geodata/geonames/paths.py diff --git a/scripts/geodata/geonames/geonames_sqlite.py b/scripts/geodata/geonames/geonames_sqlite.py index 17c56dbf..01d7e5df 100644 --- a/scripts/geodata/geonames/geonames_sqlite.py +++ b/scripts/geodata/geonames/geonames_sqlite.py @@ -18,6 +18,7 @@ this_dir = os.path.realpath(os.path.dirname(__file__)) sys.path.append(os.path.realpath(os.path.join(os.pardir, os.pardir))) from geodata.encoding import safe_decode +from geodata.geonames.paths import * from geodata.file_utils import * from geodata.log import * @@ -27,12 +28,6 @@ from itertools import islice, chain log_to_file(sys.stderr) logger = logging.getLogger('geonames.sqlite') -GEONAMES_DB_NAME = 'geonames.db' - -DEFAULT_GEONAMES_DB_PATH = os.path.join(this_dir, os.path.pardir, - os.path.pardir, os.path.pardir, - 'data', 'geonames', GEONAMES_DB_NAME) - BASE_URL = 'http://download.geonames.org/export/' DUMP_URL = urlparse.urljoin(BASE_URL, 'dump/') diff --git a/scripts/geodata/geonames/paths.py b/scripts/geodata/geonames/paths.py new file mode 100644 index 00000000..47229f5a --- /dev/null +++ b/scripts/geodata/geonames/paths.py @@ -0,0 +1,9 @@ +import os + +this_dir = os.path.realpath(os.path.dirname(__file__)) + +GEONAMES_DB_NAME = 'geonames.db' + +DEFAULT_GEONAMES_DB_PATH = os.path.join(this_dir, os.path.pardir, + os.path.pardir, os.path.pardir, + 'data', 'geonames', GEONAMES_DB_NAME)