| 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 17 matching lines...) Expand all Loading... |
| 28 sourceRepos[re.sub(r'_repository$', '', option)] = value | 28 sourceRepos[re.sub(r'_repository$', '', option)] = value |
| 29 destDir = get_config().get('subscriptionDownloads', 'outdir') | 29 destDir = get_config().get('subscriptionDownloads', 'outdir') |
| 30 | 30 |
| 31 sourceTemp = {} | 31 sourceTemp = {} |
| 32 destTemp = None | 32 destTemp = None |
| 33 try: | 33 try: |
| 34 destTemp = tempfile.mkdtemp() | 34 destTemp = tempfile.mkdtemp() |
| 35 for repoName, repoDir in sourceRepos.iteritems(): | 35 for repoName, repoDir in sourceRepos.iteritems(): |
| 36 tempDir = tempfile.mkdtemp() | 36 tempDir = tempfile.mkdtemp() |
| 37 sourceTemp[repoName] = tempDir | 37 sourceTemp[repoName] = tempDir |
| 38 subprocess.Popen(['hg', 'archive', '-R', repoDir, '-r', 'default', tempDir
]).communicate() | 38 subprocess.check_call(['hg', 'archive', '-R', repoDir, '-r', 'default', te
mpDir]) |
| 39 subprocess.Popen(['rsync', '-a', '--delete', destDir + '/', destTemp]).commu
nicate() | 39 subprocess.check_call(['rsync', '-a', '--delete', destDir + '/', destTemp]) |
| 40 combineSubscriptions(sourceTemp, destTemp) | 40 combineSubscriptions(sourceTemp, destTemp) |
| 41 subprocess.Popen(['rsync', '-au', '--delete', destTemp + '/', destDir]).comm
unicate() | 41 subprocess.check_call(['rsync', '-au', '--delete', destTemp + '/', destDir]) |
| 42 finally: | 42 finally: |
| 43 for tempDir in sourceTemp.itervalues(): | 43 for tempDir in sourceTemp.itervalues(): |
| 44 if os.path.exists(tempDir): | 44 if os.path.exists(tempDir): |
| 45 shutil.rmtree(tempDir, True) | 45 shutil.rmtree(tempDir, True) |
| 46 if destTemp and os.path.exists(destTemp): | 46 if destTemp and os.path.exists(destTemp): |
| 47 shutil.rmtree(destTemp, True) | 47 shutil.rmtree(destTemp, True) |
| OLD | NEW |