blob: 6457e4de736680d59bff68a848d3a91f77b074d2 [file] [log] [blame]
Anthony Kingb8607632015-05-01 22:06:37 +03001#!/usr/bin/env python
Marco Brohetcb5cdb42014-07-11 22:41:53 +02002# -*- coding: utf-8 -*-
Michael Bestas1ab959b2014-07-26 16:01:01 +03003# crowdin_sync.py
Marco Brohetcb5cdb42014-07-11 22:41:53 +02004#
5# Updates Crowdin source translations and pushes translations
6# directly to CyanogenMod's Gerrit.
7#
Michael Bestas97677e12015-02-08 13:11:59 +02008# Copyright (C) 2014-2015 The CyanogenMod Project
Marco Brohetcb5cdb42014-07-11 22:41:53 +02009#
10# Licensed under the Apache License, Version 2.0 (the "License");
11# you may not use this file except in compliance with the License.
12# You may obtain a copy of the License at
13#
14# http://www.apache.org/licenses/LICENSE-2.0
15#
16# Unless required by applicable law or agreed to in writing, software
17# distributed under the License is distributed on an "AS IS" BASIS,
18# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19# See the License for the specific language governing permissions and
20# limitations under the License.
21
Anthony Kingb8607632015-05-01 22:06:37 +030022# ################################# IMPORTS ################################## #
23
24from __future__ import print_function
Marco Brohet6b6b4e52014-07-20 00:05:16 +020025
26import argparse
Marco Brohetcb5cdb42014-07-11 22:41:53 +020027import git
28import os
Marco Brohetcb5cdb42014-07-11 22:41:53 +020029import subprocess
30import sys
Anthony Kingb8607632015-05-01 22:06:37 +030031
Marco Brohetcb5cdb42014-07-11 22:41:53 +020032from xml.dom import minidom
33
Anthony Kingd0d56cf2015-06-05 10:48:38 +010034# ################################# GLOBALS ################################## #
35
36_DIR = os.path.dirname(os.path.realpath(__file__))
37
Anthony Kingb8607632015-05-01 22:06:37 +030038# ################################ FUNCTIONS ################################# #
39
40
41def run_subprocess(cmd, silent=False):
42 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
43 universal_newlines=True)
44 comm = p.communicate()
45 exit_code = p.returncode
46 if exit_code != 0 and not silent:
47 print("There was an error running the subprocess.\n"
48 "cmd: %s\n"
49 "exit code: %d\n"
50 "stdout: %s\n"
51 "stderr: %s" % (cmd, exit_code, comm[0], comm[1]),
52 file=sys.stderr)
53 return comm, exit_code
54
Marco Brohet6b6b4e52014-07-20 00:05:16 +020055
Michael Bestasdb69b932016-03-12 21:08:27 +020056def push_as_commit(base_path, path, name, branch, username, ticket):
Anthony Kingb8607632015-05-01 22:06:37 +030057 print('Committing %s on branch %s' % (name, branch))
Marco Brohetcb5cdb42014-07-11 22:41:53 +020058
59 # Get path
Michael Bestas118fcaf2015-06-04 23:02:20 +030060 path = os.path.join(base_path, path)
Anthony Kingb8607632015-05-01 22:06:37 +030061 if not path.endswith('.git'):
62 path = os.path.join(path, '.git')
Marco Brohetcb5cdb42014-07-11 22:41:53 +020063
Marco Brohet6b6b4e52014-07-20 00:05:16 +020064 # Create repo object
Marco Brohetcb5cdb42014-07-11 22:41:53 +020065 repo = git.Repo(path)
Marco Brohet6b6b4e52014-07-20 00:05:16 +020066
67 # Remove previously deleted files from Git
Anthony Kingb8607632015-05-01 22:06:37 +030068 files = repo.git.ls_files(d=True).split('\n')
69 if files and files[0]:
70 repo.git.rm(files)
Marco Brohet6b6b4e52014-07-20 00:05:16 +020071
72 # Add all files to commit
Marco Brohetcb5cdb42014-07-11 22:41:53 +020073 repo.git.add('-A')
Marco Brohet6b6b4e52014-07-20 00:05:16 +020074
75 # Create commit; if it fails, probably empty so skipping
Michael Bestasdb69b932016-03-12 21:08:27 +020076 if ticket:
77 message = '''Automatic translation import
78
79Ticket: %s''' % ticket
80 else:
81 message = 'Automatic translation import'
82
Marco Brohetcb5cdb42014-07-11 22:41:53 +020083 try:
Michael Bestasdb69b932016-03-12 21:08:27 +020084 repo.git.commit(m=message)
Marco Brohetcb5cdb42014-07-11 22:41:53 +020085 except:
Anthony Kingb8607632015-05-01 22:06:37 +030086 print('Failed to create commit for %s, probably empty: skipping'
87 % name, file=sys.stderr)
Marco Brohetcb5cdb42014-07-11 22:41:53 +020088 return
Marco Brohet6b6b4e52014-07-20 00:05:16 +020089
90 # Push commit
Michael Bestasf96f67b2014-10-21 00:43:37 +030091 try:
Anthony Kingb8607632015-05-01 22:06:37 +030092 repo.git.push('ssh://%s@review.cyanogenmod.org:29418/%s' % (username, name),
93 'HEAD:refs/for/%s%%topic=translation' % branch)
94 print('Successfully pushed commit for %s' % name)
Michael Bestasf96f67b2014-10-21 00:43:37 +030095 except:
Anthony Kingb8607632015-05-01 22:06:37 +030096 print('Failed to push commit for %s' % name, file=sys.stderr)
Marco Brohetcb5cdb42014-07-11 22:41:53 +020097
Anthony Kingb8607632015-05-01 22:06:37 +030098
99def check_run(cmd):
Michael Bestas97677e12015-02-08 13:11:59 +0200100 p = subprocess.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr)
101 ret = p.wait()
102 if ret != 0:
Anthony Kingb8607632015-05-01 22:06:37 +0300103 print('Failed to run cmd: %s' % ' '.join(cmd), file=sys.stderr)
Michael Bestas97677e12015-02-08 13:11:59 +0200104 sys.exit(ret)
105
Marco Brohet6b6b4e52014-07-20 00:05:16 +0200106
Michael Bestas118fcaf2015-06-04 23:02:20 +0300107def find_xml(base_path):
108 for dp, dn, file_names in os.walk(base_path):
Anthony Kingb8607632015-05-01 22:06:37 +0300109 for f in file_names:
110 if os.path.splitext(f)[1] == '.xml':
111 yield os.path.join(dp, f)
Marco Brohet6b6b4e52014-07-20 00:05:16 +0200112
Anthony Kingb8607632015-05-01 22:06:37 +0300113# ############################################################################ #
Marco Brohet6b6b4e52014-07-20 00:05:16 +0200114
Michael Bestas6b6db122015-02-08 13:22:22 +0200115
Anthony Kingb8607632015-05-01 22:06:37 +0300116def parse_args():
117 parser = argparse.ArgumentParser(
118 description="Synchronising CyanogenMod's translations with Crowdin")
Michael Bestasfd5d1362015-12-18 20:34:32 +0200119 parser.add_argument('-u', '--username', help='Gerrit username')
Anthony Kingb8607632015-05-01 22:06:37 +0300120 parser.add_argument('-b', '--branch', help='CyanogenMod branch',
121 required=True)
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300122 parser.add_argument('-c', '--config', help='Custom yaml config')
Michael Bestasdb69b932016-03-12 21:08:27 +0200123 parser.add_argument('-t', '--ticket', help='JIRA ticket')
Michael Bestasfd5d1362015-12-18 20:34:32 +0200124 parser.add_argument('--upload-sources', action='store_true',
125 help='Upload sources to Crowdin')
126 parser.add_argument('--upload-translations', action='store_true',
127 help='Upload translations to Crowdin')
128 parser.add_argument('--download', action='store_true',
129 help='Download translations from Crowdin')
Anthony Kingb8607632015-05-01 22:06:37 +0300130 return parser.parse_args()
Michael Bestas6b6db122015-02-08 13:22:22 +0200131
Anthony Kingb8607632015-05-01 22:06:37 +0300132# ################################# PREPARE ################################## #
Marco Brohet6b6b4e52014-07-20 00:05:16 +0200133
Anthony Kingb8607632015-05-01 22:06:37 +0300134
135def check_dependencies():
Anthony Kingb8607632015-05-01 22:06:37 +0300136 # Check for Ruby version of crowdin-cli
137 cmd = ['gem', 'list', 'crowdin-cli', '-i']
138 if run_subprocess(cmd, silent=True)[1] != 0:
139 print('You have not installed crowdin-cli.', file=sys.stderr)
140 return False
Anthony Kingb8607632015-05-01 22:06:37 +0300141 return True
Marco Brohetcb5cdb42014-07-11 22:41:53 +0200142
Marco Brohetcb5cdb42014-07-11 22:41:53 +0200143
Michael Bestas118fcaf2015-06-04 23:02:20 +0300144def load_xml(x):
Anthony Kingb8607632015-05-01 22:06:37 +0300145 try:
146 return minidom.parse(x)
147 except IOError:
148 print('You have no %s.' % x, file=sys.stderr)
149 return None
150 except Exception:
151 # TODO: minidom should not be used.
152 print('Malformed %s.' % x, file=sys.stderr)
153 return None
Marco Brohet6b6b4e52014-07-20 00:05:16 +0200154
Michael Bestas4b26c4e2014-10-23 23:21:59 +0300155
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300156def check_files(files):
Anthony Kingb8607632015-05-01 22:06:37 +0300157 for f in files:
158 if not os.path.isfile(f):
159 print('You have no %s.' % f, file=sys.stderr)
160 return False
Anthony Kingb8607632015-05-01 22:06:37 +0300161 return True
Michael Bestas4b26c4e2014-10-23 23:21:59 +0300162
Anthony Kingb8607632015-05-01 22:06:37 +0300163# ################################### MAIN ################################### #
Michael Bestas4b26c4e2014-10-23 23:21:59 +0300164
Michael Bestas4b26c4e2014-10-23 23:21:59 +0300165
Michael Bestasfd5d1362015-12-18 20:34:32 +0200166def upload_sources_crowdin(branch, config):
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300167 if config:
Michael Bestasfd5d1362015-12-18 20:34:32 +0200168 print('\nUploading sources to Crowdin (custom config)')
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300169 check_run(['crowdin-cli',
Michael Bestas03bc7052016-03-12 03:19:10 +0200170 '--config=%s/config/%s' % (_DIR, config),
Michael Bestas44fbb352015-12-17 02:01:42 +0200171 'upload', 'sources', '--branch=%s' % branch])
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300172 else:
Michael Bestasfd5d1362015-12-18 20:34:32 +0200173 print('\nUploading sources to Crowdin (AOSP supported languages)')
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300174 check_run(['crowdin-cli',
Michael Bestas03bc7052016-03-12 03:19:10 +0200175 '--config=%s/config/%s.yaml' % (_DIR, branch),
Michael Bestas44fbb352015-12-17 02:01:42 +0200176 'upload', 'sources', '--branch=%s' % branch])
Anthony King69a95382015-02-08 18:44:10 +0000177
Michael Bestasfd5d1362015-12-18 20:34:32 +0200178 print('\nUploading sources to Crowdin (non-AOSP supported languages)')
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300179 check_run(['crowdin-cli',
Michael Bestas03bc7052016-03-12 03:19:10 +0200180 '--config=%s/config/%s_aosp.yaml' % (_DIR, branch),
Michael Bestas44fbb352015-12-17 02:01:42 +0200181 'upload', 'sources', '--branch=%s' % branch])
Anthony Kingb8607632015-05-01 22:06:37 +0300182
183
Michael Bestasfd5d1362015-12-18 20:34:32 +0200184def upload_translations_crowdin(branch, config):
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300185 if config:
Michael Bestasfd5d1362015-12-18 20:34:32 +0200186 print('\nUploading translations to Crowdin (custom config)')
187 check_run(['crowdin-cli',
Michael Bestas03bc7052016-03-12 03:19:10 +0200188 '--config=%s/config/%s' % (_DIR, config),
Michael Bestasfd5d1362015-12-18 20:34:32 +0200189 'upload', 'translations', '--branch=%s' % branch,
190 '--no-import-duplicates', '--import-eq-suggestions',
191 '--auto-approve-imported'])
192 else:
193 print('\nUploading translations to Crowdin '
194 '(AOSP supported languages)')
195 check_run(['crowdin-cli',
Michael Bestas03bc7052016-03-12 03:19:10 +0200196 '--config=%s/config/%s.yaml' % (_DIR, branch),
Michael Bestasfd5d1362015-12-18 20:34:32 +0200197 'upload', 'translations', '--branch=%s' % branch,
198 '--no-import-duplicates', '--import-eq-suggestions',
199 '--auto-approve-imported'])
200
201 print('\nUploading translations to Crowdin '
202 '(non-AOSP supported languages)')
203 check_run(['crowdin-cli',
Michael Bestas03bc7052016-03-12 03:19:10 +0200204 '--config=%s/config/%s_aosp.yaml' % (_DIR, branch),
Michael Bestasfd5d1362015-12-18 20:34:32 +0200205 'upload', 'translations', '--branch=%s' % branch,
206 '--no-import-duplicates', '--import-eq-suggestions',
207 '--auto-approve-imported'])
208
209
Michael Bestasdb69b932016-03-12 21:08:27 +0200210def download_crowdin(base_path, branch, xml, username, config, ticket):
Michael Bestasfd5d1362015-12-18 20:34:32 +0200211 if config:
212 print('\nDownloading translations from Crowdin (custom config)')
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300213 check_run(['crowdin-cli',
Michael Bestas03bc7052016-03-12 03:19:10 +0200214 '--config=%s/config/%s' % (_DIR, config),
Michael Bestas44fbb352015-12-17 02:01:42 +0200215 'download', '--branch=%s' % branch])
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300216 else:
Michael Bestasfd5d1362015-12-18 20:34:32 +0200217 print('\nDownloading translations from Crowdin '
218 '(AOSP supported languages)')
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300219 check_run(['crowdin-cli',
Michael Bestas03bc7052016-03-12 03:19:10 +0200220 '--config=%s/config/%s.yaml' % (_DIR, branch),
Michael Bestas44fbb352015-12-17 02:01:42 +0200221 'download', '--branch=%s' % branch])
Michael Bestas50579d22014-08-09 17:49:14 +0300222
Michael Bestasfd5d1362015-12-18 20:34:32 +0200223 print('\nDownloading translations from Crowdin '
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300224 '(non-AOSP supported languages)')
225 check_run(['crowdin-cli',
Michael Bestas03bc7052016-03-12 03:19:10 +0200226 '--config=%s/config/%s_aosp.yaml' % (_DIR, branch),
Michael Bestas44fbb352015-12-17 02:01:42 +0200227 'download', '--branch=%s' % branch])
Marco Brohetcb5cdb42014-07-11 22:41:53 +0200228
Michael Bestas99f5fce2015-06-04 22:07:51 +0300229 print('\nRemoving useless empty translation files')
Anthony Kingb8607632015-05-01 22:06:37 +0300230 empty_contents = {
231 '<resources/>',
232 '<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"/>',
233 ('<resources xmlns:android='
234 '"http://schemas.android.com/apk/res/android"/>'),
235 ('<resources xmlns:android="http://schemas.android.com/apk/res/android"'
236 ' xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"/>'),
237 ('<resources xmlns:tools="http://schemas.android.com/tools"'
238 ' xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"/>')
239 }
240 xf = None
Michael Bestas118fcaf2015-06-04 23:02:20 +0300241 for xml_file in find_xml(base_path):
Anthony Kingb8607632015-05-01 22:06:37 +0300242 xf = open(xml_file).read()
Michael Bestas919053f2014-10-20 23:30:54 +0300243 for line in empty_contents:
Anthony Kingb8607632015-05-01 22:06:37 +0300244 if line in xf:
Michael Bestas919053f2014-10-20 23:30:54 +0300245 print('Removing ' + xml_file)
246 os.remove(xml_file)
247 break
Anthony Kingb8607632015-05-01 22:06:37 +0300248 del xf
Marco Brohetcb5cdb42014-07-11 22:41:53 +0200249
Michael Bestas99f5fce2015-06-04 22:07:51 +0300250 print('\nCreating a list of pushable translations')
Michael Bestas919053f2014-10-20 23:30:54 +0300251 # Get all files that Crowdin pushed
Anthony Kingb8607632015-05-01 22:06:37 +0300252 paths = []
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300253 if config:
Michael Bestas03bc7052016-03-12 03:19:10 +0200254 files = ['%s/config/%s' % (_DIR, config)]
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300255 else:
Michael Bestas03bc7052016-03-12 03:19:10 +0200256 files = ['%s/config/%s.yaml' % (_DIR, branch),
257 '%s/config/%s_aosp.yaml' % (_DIR, branch)]
Michael Bestas6c327e62015-05-02 01:58:01 +0300258 for c in files:
Michael Bestas44fbb352015-12-17 02:01:42 +0200259 cmd = ['crowdin-cli', '--config=%s' % c, 'list', 'project',
260 '--branch=%s' % branch]
Anthony Kingb8607632015-05-01 22:06:37 +0300261 comm, ret = run_subprocess(cmd)
262 if ret != 0:
263 sys.exit(ret)
264 for p in str(comm[0]).split("\n"):
265 paths.append(p.replace('/%s' % branch, ''))
Michael Bestas50579d22014-08-09 17:49:14 +0300266
Michael Bestas99f5fce2015-06-04 22:07:51 +0300267 print('\nUploading translations to Gerrit')
Anthony Kingb8607632015-05-01 22:06:37 +0300268 items = [x for sub in xml for x in sub.getElementsByTagName('project')]
Michael Bestas919053f2014-10-20 23:30:54 +0300269 all_projects = []
270
Anthony Kingb8607632015-05-01 22:06:37 +0300271 for path in paths:
272 path = path.strip()
Michael Bestas919053f2014-10-20 23:30:54 +0300273 if not path:
274 continue
275
Anthony Kingb8607632015-05-01 22:06:37 +0300276 if "/res" not in path:
277 print('WARNING: Cannot determine project root dir of '
278 '[%s], skipping.' % path)
Anthony King69a95382015-02-08 18:44:10 +0000279 continue
Anthony Kingb8607632015-05-01 22:06:37 +0300280 result = path.split('/res')[0].strip('/')
281 if result == path.strip('/'):
282 print('WARNING: Cannot determine project root dir of '
283 '[%s], skipping.' % path)
284 continue
Marco Brohet6b6b4e52014-07-20 00:05:16 +0200285
Michael Bestasc899b8c2015-03-03 00:53:19 +0200286 if result in all_projects:
Michael Bestasc899b8c2015-03-03 00:53:19 +0200287 continue
Michael Bestas50579d22014-08-09 17:49:14 +0300288
Anthony Kingb8607632015-05-01 22:06:37 +0300289 # When a project has multiple translatable files, Crowdin will
290 # give duplicates.
291 # We don't want that (useless empty commits), so we save each
292 # project in all_projects and check if it's already in there.
Michael Bestasc899b8c2015-03-03 00:53:19 +0200293 all_projects.append(result)
Anthony King69a95382015-02-08 18:44:10 +0000294
Michael Bestas42e25e32016-03-12 20:18:39 +0200295 # Search android/default.xml or config/%(branch)_extra_packages.xml
Anthony Kingb8607632015-05-01 22:06:37 +0300296 # for the project's name
297 for project in items:
298 path = project.attributes['path'].value
299 if not (result + '/').startswith(path +'/'):
Michael Bestasc899b8c2015-03-03 00:53:19 +0200300 continue
Anthony Kingb8607632015-05-01 22:06:37 +0300301 if result != path:
302 if path in all_projects:
303 break
304 result = path
305 all_projects.append(result)
Anthony King69a95382015-02-08 18:44:10 +0000306
Anthony Kingb8607632015-05-01 22:06:37 +0300307 br = project.getAttribute('revision') or branch
Anthony King69a95382015-02-08 18:44:10 +0000308
Michael Bestas118fcaf2015-06-04 23:02:20 +0300309 push_as_commit(base_path, result,
Michael Bestasdb69b932016-03-12 21:08:27 +0200310 project.getAttribute('name'), br, username, ticket)
Anthony Kingb8607632015-05-01 22:06:37 +0300311 break
Anthony King69a95382015-02-08 18:44:10 +0000312
Anthony King69a95382015-02-08 18:44:10 +0000313
Anthony Kingb8607632015-05-01 22:06:37 +0300314def main():
Anthony Kingb8607632015-05-01 22:06:37 +0300315 args = parse_args()
316 default_branch = args.branch
Michael Bestas118fcaf2015-06-04 23:02:20 +0300317
318 base_path = os.getenv('CM_CROWDIN_BASE_PATH')
319 if base_path is None:
Anthony Kingd0d56cf2015-06-05 10:48:38 +0100320 cwd = os.getcwd()
Michael Bestas118fcaf2015-06-04 23:02:20 +0300321 print('You have not set CM_CROWDIN_BASE_PATH. Defaulting to %s' % cwd)
322 base_path = cwd
323 else:
324 base_path = os.path.join(os.path.realpath(base_path), default_branch)
325 if not os.path.isdir(base_path):
326 print('CM_CROWDIN_BASE_PATH + branch is not a real directory: %s'
327 % base_path)
328 sys.exit(1)
Anthony Kingb8607632015-05-01 22:06:37 +0300329
Michael Bestas99f5fce2015-06-04 22:07:51 +0300330 if not check_dependencies():
331 sys.exit(1)
Anthony Kingb8607632015-05-01 22:06:37 +0300332
Michael Bestas118fcaf2015-06-04 23:02:20 +0300333 xml_android = load_xml(x='%s/android/default.xml' % base_path)
Anthony Kingb8607632015-05-01 22:06:37 +0300334 if xml_android is None:
335 sys.exit(1)
336
Michael Bestas42e25e32016-03-12 20:18:39 +0200337 xml_extra = load_xml(x='%s/config/%s_extra_packages.xml'
Anthony Kingd0d56cf2015-06-05 10:48:38 +0100338 % (_DIR, default_branch))
Anthony Kingb8607632015-05-01 22:06:37 +0300339 if xml_extra is None:
340 sys.exit(1)
341
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300342 if args.config:
Michael Bestas03bc7052016-03-12 03:19:10 +0200343 files = ['%s/config/%s' % (_DIR, args.config)]
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300344 else:
Michael Bestas03bc7052016-03-12 03:19:10 +0200345 files = ['%s/config/%s.yaml' % (_DIR, default_branch),
346 '%s/config/%s_aosp.yaml' % (_DIR, default_branch)]
Michael Bestas2f8c4a52015-08-05 21:33:50 +0300347 if not check_files(files):
Anthony Kingb8607632015-05-01 22:06:37 +0300348 sys.exit(1)
349
Michael Bestasfd5d1362015-12-18 20:34:32 +0200350 if args.download and args.username is None:
351 print('Argument -u/--username is required for translations download')
352 sys.exit(1)
353
354 if args.upload_sources:
355 upload_sources_crowdin(default_branch, args.config)
356 if args.upload_translations:
357 upload_translations_crowdin(default_branch, args.config)
358 if args.download:
359 download_crowdin(base_path, default_branch, (xml_android, xml_extra),
Michael Bestasdb69b932016-03-12 21:08:27 +0200360 args.username, args.config, args.ticket)
Anthony Kingb8607632015-05-01 22:06:37 +0300361 print('\nDone!')
362
363if __name__ == '__main__':
364 main()