Skip to content

Commit

Permalink
handle missing files/directories in extract
Browse files Browse the repository at this point in the history
  • Loading branch information
amangano-edx committed Apr 4, 2017
1 parent ee649fe commit 6d2d7e5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ Details of the config.yaml file are in `edx-platform/conf/locale/config.yaml
Changes
=======

v0.3.8
------

* Fixes for extract to handle when expected directories/files are not present.

v0.3.7
------

Expand Down
2 changes: 1 addition & 1 deletion i18n/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from . import config

__version__ = '0.3.7'
__version__ = '0.3.8'


class Runner:
Expand Down
11 changes: 9 additions & 2 deletions i18n/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,22 @@ def rename_source_file(self, src, dst):
"""
Rename a file in the source directory.
"""
os.rename(self.source_msgs_dir.joinpath(src), self.source_msgs_dir.joinpath(dst))
src_path = self.source_msgs_dir.joinpath(src)
dst_path = self.source_msgs_dir.joinpath(dst)

def run(self, args):
# Only rename files that exist.
if os.path.exists(src_path):
os.rename(src_path, dst_path)

def run(self, args): # pylint: disable=too-many-statements
"""
Main entry point of script
"""
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
configuration = self.configuration
configuration.locale_dir.parent.makedirs_p()
configuration.source_messages_dir.makedirs_p()

# pylint: disable=attribute-defined-outside-init
self.source_msgs_dir = configuration.source_messages_dir

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name='edx-i18n-tools',
version='0.3.7',
version='0.3.8',
description='edX Internationalization Tools',
author='edX',
author_email='oscm@edx.org',
Expand Down

0 comments on commit 6d2d7e5

Please sign in to comment.