crowdin_sync: Add stable branch sync support
* Add cm-12.1-YOG7D and cm-13.0-ZNH0E configs for initial support
Change-Id: I7a397378cb47b29c53a93ae7ff054d736ffe5e92
diff --git a/crowdin_sync.py b/crowdin_sync.py
index 6457e4d..52f0371 100755
--- a/crowdin_sync.py
+++ b/crowdin_sync.py
@@ -54,6 +54,9 @@
def push_as_commit(base_path, path, name, branch, username, ticket):
+ if 'stable/' in base_path:
+ branch = ''.join(('stable/', branch))
+
print('Committing %s on branch %s' % (name, branch))
# Get path
@@ -315,16 +318,22 @@
args = parse_args()
default_branch = args.branch
- base_path = os.getenv('CM_CROWDIN_BASE_PATH')
+ if 'stable/' in default_branch:
+ base_path_env = 'CM_CROWDIN_STABLE_BASE_PATH'
+ base_path = os.getenv(base_path_env)
+ default_branch = default_branch.replace('stable/', '')
+ else:
+ base_path_env = 'CM_CROWDIN_BASE_PATH'
+ base_path = os.getenv(base_path_env)
if base_path is None:
cwd = os.getcwd()
- print('You have not set CM_CROWDIN_BASE_PATH. Defaulting to %s' % cwd)
+ print('You have not set %s. Defaulting to %s' % (base_path_env, cwd))
base_path = cwd
else:
base_path = os.path.join(os.path.realpath(base_path), default_branch)
if not os.path.isdir(base_path):
- print('CM_CROWDIN_BASE_PATH + branch is not a real directory: %s'
- % base_path)
+ print('%s + branch is not a real directory: %s'
+ % (base_path_env, base_path))
sys.exit(1)
if not check_dependencies():