From d93238d8de73af7538b3aca0bd57e6ee56e16599 Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Tue, 18 Mar 2014 16:07:18 -0400 Subject: [PATCH] create_dir_if_necessary() is unnecessary We already have makedirs_p() --- i18n/dummy.py | 3 +-- i18n/execute.py | 6 ------ i18n/extract.py | 4 ++-- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/i18n/dummy.py b/i18n/dummy.py index f945f1310a..d2f42a5bc9 100755 --- a/i18n/dummy.py +++ b/i18n/dummy.py @@ -31,7 +31,6 @@ import polib from path import path from i18n.config import CONFIGURATION -from i18n.execute import create_dir_if_necessary from i18n.converter import Converter @@ -187,7 +186,7 @@ def make_dummy(filename, locale, converter): pofile.metadata['Plural-Forms'] = 'nplurals=2; plural=(n != 1);' new_file = new_filename(filename, locale) - create_dir_if_necessary(new_file) + new_file.parent.makedirs_p() pofile.save(new_file) diff --git a/i18n/execute.py b/i18n/execute.py index 86574164dd..bc6f626fae 100644 --- a/i18n/execute.py +++ b/i18n/execute.py @@ -34,12 +34,6 @@ def call(command, working_directory=BASE_DIR): return (out, err) -def create_dir_if_necessary(pathname): - dirname = os.path.dirname(pathname) - if not os.path.exists(dirname): - os.makedirs(dirname) - - def remove_file(filename, verbose=True): """ Attempt to delete filename. diff --git a/i18n/extract.py b/i18n/extract.py index 6d5b83f261..1f43df69ca 100755 --- a/i18n/extract.py +++ b/i18n/extract.py @@ -27,7 +27,7 @@ from path import path from polib import pofile from i18n.config import BASE_DIR, LOCALE_DIR, CONFIGURATION -from i18n.execute import execute, create_dir_if_necessary, remove_file +from i18n.execute import execute, remove_file from i18n.segment import segment_pofiles @@ -46,7 +46,7 @@ def main(verbosity=1): Main entry point of script """ logging.basicConfig(stream=sys.stdout, level=logging.INFO) - create_dir_if_necessary(LOCALE_DIR) + LOCALE_DIR.parent.makedirs_p() source_msgs_dir = CONFIGURATION.source_messages_dir remove_file(source_msgs_dir.joinpath('django.po'))