From cdf88299422691f5574ab258d8def4e46608cf97 Mon Sep 17 00:00:00 2001 From: Al Date: Thu, 28 Apr 2016 18:34:22 -0400 Subject: [PATCH] [fix] no longer requiring argv for unicode_properties script --- scripts/geodata/i18n/unicode_properties.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/scripts/geodata/i18n/unicode_properties.py b/scripts/geodata/i18n/unicode_properties.py index 5aeb7c95..7372e22f 100644 --- a/scripts/geodata/i18n/unicode_properties.py +++ b/scripts/geodata/i18n/unicode_properties.py @@ -35,10 +35,12 @@ from geodata.string_utils import NUM_CODEPOINTS, wide_unichr from cldr_languages import * from download_cldr import download_cldr -from languages import init_languages, get_country_languages +from languages import get_country_languages from unicode_paths import UNICODE_DATA_DIR from word_breaks import script_regex, regex_char_range +SRC_DIR = os.path.join(this_dir, os.pardir, os.pardir, os.pardir, 'src') + SCRIPTS_DATA_DIR = os.path.join(UNICODE_DATA_DIR, 'scripts') LOCAL_SCRIPTS_FILE = os.path.join(SCRIPTS_DATA_DIR, 'Scripts.txt') LOCAL_ISO_15924_FILE = os.path.join(SCRIPTS_DATA_DIR, 'iso15924.txt') @@ -395,13 +397,11 @@ def get_script_languages(): return script_languages -def main(out_dir): +def main(out_dir=SRC_DIR): # Output is a C header and data file, see templates out_file = open(os.path.join(out_dir, SCRIPTS_DATA_FILENAME), 'w') out_header = open(os.path.join(out_dir, SCRIPTS_HEADER), 'w') - init_languages() - download_file(SCRIPTS_URL, LOCAL_SCRIPTS_FILE) download_file(BLOCKS_URL, LOCAL_BLOCKS_FILE) download_file(PROPS_URL, LOCAL_PROPS_FILE) @@ -459,8 +459,4 @@ def main(out_dir): if __name__ == '__main__': - if len(sys.argv) < 2: - print 'Usage: python unicode_properties.py out_dir' - sys.exit(1) - - main(sys.argv[1]) + main(*sys.argv[1:])