From f87d69c497e0e00667c83fdcbb83dca048dcc99d Mon Sep 17 00:00:00 2001 From: "Swapnil Kulkarni (coolsvap)" Date: Wed, 23 Dec 2015 09:17:00 +0530 Subject: [PATCH] Keep py3.X compatibility for urllib Change-Id: I0bdf317d29cd83ad1ef9aec3b1646e84df2660de --- requirements.txt | 1 + tools/stable.py | 5 +++-- tools/validate_tags.py | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 4fe29d643..5ee6c4b1d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,4 @@ # Not currently needed for anything else. pydot2>=1.0.32 PyYAML>=3.1.0 +six>=1.9.0 diff --git a/tools/stable.py b/tools/stable.py index b765dccc5..80cd2c7c5 100644 --- a/tools/stable.py +++ b/tools/stable.py @@ -11,10 +11,11 @@ # under the License. import json -import urllib import requests +from six.moves.urllib import parse + import base # Specify stable branch to look for. Some repos contain stable branches @@ -29,7 +30,7 @@ class ValidateStableBranches(base.ValidatorBase): def has_stable_branch(repo): response = requests.get( 'https://review.openstack.org:443/projects/%s/branches' % - urllib.quote_plus(repo)) + parse.quote_plus(repo)) # strip off first few chars because 'the JSON response body starts with # a magic prefix line that must be stripped before feeding the rest of # the response body to a JSON parser' diff --git a/tools/validate_tags.py b/tools/validate_tags.py index a2e5c9713..fd039a946 100755 --- a/tools/validate_tags.py +++ b/tools/validate_tags.py @@ -29,8 +29,8 @@ import yaml import os import sys -import urllib +from six.moves.urllib import parse # List of modules to validate team based tags team_validators = [ teamstats.ValidateDiversity, @@ -78,7 +78,7 @@ def repo_exists(repo): """Sometimes the governance docs can get out of sync with repo names.""" response = requests.get( 'https://review.openstack.org:443/projects/%s/' % - urllib.quote_plus(repo)) + parse.quote_plus(repo)) # strip off first few chars because 'the JSON response body starts with # a magic prefix line that must be stripped before feeding the rest of # the response body to a JSON parser'