create_dir_if_necessary() is unnecessary

We already have makedirs_p()
This commit is contained in:
David Baumgold
2014-03-18 16:07:18 -04:00
parent 380d2177f5
commit d93238d8de
3 changed files with 3 additions and 10 deletions

View File

@@ -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)

View File

@@ -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.

View File

@@ -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'))