create_dir_if_necessary() is unnecessary
We already have makedirs_p()
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user