Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/management/bin/generateHgAuth.py

Issue 10942098: Make sure subprocess calls don`t ignore result codes indicating errors. Fix JS docs generation whil… (Closed)
Patch Set: Fixed wrong argument format Created July 4, 2013, 1:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2013 Eyeo GmbH 4 # Copyright (C) 2006-2013 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details. 13 # GNU General Public License for more details.
14 # 14 #
15 # You should have received a copy of the GNU General Public License 15 # You should have received a copy of the GNU General Public License
16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
17 17
18 import os, re, sys, subprocess, tarfile 18 import os, re, sys, subprocess, tarfile
19 from StringIO import StringIO 19 from StringIO import StringIO
20 from sitescripts.utils import get_config, setupStderr 20 from sitescripts.utils import get_config, setupStderr
21 21
22 def generateData(authRepo): 22 def generateData(authRepo):
23 command = ['hg', '-R', authRepo, 'archive', '-r', 'default', '-t', 'tar', '-p' , '.', '-'] 23 command = ['hg', '-R', authRepo, 'archive', '-r', 'default', '-t', 'tar', '-p' , '.', '-']
24 (data, dummy) = subprocess.Popen(command, stdout=subprocess.PIPE).communicate( ) 24 data = subprocess.check_output(command)
25 25
26 users = {} 26 users = {}
27 repos = [] 27 repos = []
28 tarFile = tarfile.open(mode='r:', fileobj=StringIO(data)) 28 tarFile = tarfile.open(mode='r:', fileobj=StringIO(data))
29 fileInfo = tarFile.next() 29 fileInfo = tarFile.next()
30 while fileInfo: 30 while fileInfo:
31 name = fileInfo.name 31 name = fileInfo.name
32 if name.startswith('./'): 32 if name.startswith('./'):
33 name = name[2:] 33 name = name[2:]
34 34
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 result = generateData(get_config().get('hg', 'auth_repository')) 92 result = generateData(get_config().get('hg', 'auth_repository'))
93 93
94 file = open(get_config().get('hg', 'auth_file'), 'wb') 94 file = open(get_config().get('hg', 'auth_file'), 'wb')
95 for s in result: 95 for s in result:
96 file.write(s) 96 file.write(s)
97 file.close() 97 file.close()
98 98
99 if __name__ == '__main__': 99 if __name__ == '__main__':
100 hook() 100 hook()
OLDNEW

Powered by Google App Engine
This is Rietveld