Commit 4ff9501b authored by Matthias Putz's avatar Matthias Putz

executed python 2to3 tool

parent 7f958de6
bin bin
*.bak
*.pyc *.pyc
.repopickle_* .repopickle_*
This diff is collapsed.
...@@ -38,7 +38,7 @@ class Command(object): ...@@ -38,7 +38,7 @@ class Command(object):
env_options = self._RegisteredEnvironmentOptions() env_options = self._RegisteredEnvironmentOptions()
for env_key, opt_key in env_options.items(): for env_key, opt_key in list(env_options.items()):
# Get the user-set option value if any # Get the user-set option value if any
opt_value = getattr(opts, opt_key) opt_value = getattr(opts, opt_key)
...@@ -139,20 +139,20 @@ class Command(object): ...@@ -139,20 +139,20 @@ class Command(object):
groups = [x for x in re.split(r'[,\s]+', groups) if x] groups = [x for x in re.split(r'[,\s]+', groups) if x]
if not args: if not args:
all_projects_list = all_projects.values() all_projects_list = list(all_projects.values())
derived_projects = {} derived_projects = {}
for project in all_projects_list: for project in all_projects_list:
if submodules_ok or project.sync_s: if submodules_ok or project.sync_s:
derived_projects.update((p.name, p) derived_projects.update((p.name, p)
for p in project.GetDerivedSubprojects()) for p in project.GetDerivedSubprojects())
#all_projects_list.extend(derived_projects.values()) #all_projects_list.extend(derived_projects.values())
for projects in [all_projects_list, derived_projects.values()]: for projects in [all_projects_list, list(derived_projects.values())]:
for project in projects: for project in projects:
if ((missing_ok or project.Exists) and if ((missing_ok or project.Exists) and
project.MatchesGroups(groups)): project.MatchesGroups(groups)):
result.append(project) result.append(project)
else: else:
self._ResetPathToProjectMap(all_projects.values()) self._ResetPathToProjectMap(list(all_projects.values()))
for arg in args: for arg in args:
project = all_projects.get(arg) project = all_projects.get(arg)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import os import os
import re import re
import sys import sys
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import os import os
import sys import sys
import subprocess import subprocess
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import pickle import pickle
import os import os
import re import re
...@@ -26,18 +26,7 @@ try: ...@@ -26,18 +26,7 @@ try:
except ImportError: except ImportError:
import dummy_threading as _threading import dummy_threading as _threading
import time import time
try: import urllib.request, urllib.error, urllib.parse
import urllib2
except ImportError:
# For python3
import urllib.request
import urllib.error
else:
# For python2
import imp
urllib = imp.new_module('urllib')
urllib.request = urllib2
urllib.error = urllib2
from signal import SIGTERM from signal import SIGTERM
from error import GitError, UploadError from error import GitError, UploadError
...@@ -225,7 +214,7 @@ class GitConfig(object): ...@@ -225,7 +214,7 @@ class GitConfig(object):
d = self._section_dict d = self._section_dict
if d is None: if d is None:
d = {} d = {}
for name in self._cache.keys(): for name in list(self._cache.keys()):
p = name.split('.') p = name.split('.')
if 2 == len(p): if 2 == len(p):
section = p[0] section = p[0]
......
...@@ -66,7 +66,7 @@ class GitRefs(object): ...@@ -66,7 +66,7 @@ class GitRefs(object):
def _NeedUpdate(self): def _NeedUpdate(self):
Trace(': scan refs %s', self._gitdir) Trace(': scan refs %s', self._gitdir)
for name, mtime in self._mtime.items(): for name, mtime in list(self._mtime.items()):
try: try:
if mtime != os.path.getmtime(os.path.join(self._gitdir, name)): if mtime != os.path.getmtime(os.path.join(self._gitdir, name)):
return True return True
...@@ -89,7 +89,7 @@ class GitRefs(object): ...@@ -89,7 +89,7 @@ class GitRefs(object):
attempts = 0 attempts = 0
while scan and attempts < 5: while scan and attempts < 5:
scan_next = {} scan_next = {}
for name, dest in scan.items(): for name, dest in list(scan.items()):
if dest in self._phyref: if dest in self._phyref:
self._phyref[name] = self._phyref[dest] self._phyref[name] = self._phyref[dest]
else: else:
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import getpass import getpass
import imp import imp
import netrc import netrc
...@@ -298,7 +298,7 @@ def _AddPasswordFromUserInput(handler, msg, req): ...@@ -298,7 +298,7 @@ def _AddPasswordFromUserInput(handler, msg, req):
if user is None: if user is None:
print(msg) print(msg)
try: try:
user = input('User: ') user = eval(input('User: '))
password = getpass.getpass() password = getpass.getpass()
except KeyboardInterrupt: except KeyboardInterrupt:
return return
......
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import itertools import itertools
import os import os
import re import re
import sys import sys
import urllib import urllib.request, urllib.parse, urllib.error
import xml.dom.minidom import xml.dom.minidom
import xml.parsers.expat import xml.parsers.expat
...@@ -268,7 +268,7 @@ class XmlManifest(object): ...@@ -268,7 +268,7 @@ class XmlManifest(object):
sort_projects.sort() sort_projects.sort()
output_projects(p, e, sort_projects) output_projects(p, e, sort_projects)
sort_projects = [key for key in self.projects.keys() sort_projects = [key for key in list(self.projects.keys())
if not self.projects[key].parent] if not self.projects[key].parent]
sort_projects.sort() sort_projects.sort()
output_projects(None, root, sort_projects) output_projects(None, root, sort_projects)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import os import os
import select import select
import sys import sys
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import traceback import traceback
import errno import errno
import filecmp import filecmp
...@@ -79,7 +79,7 @@ def _ProjectHooks(): ...@@ -79,7 +79,7 @@ def _ProjectHooks():
if _project_hook_list is None: if _project_hook_list is None:
d = os.path.abspath(os.path.dirname(__file__)) d = os.path.abspath(os.path.dirname(__file__))
d = os.path.join(d , 'hooks') d = os.path.join(d , 'hooks')
_project_hook_list = map(lambda x: os.path.join(d, x), os.listdir(d)) _project_hook_list = [os.path.join(d, x) for x in os.listdir(d)]
return _project_hook_list return _project_hook_list
...@@ -362,7 +362,7 @@ class RepoHook(object): ...@@ -362,7 +362,7 @@ class RepoHook(object):
'Do you want to allow this script to run ' 'Do you want to allow this script to run '
'(yes/yes-never-ask-again/NO)? ') % ( '(yes/yes-never-ask-again/NO)? ') % (
self._GetMustVerb(), self._script_fullpath) self._GetMustVerb(), self._script_fullpath)
response = raw_input(prompt).lower() response = input(prompt).lower()
print() print()
# User is doing a one-time approval. # User is doing a one-time approval.
...@@ -407,7 +407,7 @@ class RepoHook(object): ...@@ -407,7 +407,7 @@ class RepoHook(object):
# and convert to a HookError w/ just the failing traceback. # and convert to a HookError w/ just the failing traceback.
context = {} context = {}
try: try:
execfile(self._script_fullpath, context) exec(compile(open(self._script_fullpath).read(), self._script_fullpath, 'exec'), context)
except Exception: except Exception:
raise HookError('%s\nFailed to import %s hook; see traceback above.' % ( raise HookError('%s\nFailed to import %s hook; see traceback above.' % (
traceback.format_exc(), self._hook_type)) traceback.format_exc(), self._hook_type))
...@@ -645,7 +645,7 @@ class Project(object): ...@@ -645,7 +645,7 @@ class Project(object):
all_refs = self._allrefs all_refs = self._allrefs
heads = {} heads = {}
for name, ref_id in all_refs.items(): for name, ref_id in list(all_refs.items()):
if name.startswith(R_HEADS): if name.startswith(R_HEADS):
name = name[len(R_HEADS):] name = name[len(R_HEADS):]
b = self.GetBranch(name) b = self.GetBranch(name)
...@@ -654,7 +654,7 @@ class Project(object): ...@@ -654,7 +654,7 @@ class Project(object):
b.revision = ref_id b.revision = ref_id
heads[name] = b heads[name] = b
for name, ref_id in all_refs.items(): for name, ref_id in list(all_refs.items()):
if name.startswith(R_PUB): if name.startswith(R_PUB):
name = name[len(R_PUB):] name = name[len(R_PUB):]
b = heads.get(name) b = heads.get(name)
...@@ -751,8 +751,8 @@ class Project(object): ...@@ -751,8 +751,8 @@ class Project(object):
out.nl() out.nl()
paths = list() paths = list()
paths.extend(di.keys()) paths.extend(list(di.keys()))
paths.extend(df.keys()) paths.extend(list(df.keys()))
paths.extend(do) paths.extend(do)
paths = list(set(paths)) paths = list(set(paths))
...@@ -850,13 +850,13 @@ class Project(object): ...@@ -850,13 +850,13 @@ class Project(object):
all_refs = self._allrefs all_refs = self._allrefs
heads = set() heads = set()
canrm = {} canrm = {}
for name, ref_id in all_refs.items(): for name, ref_id in list(all_refs.items()):
if name.startswith(R_HEADS): if name.startswith(R_HEADS):
heads.add(name) heads.add(name)
elif name.startswith(R_PUB): elif name.startswith(R_PUB):
canrm[name] = ref_id canrm[name] = ref_id
for name, ref_id in canrm.items(): for name, ref_id in list(canrm.items()):
n = name[len(R_PUB):] n = name[len(R_PUB):]
if R_HEADS + n not in heads: if R_HEADS + n not in heads:
self.bare_git.DeleteRef(name, ref_id) self.bare_git.DeleteRef(name, ref_id)
...@@ -867,14 +867,14 @@ class Project(object): ...@@ -867,14 +867,14 @@ class Project(object):
heads = {} heads = {}
pubed = {} pubed = {}
for name, ref_id in self._allrefs.items(): for name, ref_id in list(self._allrefs.items()):
if name.startswith(R_HEADS): if name.startswith(R_HEADS):
heads[name[len(R_HEADS):]] = ref_id heads[name[len(R_HEADS):]] = ref_id
elif name.startswith(R_PUB): elif name.startswith(R_PUB):
pubed[name[len(R_PUB):]] = ref_id pubed[name[len(R_PUB):]] = ref_id
ready = [] ready = []
for branch, ref_id in heads.items(): for branch, ref_id in list(heads.items()):
if branch in pubed and pubed[branch] == ref_id: if branch in pubed and pubed[branch] == ref_id:
continue continue
if selected_branch and branch != selected_branch: if selected_branch and branch != selected_branch:
...@@ -1210,7 +1210,7 @@ class Project(object): ...@@ -1210,7 +1210,7 @@ class Project(object):
cmd = ['fetch', remote.name] cmd = ['fetch', remote.name]
cmd.append('refs/changes/%2.2d/%d/%d' \ cmd.append('refs/changes/%2.2d/%d/%d' \
% (change_id % 100, change_id, patch_id)) % (change_id % 100, change_id, patch_id))
cmd.extend(map(str, remote.fetch)) cmd.extend(list(map(str, remote.fetch)))
if GitCommand(self, cmd, bare=True).Wait() != 0: if GitCommand(self, cmd, bare=True).Wait() != 0:
return None return None
return DownloadedChange(self, return DownloadedChange(self,
...@@ -1352,7 +1352,7 @@ class Project(object): ...@@ -1352,7 +1352,7 @@ class Project(object):
cb = self.CurrentBranch cb = self.CurrentBranch
kill = [] kill = []
left = self._allrefs left = self._allrefs
for name in left.keys(): for name in list(left.keys()):
if name.startswith(R_HEADS): if name.startswith(R_HEADS):
name = name[len(R_HEADS):] name = name[len(R_HEADS):]
if cb is None or name != cb: if cb is None or name != cb:
...@@ -1598,7 +1598,7 @@ class Project(object): ...@@ -1598,7 +1598,7 @@ class Project(object):
ids = set(all_refs.values()) ids = set(all_refs.values())
tmp = set() tmp = set()
for r, ref_id in GitRefs(ref_dir).all.items(): for r, ref_id in list(GitRefs(ref_dir).all.items()):
if r not in all_refs: if r not in all_refs:
if r.startswith(R_TAGS) or remote.WritesTo(r): if r.startswith(R_TAGS) or remote.WritesTo(r):
all_refs[r] = ref_id all_refs[r] = ref_id
...@@ -2066,7 +2066,7 @@ class Project(object): ...@@ -2066,7 +2066,7 @@ class Project(object):
info = _Info(path, *info) info = _Info(path, *info)
if info.status in ('R', 'C'): if info.status in ('R', 'C'):
info.src_path = info.path info.src_path = info.path
info.path = out.next() info.path = next(out)
r[info.path] = info r[info.path] = info
return r return r
finally: finally:
...@@ -2178,7 +2178,7 @@ class Project(object): ...@@ -2178,7 +2178,7 @@ class Project(object):
if not git_require((1, 7, 2)): if not git_require((1, 7, 2)):
raise ValueError('cannot set config on command line for %s()' raise ValueError('cannot set config on command line for %s()'
% name) % name)
for k, v in config.items(): for k, v in list(config.items()):
cmdv.append('-c') cmdv.append('-c')
cmdv.append('%s=%s' % (k, v)) cmdv.append('%s=%s' % (k, v))
cmdv.append(name) cmdv.append(name)
......
...@@ -116,18 +116,8 @@ import re ...@@ -116,18 +116,8 @@ import re
import stat import stat
import subprocess import subprocess
import sys import sys
try: import urllib.request
import urllib2 import urllib.error
except ImportError:
# For python3
import urllib.request
import urllib.error
else:
# For python2
import imp
urllib = imp.new_module('urllib')
urllib.request = urllib2
urllib.error = urllib2
home_dot_repo = os.path.expanduser('~/.repoconfig') home_dot_repo = os.path.expanduser('~/.repoconfig')
gpg_dir = os.path.join(home_dot_repo, 'gnupg') gpg_dir = os.path.join(home_dot_repo, 'gnupg')
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import sys import sys
import os import os
REPO_TRACE = 'REPO_TRACE' REPO_TRACE = 'REPO_TRACE'
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import sys import sys
from command import Command from command import Command
from git_command import git from git_command import git
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import sys import sys
from color import Coloring from color import Coloring
from command import Command from command import Command
...@@ -98,13 +98,13 @@ is shown, then the branch appears in all projects. ...@@ -98,13 +98,13 @@ is shown, then the branch appears in all projects.
project_cnt = len(projects) project_cnt = len(projects)
for project in projects: for project in projects:
for name, b in project.GetBranches().items(): for name, b in list(project.GetBranches().items()):
b.project = project b.project = project
if name not in all_branches: if name not in all_branches:
all_branches[name] = BranchInfo(name) all_branches[name] = BranchInfo(name)
all_branches[name].add(b) all_branches[name].add(b)
names = all_branches.keys() names = list(all_branches.keys())
names.sort() names.sort()
if not names: if not names:
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import sys import sys
from command import Command from command import Command
from progress import Progress from progress import Progress
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import re import re
import sys import sys
from command import Command from command import Command
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import re import re
import sys import sys
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
#import fcntl #import fcntl
import re import re
import os import os
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import sys import sys
from color import Coloring from color import Coloring
from command import PagedCommand from command import PagedCommand
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import re import re
import sys import sys
from formatter import AbstractFormatter, DumbWriter from formatter import AbstractFormatter, DumbWriter
...@@ -34,7 +34,7 @@ Displays detailed usage information about a command. ...@@ -34,7 +34,7 @@ Displays detailed usage information about a command.
def _PrintAllCommands(self): def _PrintAllCommands(self):
print('usage: repo COMMAND [ARGS]') print('usage: repo COMMAND [ARGS]')
print('The complete list of recognized repo commands are:') print('The complete list of recognized repo commands are:')
commandNames = self.commands.keys() commandNames = list(self.commands.keys())
commandNames.sort() commandNames.sort()
maxlen = 0 maxlen = 0
...@@ -56,7 +56,7 @@ Displays detailed usage information about a command. ...@@ -56,7 +56,7 @@ Displays detailed usage information about a command.
print('usage: repo COMMAND [ARGS]') print('usage: repo COMMAND [ARGS]')
print('The most commonly used repo commands are:') print('The most commonly used repo commands are:')
commandNames = [name commandNames = [name
for name in self.commands.keys() for name in list(self.commands.keys())
if self.commands[name].common] if self.commands[name].common]
commandNames.sort() commandNames.sort()
......
...@@ -92,7 +92,7 @@ class Info(PagedCommand): ...@@ -92,7 +92,7 @@ class Info(PagedCommand):
self.headtext(p.revisionExpr) self.headtext(p.revisionExpr)
self.out.nl() self.out.nl()
localBranches = p.GetBranches().keys() localBranches = list(p.GetBranches().keys())
self.heading("Local Branches: ") self.heading("Local Branches: ")
self.redtext(str(len(localBranches))) self.redtext(str(len(localBranches)))
if len(localBranches) > 0: if len(localBranches) > 0:
...@@ -157,7 +157,7 @@ class Info(PagedCommand): ...@@ -157,7 +157,7 @@ class Info(PagedCommand):
all_branches = [] all_branches = []
for project in self.GetProjects(args): for project in self.GetProjects(args):
br = [project.GetUploadableBranch(x) br = [project.GetUploadableBranch(x)
for x in project.GetBranches().keys()] for x in list(project.GetBranches().keys())]
br = [x for x in br if x] br = [x for x in br if x]
if self.opt.current_branch: if self.opt.current_branch:
br = [x for x in br if x.name == project.CurrentBranch] br = [x for x in br if x.name == project.CurrentBranch]
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import os import os
import platform import platform
import re import re
...@@ -160,7 +160,7 @@ to update the working directory files. ...@@ -160,7 +160,7 @@ to update the working directory files.
not m.config.GetString('repo.mirror') == 'true'): not m.config.GetString('repo.mirror') == 'true'):
groups.append(platformize(platform.system().lower())) groups.append(platformize(platform.system().lower()))
elif opt.platform == 'all': elif opt.platform == 'all':
groups.extend(map(platformize, all_platforms)) groups.extend(list(map(platformize, all_platforms)))
elif opt.platform in all_platforms: elif opt.platform in all_platforms:
groups.extend(platformize(opt.platform)) groups.extend(platformize(opt.platform))
elif opt.platform != 'none': elif opt.platform != 'none':
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import re import re
from command import Command, MirrorSafeCommand from command import Command, MirrorSafeCommand
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import os import os
import sys import sys
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
from color import Coloring from color import Coloring
from command import PagedCommand from command import PagedCommand
...@@ -42,7 +42,7 @@ are displayed. ...@@ -42,7 +42,7 @@ are displayed.
all_branches = [] all_branches = []
for project in self.GetProjects(args): for project in self.GetProjects(args):
br = [project.GetUploadableBranch(x) br = [project.GetUploadableBranch(x)
for x in project.GetBranches().keys()] for x in list(project.GetBranches().keys())]
br = [x for x in br if x] br = [x for x in br if x]
if opt.current_branch: if opt.current_branch:
br = [x for x in br if x.name == project.CurrentBranch] br = [x for x in br if x.name == project.CurrentBranch]
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
from color import Coloring from color import Coloring
from command import PagedCommand from command import PagedCommand
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import sys import sys
from command import Command from command import Command
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import sys import sys
from color import Coloring from color import Coloring
...@@ -49,7 +49,7 @@ The '%prog' command stages files to prepare the next commit. ...@@ -49,7 +49,7 @@ The '%prog' command stages files to prepare the next commit.
self.Usage() self.Usage()
def _Interactive(self, opt, args): def _Interactive(self, opt, args):
all_projects = filter(lambda x: x.IsDirty(), self.GetProjects(args)) all_projects = [x for x in self.GetProjects(args) if x.IsDirty()]
if not all_projects: if not all_projects:
print('no projects have uncommitted modifications', file=sys.stderr) print('no projects have uncommitted modifications', file=sys.stderr)
return return
...@@ -98,7 +98,7 @@ The '%prog' command stages files to prepare the next commit. ...@@ -98,7 +98,7 @@ The '%prog' command stages files to prepare the next commit.
_AddI(all_projects[a_index - 1]) _AddI(all_projects[a_index - 1])
continue continue
p = filter(lambda x: x.name == a or x.relpath == a, all_projects) p = [x for x in all_projects if x.name == a or x.relpath == a]
if len(p) == 1: if len(p) == 1:
_AddI(p[0]) _AddI(p[0])
continue continue
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import sys import sys
from command import Command from command import Command
from git_config import IsId from git_config import IsId
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import netrc import netrc
from optparse import SUPPRESS_HELP from optparse import SUPPRESS_HELP
import os import os
...@@ -24,7 +24,7 @@ import socket ...@@ -24,7 +24,7 @@ import socket
import subprocess import subprocess
import sys import sys
import time import time
import urllib import urllib.request, urllib.parse, urllib.error
import xmlrpc import xmlrpc
#try: #try:
...@@ -511,8 +511,8 @@ later is required to fix a server side protocol bug. ...@@ -511,8 +511,8 @@ later is required to fix a server side protocol bug.
branch = branch[len(R_HEADS):] branch = branch[len(R_HEADS):]
env = os.environ.copy() env = os.environ.copy()
if (env.has_key('TARGET_PRODUCT') and if ('TARGET_PRODUCT' in env and
env.has_key('TARGET_BUILD_VARIANT')): 'TARGET_BUILD_VARIANT' in env):
target = '%s-%s' % (env['TARGET_PRODUCT'], target = '%s-%s' % (env['TARGET_PRODUCT'],
env['TARGET_BUILD_VARIANT']) env['TARGET_BUILD_VARIANT'])
[success, manifest_str] = server.GetApprovedManifest(branch, target) [success, manifest_str] = server.GetApprovedManifest(branch, target)
...@@ -642,7 +642,7 @@ def _PostRepoUpgrade(manifest, quiet=False): ...@@ -642,7 +642,7 @@ def _PostRepoUpgrade(manifest, quiet=False):
wrapper = WrapperModule() wrapper = WrapperModule()
if wrapper.NeedSetupGnuPG(): if wrapper.NeedSetupGnuPG():
wrapper.SetupGnuPG(quiet) wrapper.SetupGnuPG(quiet)
for project in manifest.projects.values(): for project in list(manifest.projects.values()):
if project.Exists: if project.Exists:
project.PostRepoUpgrade() project.PostRepoUpgrade()
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import copy import copy
import re import re
import sys import sys
...@@ -33,7 +33,7 @@ def _ConfirmManyUploads(multiple_branches=False): ...@@ -33,7 +33,7 @@ def _ConfirmManyUploads(multiple_branches=False):
print('ATTENTION: You are uploading an unusually high number of commits.') print('ATTENTION: You are uploading an unusually high number of commits.')
print('YOU PROBABLY DO NOT MEAN TO DO THIS. (Did you rebase across' print('YOU PROBABLY DO NOT MEAN TO DO THIS. (Did you rebase across'
'branches?)') 'branches?)')
answer = raw_input("If you are sure you intend to do this, type 'yes': ").strip() answer = input("If you are sure you intend to do this, type 'yes': ").strip()
return answer == "yes" return answer == "yes"
def _die(fmt, *args): def _die(fmt, *args):
...@@ -234,7 +234,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ ...@@ -234,7 +234,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
script.append('') script.append('')
script = [ x.encode('utf-8') script = [ x.encode('utf-8')
if issubclass(type(x), unicode) if issubclass(type(x), str)
else x else x
for x in script ] for x in script ]
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import sys import sys
from command import Command, MirrorSafeCommand from command import Command, MirrorSafeCommand
from git_command import git from git_command import git
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment