OLD | NEW |
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, |
(...skipping 10 matching lines...) Expand all Loading... |
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.check_call(['hg', 'clone', '-q', '-U', repository, tempdir]) | 28 subprocess.check_call(['hg', 'clone', '-q', '-U', repository, tempdir]) |
29 subprocess.check_call(['hg', 'up', '-q', '-R', tempdir, '-r', 'default']) | 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.check_call(['hg', 'commit', '-q', '-R', tempdir, '-u', 'hgbot', '
-m', 'Updated list of recommended subscriptions']) | 31 if subprocess.check_output(['hg', 'stat', '-R', tempdir]) != '': |
32 | 32 subprocess.check_call(['hg', 'commit', '-q', '-R', tempdir, '-u', 'hgbot',
'-m', 'Updated list of recommended subscriptions']) |
33 # Don't check the result of this call, it will be 1 if nothing needs pushing | 33 subprocess.check_call(['hg', 'push', '-q', '-R', tempdir]) |
34 subprocess.call(['hg', 'push', '-q', '-R', tempdir]) | |
35 finally: | 34 finally: |
36 rmtree(tempdir) | 35 rmtree(tempdir) |
37 | 36 |
38 if __name__ == '__main__': | 37 if __name__ == '__main__': |
39 setupStderr() | 38 setupStderr() |
40 updateRecommendations() | 39 updateRecommendations() |
OLD | NEW |