diff options
| author | Kate Murphy <hello@kate.io> | 2019-04-16 20:05:45 -0400 |
|---|---|---|
| committer | Kate Murphy <hello@kate.io> | 2019-04-17 19:40:49 -0400 |
| commit | 944834593de7f6008b0edbd8d75e18face9ee2a1 (patch) | |
| tree | ebb6eb1ef5c613cc5097f3986c588018fd25fabd /lib/inx/utils.py | |
| parent | d388dc60854131a7b749be278ff24045869870de (diff) | |
Build inx files in locale folders and build release for each locale
Diffstat (limited to 'lib/inx/utils.py')
| -rw-r--r-- | lib/inx/utils.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/inx/utils.py b/lib/inx/utils.py index a22b1892..1dc96829 100644 --- a/lib/inx/utils.py +++ b/lib/inx/utils.py @@ -1,3 +1,4 @@ +import errno import os import gettext from os.path import dirname @@ -28,8 +29,16 @@ def build_environment(): def write_inx_file(name, contents): - inx_file_name = "inkstitch_%s_%s.inx" % (name, current_locale) - with open(os.path.join(inx_path, inx_file_name), 'w') as inx_file: + inx_locale_dir = os.path.join(inx_path, current_locale) + + try: + os.makedirs(inx_locale_dir) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + inx_file_name = "inkstitch_%s.inx" % name + with open(os.path.join(inx_locale_dir, inx_file_name), 'w') as inx_file: print >> inx_file, contents.encode("utf-8") |
