File tree 1 file changed +20
-6
lines changed
arduino-core/src/processing/app/i18n/python
1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change 2
2
#vim:set fileencoding=utf-8 sw=2 expandtab
3
3
4
4
from transifex import Transifex
5
+ import requests
6
+ import getpass
7
+ import sys
5
8
6
9
def main ():
7
- import getpass
8
- import sys
9
-
10
10
print 'Use your account to talk with Transifex.'
11
11
user = raw_input ('Username: ' )
12
12
passwd = getpass .getpass ('Password: ' )
13
13
trans = Transifex (user , passwd )
14
14
15
15
for lang in sys .argv [1 :]:
16
16
fname = 'Resources_%s.po' % lang
17
- print "Updating %s from Transifex..." % fname ,
18
17
sys .stdout .flush ()
19
18
try :
20
19
lang = trans .canonical_lang (lang )
21
- trans . pull (lang , fname )
20
+ pull (trans , lang , fname )
22
21
except RuntimeError , e :
23
22
print e .message
24
23
continue
25
24
except IOError , e :
26
25
print e .strerror
27
26
continue
28
- print
27
+
28
+ def pull (trans , lang , fname ):
29
+ count = 0
30
+ print "Updating %s from Transifex...\n " % fname ,
31
+ sys .stdout .flush ()
32
+ while count < 5 :
33
+ count += 1
34
+ try :
35
+ trans .pull (lang , fname )
36
+ return
37
+ except requests .exceptions .HTTPError , e :
38
+ print " *** Retrying %s from Transifex...\n " % fname ,
39
+ sys .stdout .flush ()
40
+
41
+ if count >= 5 :
42
+ raise Exception ("Too many retries" )
29
43
30
44
if __name__ == '__main__' :
31
45
main ()
You can’t perform that action at this time.
0 commit comments