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

Side by Side Diff: sitescripts/extensions/bin/updateRecommendations.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, subprocess 18 import os, subprocess
19 from sitescripts.utils import get_config, setupStderr 19 from sitescripts.utils import get_config, setupStderr
20 from sitescripts.subscriptions.bin.processTemplate import writeSubscriptions 20 from sitescripts.subscriptions.bin.processTemplate import writeSubscriptions
21 from tempfile import mkdtemp 21 from tempfile import mkdtemp
22 from shutil import rmtree 22 from shutil import rmtree
23 23
24 def updateRecommendations(): 24 def updateRecommendations():
25 repository = get_config().get('extensions', 'abp_repository') 25 repository = get_config().get('extensions', 'abp_repository')
26 tempdir = mkdtemp(prefix='adblockplus') 26 tempdir = mkdtemp(prefix='adblockplus')
27 try: 27 try:
28 subprocess.Popen(['hg', 'clone', '-U', repository, tempdir], stdout=subproc ess.PIPE).communicate() 28 subprocess.check_call(['hg', 'clone', '-q', '-U', repository, tempdir])
29 subprocess.Popen(['hg', 'up', '-R', tempdir, '-r', 'default'], stdout=subpro cess.PIPE).communicate() 29 subprocess.check_call(['hg', 'up', '-q', '-R', tempdir, '-r', 'default'])
30 writeSubscriptions('recommendations', os.path.join(tempdir, 'chrome', 'conte nt', 'ui', 'subscriptions.xml')) 30 writeSubscriptions('recommendations', os.path.join(tempdir, 'chrome', 'conte nt', 'ui', 'subscriptions.xml'))
31 subprocess.Popen(['hg', 'commit', '-R', tempdir, '-u', 'hgbot', '-m', 'Updat ed list of recommended subscriptions'], stdout=subprocess.PIPE).communicate() 31 subprocess.check_call(['hg', 'commit', '-q', '-R', tempdir, '-u', 'hgbot', ' -m', 'Updated list of recommended subscriptions'])
32 subprocess.Popen(['hg', 'push', '-R', tempdir], stdout=subprocess.PIPE).comm unicate() 32
33 # Don't check the result of this call, it will be 1 if nothing needs pushing
34 subprocess.call(['hg', 'push', '-q', '-R', tempdir])
33 finally: 35 finally:
34 rmtree(tempdir) 36 rmtree(tempdir)
35 37
36 if __name__ == '__main__': 38 if __name__ == '__main__':
37 setupStderr() 39 setupStderr()
38 updateRecommendations() 40 updateRecommendations()
OLDNEW

Powered by Google App Engine
This is Rietveld