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

Unified Diff: sitescripts/extensions/bin/updateRecommendations.py

Issue 29420575: Issue 5171 - Fix automation to update subscriptions.xml (Closed) Base URL: https://hg.adblockplus.org/sitescripts/
Patch Set: Created April 24, 2017, 12:06 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « .sitescripts.example ('k') | tox.ini » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/extensions/bin/updateRecommendations.py
===================================================================
--- a/sitescripts/extensions/bin/updateRecommendations.py
+++ b/sitescripts/extensions/bin/updateRecommendations.py
@@ -10,30 +10,39 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
import os
import subprocess
-from sitescripts.utils import get_config, setupStderr
+from sitescripts.utils import get_config
from sitescripts.subscriptions.bin.processTemplate import writeSubscriptions
from tempfile import mkdtemp
from shutil import rmtree
-def updateRecommendations():
- repository = get_config().get('extensions', 'abp_repository')
+def update_recommendations():
+ repository = get_config().get('extensions', 'subscriptions_repository')
+ path = get_config().get('extensions', 'subscriptions_path').split('/')
Wladimir Palant 2017/04/24 12:08:11 For reference: we never updated the hardcoded path
tempdir = mkdtemp(prefix='adblockplus')
try:
- subprocess.check_call(['hg', 'clone', '-q', '-U', repository, tempdir])
- subprocess.check_call(['hg', 'up', '-q', '-R', tempdir, '-r', 'default'])
- writeSubscriptions('recommendations', os.path.join(tempdir, 'chrome', 'content', 'ui', 'subscriptions.xml'))
+ subprocess.check_call([
+ 'hg', 'clone', '-q', '-U', repository, tempdir
+ ])
+ subprocess.check_call([
+ 'hg', 'up', '-q', '-R', tempdir, '-r', 'master'
+ ])
+ writeSubscriptions('recommendations', os.path.join(tempdir, *path))
if subprocess.check_output(['hg', 'stat', '-R', tempdir]) != '':
- subprocess.check_call(['hg', 'commit', '-q', '-R', tempdir, '-u', 'hgbot', '-m', 'Updated list of recommended subscriptions'])
- subprocess.check_call(['hg', 'push', '-q', '-R', tempdir])
+ subprocess.check_call([
+ 'hg', 'commit', '-q', '-R', tempdir, '-u', 'hgbot',
+ '-m', 'Noissue - Updated list of recommended subscriptions'
+ ])
+ subprocess.check_call([
+ 'hg', 'push', '-q', '-R', tempdir, '-r', 'master'
+ ])
finally:
rmtree(tempdir)
if __name__ == '__main__':
- setupStderr()
- updateRecommendations()
+ update_recommendations()
« no previous file with comments | « .sitescripts.example ('k') | tox.ini » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld