Put po files to shuup project
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import os
import shutil
SHUUP_PATH = '~/.pyenv/versions/project/lib/python3.5/site-packages/shuup'
SOURCE_PATH = '~/projects/project'
for file_name in os.listdir(SOURCE_PATH):
m = re.match('^for_use_shuup_(.*)_ru.po$', file_name)
if m:
parts = m.group(1).split('-')
cur_path = os.path.join(
SHUUP_PATH, *parts, 'locale', 'ru', 'LC_MESSAGES'
)
if not os.path.exists(cur_path):
os.makedirs(cur_path)
src_path = os.path.join(SOURCE_PATH, file_name)
dst_path = os.path.join(cur_path, 'django.po')
shutil.copy(src_path, dst_path)