From a5f17dd7b3cef04e687c33b69b033b2fecf0919f Mon Sep 17 00:00:00 2001 From: Gavin Mak Date: Thu, 24 Aug 2023 20:15:15 +0000 Subject: [PATCH] Revert "Drop py2 support in recipe modules" This reverts commit 5819c303f04cc0cba126c6de4286e3e2b9595d0c. Reason for revert: breaking dart builds Original change's description: > Drop py2 support in recipe modules > > python3 is the only supported version of python in depot_tools. > > Bug: 1475402 > Change-Id: I479de09a0c34b438aced35e4ced58a5972108132 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4808518 > Reviewed-by: Josip Sokcevic > Commit-Queue: Gavin Mak Bug: 1475402 Change-Id: I0fef7581835bb25ea7e4f22303eef11e72df9536 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4811596 Commit-Queue: Gavin Mak Reviewed-by: Josip Sokcevic --- recipes/README.recipes.md | 82 +++++++++---------- recipes/recipe_modules/bot_update/__init__.py | 2 +- .../bot_update/examples/full.py | 2 +- .../bot_update/resources/bot_update.py | 32 ++++++-- .../do_not_retry_patch_failures_in_cq.py | 2 +- .../bot_update/tests/download_topics.py | 2 +- .../bot_update/tests/ensure_checkout.py | 2 +- .../recipe_modules/depot_tools/__init__.py | 2 +- .../depot_tools/examples/full.py | 2 +- recipes/recipe_modules/gclient/api.py | 8 +- .../recipe_modules/gclient/examples/full.py | 2 +- .../gclient/resources/cleanup.py | 1 + .../gclient/resources/diff_deps.py | 2 + .../recipe_modules/gclient/tests/diff_deps.py | 2 +- .../gclient/tests/patch_project.py | 2 +- .../gclient/tests/sync_failure.py | 2 +- recipes/recipe_modules/gerrit/__init__.py | 2 +- .../recipe_modules/gerrit/examples/full.py | 2 +- recipes/recipe_modules/git/__init__.py | 2 +- recipes/recipe_modules/git/api.py | 11 ++- .../full.expected/new_branch_failed.json | 2 +- recipes/recipe_modules/git/examples/full.py | 2 +- recipes/recipe_modules/git/tests/number.py | 2 +- recipes/recipe_modules/git_cl/__init__.py | 2 +- recipes/recipe_modules/gitiles/__init__.py | 2 +- recipes/recipe_modules/gitiles/api.py | 17 +++- .../recipe_modules/gitiles/examples/full.py | 2 +- .../gitiles/resources/gerrit_client.py | 14 +++- .../gitiles/tests/parse_repo_url.py | 2 +- recipes/recipe_modules/gsutil/__init__.py | 2 +- .../gsutil/examples/custom_boto.py | 2 +- .../recipe_modules/gsutil/examples/full.py | 2 +- recipes/recipe_modules/osx_sdk/__init__.py | 2 +- .../recipe_modules/osx_sdk/examples/full.py | 2 +- recipes/recipe_modules/presubmit/__init__.py | 2 +- .../recipe_modules/presubmit/examples/full.py | 2 +- .../recipe_modules/presubmit/tests/execute.py | 2 +- .../recipe_modules/presubmit/tests/prepare.py | 2 +- recipes/recipe_modules/tryserver/__init__.py | 2 +- .../recipe_modules/tryserver/examples/full.py | 2 +- .../tests/gerrit_change_fetch_ref_timeout.py | 2 +- .../tryserver/tests/gerrit_change_owner.py | 2 +- .../tests/gerrit_change_target_ref.py | 2 +- .../tryserver/tests/get_change_description.py | 2 +- .../tests/get_files_affected_by_patch.py | 2 +- .../tryserver/tests/get_footers.py | 2 +- .../tryserver/tests/require_is_tryserver.py | 2 +- .../recipe_modules/windows_sdk/__init__.py | 2 +- .../windows_sdk/examples/full.py | 2 +- 49 files changed, 152 insertions(+), 97 deletions(-) diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index 6650efc48..fd8cd6f3a 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -164,30 +164,30 @@ Returns (Path): The "depot_tools" root directory. [DEPS](/recipes/recipe_modules/gclient/__init__.py#1): [git](#recipe_modules-git), [gitiles](#recipe_modules-gitiles), [tryserver](#recipe_modules-tryserver), [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/file][recipe_engine/recipe_modules/file], [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/step][recipe_engine/recipe_modules/step] -#### **class [GclientApi](/recipes/recipe_modules/gclient/api.py#71)([RecipeApi][recipe_engine/wkt/RecipeApi]):** +#### **class [GclientApi](/recipes/recipe_modules/gclient/api.py#77)([RecipeApi][recipe_engine/wkt/RecipeApi]):** -  **@property**
— **def [DepsDiffException](/recipes/recipe_modules/gclient/api.py#418)(self):** +  **@property**
— **def [DepsDiffException](/recipes/recipe_modules/gclient/api.py#424)(self):** -— **def [\_\_call\_\_](/recipes/recipe_modules/gclient/api.py#81)(self, name, cmd, infra_step=True, \*\*kwargs):** +— **def [\_\_call\_\_](/recipes/recipe_modules/gclient/api.py#87)(self, name, cmd, infra_step=True, \*\*kwargs):** Wrapper for easy calling of gclient steps. -— **def [break\_locks](/recipes/recipe_modules/gclient/api.py#285)(self):** +— **def [break\_locks](/recipes/recipe_modules/gclient/api.py#291)(self):** Remove all index.lock files. If a previous run of git crashed, bot was reset, etc... we might end up with leftover index.lock files. -— **def [checkout](/recipes/recipe_modules/gclient/api.py#245)(self, gclient_config=None, revert=RevertOnTryserver, inject_parent_got_revision=True, extra_sync_flags=None, \*\*kwargs):** +— **def [checkout](/recipes/recipe_modules/gclient/api.py#251)(self, gclient_config=None, revert=RevertOnTryserver, inject_parent_got_revision=True, extra_sync_flags=None, \*\*kwargs):** Return a step generator function for gclient checkouts. -  **@staticmethod**
— **def [config\_to\_pythonish](/recipes/recipe_modules/gclient/api.py#133)(cfg):** +  **@staticmethod**
— **def [config\_to\_pythonish](/recipes/recipe_modules/gclient/api.py#139)(cfg):** -— **def [diff\_deps](/recipes/recipe_modules/gclient/api.py#361)(self, cwd):** +— **def [diff\_deps](/recipes/recipe_modules/gclient/api.py#367)(self, cwd):** -— **def [get\_config\_defaults](/recipes/recipe_modules/gclient/api.py#127)(self):** +— **def [get\_config\_defaults](/recipes/recipe_modules/gclient/api.py#133)(self):** -— **def [get\_gerrit\_patch\_root](/recipes/recipe_modules/gclient/api.py#292)(self, gclient_config=None):** +— **def [get\_gerrit\_patch\_root](/recipes/recipe_modules/gclient/api.py#298)(self, gclient_config=None):** Returns local path to the repo where gerrit patch will be applied. @@ -200,7 +200,7 @@ Instead, properly map a repository to a local path using repo_path_map. TODO(nodir): remove this. Update all recipe tests to specify a git_repo matching the recipe. -— **def [get\_repo\_path](/recipes/recipe_modules/gclient/api.py#319)(self, repo_url, gclient_config=None):** +— **def [get\_repo\_path](/recipes/recipe_modules/gclient/api.py#325)(self, repo_url, gclient_config=None):** Returns local path to the repo checkout given its url. @@ -208,7 +208,7 @@ Consults cfg.repo_path_map and fallbacks to urls in configured solutions. Returns None if not found. -  **@staticmethod**
— **def [got\_revision\_reverse\_mapping](/recipes/recipe_modules/gclient/api.py#138)(cfg):** +  **@staticmethod**
— **def [got\_revision\_reverse\_mapping](/recipes/recipe_modules/gclient/api.py#144)(cfg):** Returns the merged got_revision_reverse_mapping. @@ -216,7 +216,7 @@ Returns (dict): A mapping from property name -> project name. It merges the values of the deprecated got_revision_mapping and the new got_revision_reverse_mapping. -— **def [inject\_parent\_got\_revision](/recipes/recipe_modules/gclient/api.py#220)(self, gclient_config=None, override=False):** +— **def [inject\_parent\_got\_revision](/recipes/recipe_modules/gclient/api.py#226)(self, gclient_config=None, override=False):** Match gclient config to build revisions obtained from build_properties. @@ -226,9 +226,9 @@ Args: override (bool) - If True, will forcibly set revision and custom_vars even if the config already contains values for them. -— **def [resolve\_revision](/recipes/recipe_modules/gclient/api.py#155)(self, revision):** +— **def [resolve\_revision](/recipes/recipe_modules/gclient/api.py#161)(self, revision):** -— **def [roll\_deps](/recipes/recipe_modules/gclient/api.py#422)(self, deps_path, dep_updates, strip_prefix_for_gitlink=None, test_data=None):** +— **def [roll\_deps](/recipes/recipe_modules/gclient/api.py#428)(self, deps_path, dep_updates, strip_prefix_for_gitlink=None, test_data=None):** Updates DEPS file to desired revisions, and returns all requried file changes. @@ -249,20 +249,20 @@ Returns: commit hash. Note: we expect DEPS to be in the root of the project. -— **def [runhooks](/recipes/recipe_modules/gclient/api.py#279)(self, args=None, name='runhooks', \*\*kwargs):** +— **def [runhooks](/recipes/recipe_modules/gclient/api.py#285)(self, args=None, name='runhooks', \*\*kwargs):** -— **def [set\_patch\_repo\_revision](/recipes/recipe_modules/gclient/api.py#349)(self, gclient_config=None):** +— **def [set\_patch\_repo\_revision](/recipes/recipe_modules/gclient/api.py#355)(self, gclient_config=None):** Updates config revision corresponding to patched project. Useful for bot_update only, as this is the only consumer of gclient's config revision map. This doesn't overwrite the revision if it was already set. -  **@spec_alias.deleter**
— **def [spec\_alias](/recipes/recipe_modules/gclient/api.py#123)(self):** +  **@spec_alias.deleter**
— **def [spec\_alias](/recipes/recipe_modules/gclient/api.py#129)(self):** -— **def [sync](/recipes/recipe_modules/gclient/api.py#160)(self, cfg, extra_sync_flags=None, \*\*kwargs):** +— **def [sync](/recipes/recipe_modules/gclient/api.py#166)(self, cfg, extra_sync_flags=None, \*\*kwargs):** -  **@use_mirror.setter**
— **def [use\_mirror](/recipes/recipe_modules/gclient/api.py#110)(self, val):** +  **@use_mirror.setter**
— **def [use\_mirror](/recipes/recipe_modules/gclient/api.py#116)(self, val):** ### *recipe_modules* / [gerrit](/recipes/recipe_modules/gerrit) [DEPS](/recipes/recipe_modules/gerrit/__init__.py#3): [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/file][recipe_engine/recipe_modules/file], [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/step][recipe_engine/recipe_modules/step], [recipe\_engine/time][recipe_engine/recipe_modules/time] @@ -406,13 +406,13 @@ Returns: [DEPS](/recipes/recipe_modules/git/__init__.py#3): [depot\_tools](#recipe_modules-depot_tools), [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/runtime][recipe_engine/recipe_modules/runtime], [recipe\_engine/step][recipe_engine/recipe_modules/step] -#### **class [GitApi](/recipes/recipe_modules/git/api.py#11)([RecipeApi][recipe_engine/wkt/RecipeApi]):** +#### **class [GitApi](/recipes/recipe_modules/git/api.py#19)([RecipeApi][recipe_engine/wkt/RecipeApi]):** -— **def [\_\_call\_\_](/recipes/recipe_modules/git/api.py#14)(self, \*args, \*\*kwargs):** +— **def [\_\_call\_\_](/recipes/recipe_modules/git/api.py#22)(self, \*args, \*\*kwargs):** Returns a git command step. -— **def [bundle\_create](/recipes/recipe_modules/git/api.py#373)(self, bundle_path, rev_list_args=None, \*\*kwargs):** +— **def [bundle\_create](/recipes/recipe_modules/git/api.py#382)(self, bundle_path, rev_list_args=None, \*\*kwargs):** Runs 'git bundle create' on a Git repository. @@ -422,11 +422,11 @@ Args: refs in the Git checkout will be bundled. * kwargs: Forwarded to '__call__'. -— **def [cat\_file\_at\_commit](/recipes/recipe_modules/git/api.py#34)(self, file_path, commit_hash, remote_name=None, \*\*kwargs):** +— **def [cat\_file\_at\_commit](/recipes/recipe_modules/git/api.py#42)(self, file_path, commit_hash, remote_name=None, \*\*kwargs):** Outputs the contents of a file at a given revision. -— **def [checkout](/recipes/recipe_modules/git/api.py#107)(self, url, ref=None, dir_path=None, recursive=False, submodules=True, submodule_update_force=False, keep_paths=None, step_suffix=None, curl_trace_file=None, raise_on_failure=True, set_got_revision=False, remote_name=None, display_fetch_size=None, file_name=None, submodule_update_recursive=True, use_git_cache=False, progress=True, tags=False):** +— **def [checkout](/recipes/recipe_modules/git/api.py#116)(self, url, ref=None, dir_path=None, recursive=False, submodules=True, submodule_update_force=False, keep_paths=None, step_suffix=None, curl_trace_file=None, raise_on_failure=True, set_got_revision=False, remote_name=None, display_fetch_size=None, file_name=None, submodule_update_recursive=True, use_git_cache=False, progress=True, tags=False):** Performs a full git checkout and returns sha1 of checked out revision. @@ -465,7 +465,7 @@ Args: Returns: If the checkout was successful, this returns the commit hash of the checked-out-repo. Otherwise this returns None. -— **def [config\_get](/recipes/recipe_modules/git/api.py#342)(self, prop_name, \*\*kwargs):** +— **def [config\_get](/recipes/recipe_modules/git/api.py#351)(self, prop_name, \*\*kwargs):** Returns git config output. @@ -475,7 +475,7 @@ Args: Returns: (str) The Git config output, or None if no output was generated. -— **def [count\_objects](/recipes/recipe_modules/git/api.py#42)(self, previous_result=None, raise_on_failure=False, \*\*kwargs):** +— **def [count\_objects](/recipes/recipe_modules/git/api.py#50)(self, previous_result=None, raise_on_failure=False, \*\*kwargs):** Returns `git count-objects` result as a dict. @@ -488,11 +488,11 @@ Args: Returns: A dict of count-object values, or None if count-object run failed. -— **def [fetch\_tags](/recipes/recipe_modules/git/api.py#28)(self, remote_name=None, \*\*kwargs):** +— **def [fetch\_tags](/recipes/recipe_modules/git/api.py#36)(self, remote_name=None, \*\*kwargs):** Fetches all tags from the remote. -— **def [get\_remote\_url](/recipes/recipe_modules/git/api.py#361)(self, remote_name=None, \*\*kwargs):** +— **def [get\_remote\_url](/recipes/recipe_modules/git/api.py#370)(self, remote_name=None, \*\*kwargs):** Returns the remote Git repository URL, or None. @@ -502,11 +502,11 @@ Args: Returns: (str) The URL of the remote Git repository, or None. -— **def [get\_timestamp](/recipes/recipe_modules/git/api.py#313)(self, commit='HEAD', test_data=None, \*\*kwargs):** +— **def [get\_timestamp](/recipes/recipe_modules/git/api.py#322)(self, commit='HEAD', test_data=None, \*\*kwargs):** Find and return the timestamp of the given commit. -— **def [new\_branch](/recipes/recipe_modules/git/api.py#386)(self, branch, name=None, upstream=None, upstream_current=False, \*\*kwargs):** +— **def [new\_branch](/recipes/recipe_modules/git/api.py#395)(self, branch, name=None, upstream=None, upstream_current=False, \*\*kwargs):** Runs git new-branch on a Git repository, to be used before git cl upload. @@ -518,7 +518,7 @@ Args: * upstream_current (bool): whether to use '--upstream_current'. * kwargs: Forwarded to '__call__'. -— **def [number](/recipes/recipe_modules/git/api.py#417)(self, commitrefs=None, test_values=None):** +— **def [number](/recipes/recipe_modules/git/api.py#426)(self, commitrefs=None, test_values=None):** Computes the generation number of some commits. @@ -535,7 +535,7 @@ A list of strings containing the generation numbers of the commits. If non-empty commitrefs was provided, the order of the returned numbers will correspond to the order of the provided commitrefs. -— **def [rebase](/recipes/recipe_modules/git/api.py#322)(self, name_prefix, branch, dir_path, remote_name=None, \*\*kwargs):** +— **def [rebase](/recipes/recipe_modules/git/api.py#331)(self, name_prefix, branch, dir_path, remote_name=None, \*\*kwargs):** Runs rebase HEAD onto branch @@ -574,16 +574,16 @@ If you set `path` to None, this will remove the default. [DEPS](/recipes/recipe_modules/gitiles/__init__.py#7): [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/step][recipe_engine/recipe_modules/step], [recipe\_engine/url][recipe_engine/recipe_modules/url] -#### **class [Gitiles](/recipes/recipe_modules/gitiles/api.py#11)([RecipeApi][recipe_engine/wkt/RecipeApi]):** +#### **class [Gitiles](/recipes/recipe_modules/gitiles/api.py#18)([RecipeApi][recipe_engine/wkt/RecipeApi]):** Module for polling a git repository using the Gitiles web interface. -— **def [canonicalize\_repo\_url](/recipes/recipe_modules/gitiles/api.py#222)(self, repo_url):** +— **def [canonicalize\_repo\_url](/recipes/recipe_modules/gitiles/api.py#231)(self, repo_url):** Returns a canonical form of repo_url. If not recognized, returns as is. -— **def [commit\_log](/recipes/recipe_modules/gitiles/api.py#114)(self, url, commit, step_name=None, attempts=None):** +— **def [commit\_log](/recipes/recipe_modules/gitiles/api.py#121)(self, url, commit, step_name=None, attempts=None):** Returns: (dict) the Gitiles commit log structure for a given commit. @@ -593,7 +593,7 @@ Args: * step_name (str): If not None, override the step name. * attempts (int): Number of times to try the request before failing. -— **def [download\_archive](/recipes/recipe_modules/gitiles/api.py#162)(self, repository_url, destination, revision='refs/heads/main'):** +— **def [download\_archive](/recipes/recipe_modules/gitiles/api.py#171)(self, repository_url, destination, revision='refs/heads/main'):** Downloads an archive of the repo and extracts it to `destination`. @@ -609,7 +609,7 @@ Args: * revision (str): The ref or revision in the repo to download. Defaults to 'refs/heads/main'. -— **def [download\_file](/recipes/recipe_modules/gitiles/api.py#130)(self, repository_url, file_path, branch='main', step_name=None, attempts=None, \*\*kwargs):** +— **def [download\_file](/recipes/recipe_modules/gitiles/api.py#137)(self, repository_url, file_path, branch='main', step_name=None, attempts=None, \*\*kwargs):** Downloads raw file content from a Gitiles repository. @@ -623,7 +623,7 @@ Args: Returns: Raw file content. -— **def [log](/recipes/recipe_modules/gitiles/api.py#68)(self, url, ref, limit=0, cursor=None, step_name=None, attempts=None, \*\*kwargs):** +— **def [log](/recipes/recipe_modules/gitiles/api.py#75)(self, url, ref, limit=0, cursor=None, step_name=None, attempts=None, \*\*kwargs):** Returns the most recent commits under the given ref with properties. @@ -646,17 +646,17 @@ Returns: Cursor can be used for subsequent calls to log for paging. If None, signals that there are no more commits to fetch. -— **def [parse\_repo\_url](/recipes/recipe_modules/gitiles/api.py#211)(self, repo_url):** +— **def [parse\_repo\_url](/recipes/recipe_modules/gitiles/api.py#220)(self, repo_url):** Returns (host, project) pair. Returns (None, None) if repo_url is not recognized. -— **def [refs](/recipes/recipe_modules/gitiles/api.py#56)(self, url, step_name='refs', attempts=None):** +— **def [refs](/recipes/recipe_modules/gitiles/api.py#63)(self, url, step_name='refs', attempts=None):** Returns a list of refs in the remote repository. -— **def [unparse\_repo\_url](/recipes/recipe_modules/gitiles/api.py#218)(self, host, project):** +— **def [unparse\_repo\_url](/recipes/recipe_modules/gitiles/api.py#227)(self, host, project):** Generates a Gitiles repo URL. See also parse_repo_url. ### *recipe_modules* / [gsutil](/recipes/recipe_modules/gsutil) diff --git a/recipes/recipe_modules/bot_update/__init__.py b/recipes/recipe_modules/bot_update/__init__.py index a8fdef3a1..6bb3d2b79 100644 --- a/recipes/recipe_modules/bot_update/__init__.py +++ b/recipes/recipe_modules/bot_update/__init__.py @@ -1,4 +1,4 @@ -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'depot_tools', diff --git a/recipes/recipe_modules/bot_update/examples/full.py b/recipes/recipe_modules/bot_update/examples/full.py index 1d5c6ec00..10b3ee06c 100644 --- a/recipes/recipe_modules/bot_update/examples/full.py +++ b/recipes/recipe_modules/bot_update/examples/full.py @@ -4,7 +4,7 @@ from recipe_engine import post_process -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'bot_update', diff --git a/recipes/recipe_modules/bot_update/resources/bot_update.py b/recipes/recipe_modules/bot_update/resources/bot_update.py index 057bab707..469dac6bb 100755 --- a/recipes/recipe_modules/bot_update/resources/bot_update.py +++ b/recipes/recipe_modules/bot_update/resources/bot_update.py @@ -5,6 +5,9 @@ # TODO(hinoka): Use logging. +from __future__ import division +from __future__ import print_function + import codecs from contextlib import contextmanager import copy @@ -25,8 +28,18 @@ import uuid import os.path as path +# TODO(crbug.com/1227140): Clean up when py2 is no longer supported. from io import BytesIO -from urllib.parse import urlparse +try: + import urlparse +except ImportError: # pragma: no cover + import urllib.parse as urlparse + +# Cache the string-escape codec to ensure subprocess can find it later. +# See crbug.com/912292#c2 for context. +# TODO(crbug.com/1227140): Clean up when py2 is no longer supported. +if sys.version_info.major == 2: + codecs.lookup('string-escape') # How many bytes at a time to read from pipes. BUF_SIZE = 256 @@ -156,6 +169,13 @@ def _kill_process(proc): proc.kill() +# TODO(crbug.com/1227140): Clean up when py2 is no longer supported. +def _stdout_write(buf): + try: + sys.stdout.buffer.write(buf) + except AttributeError: + sys.stdout.write(buf) + def call(*args, **kwargs): # pragma: no cover """Interactive subprocess call.""" @@ -215,10 +235,10 @@ def call(*args, **kwargs): # pragma: no cover if hanging_cr: buf = buf[:-1] buf = buf.replace(b'\r\n', b'\n').replace(b'\r', b'\n') - sys.stdout.buffer.write(buf) + _stdout_write(buf) out.write(buf) if hanging_cr: - sys.stdout.buffer.write(b'\n') + _stdout_write(b'\n') out.write(b'\n') code = proc.wait() @@ -311,7 +331,7 @@ def modify_solutions(input_solutions): solutions = copy.deepcopy(input_solutions) for solution in solutions: original_url = solution['url'] - parsed_url = urlparse(original_url) + parsed_url = urlparse.urlparse(original_url) parsed_path = parsed_url.path solution['managed'] = False @@ -458,7 +478,7 @@ def normalize_git_url(url): * Do not contain /a/ in their path. """ try: - p = urlparse(url) + p = urlparse.urlparse(url) except Exception: # Not a url, just return it back. return url @@ -873,7 +893,7 @@ def parse_revisions(revisions, root): # This is an alt_root@revision argument. current_root, current_rev = split_revision - parsed_root = urlparse(current_root) + parsed_root = urlparse.urlparse(current_root) if parsed_root.scheme in ['http', 'https']: # We want to normalize git urls into .git urls. normalized_root = 'https://' + parsed_root.netloc + parsed_root.path diff --git a/recipes/recipe_modules/bot_update/tests/do_not_retry_patch_failures_in_cq.py b/recipes/recipe_modules/bot_update/tests/do_not_retry_patch_failures_in_cq.py index c52aae407..c490202fa 100644 --- a/recipes/recipe_modules/bot_update/tests/do_not_retry_patch_failures_in_cq.py +++ b/recipes/recipe_modules/bot_update/tests/do_not_retry_patch_failures_in_cq.py @@ -4,7 +4,7 @@ from recipe_engine import post_process -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'bot_update', diff --git a/recipes/recipe_modules/bot_update/tests/download_topics.py b/recipes/recipe_modules/bot_update/tests/download_topics.py index 66f481879..f12e00056 100644 --- a/recipes/recipe_modules/bot_update/tests/download_topics.py +++ b/recipes/recipe_modules/bot_update/tests/download_topics.py @@ -4,7 +4,7 @@ from recipe_engine import post_process -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'bot_update', diff --git a/recipes/recipe_modules/bot_update/tests/ensure_checkout.py b/recipes/recipe_modules/bot_update/tests/ensure_checkout.py index ba704172d..e49a41aca 100644 --- a/recipes/recipe_modules/bot_update/tests/ensure_checkout.py +++ b/recipes/recipe_modules/bot_update/tests/ensure_checkout.py @@ -4,7 +4,7 @@ from recipe_engine import post_process -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'bot_update', diff --git a/recipes/recipe_modules/depot_tools/__init__.py b/recipes/recipe_modules/depot_tools/__init__.py index a04aee84d..c9f0de463 100644 --- a/recipes/recipe_modules/depot_tools/__init__.py +++ b/recipes/recipe_modules/depot_tools/__init__.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'recipe_engine/cipd', diff --git a/recipes/recipe_modules/depot_tools/examples/full.py b/recipes/recipe_modules/depot_tools/examples/full.py index 13e6743e9..ace3d486b 100644 --- a/recipes/recipe_modules/depot_tools/examples/full.py +++ b/recipes/recipe_modules/depot_tools/examples/full.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'depot_tools', diff --git a/recipes/recipe_modules/gclient/api.py b/recipes/recipe_modules/gclient/api.py index cf604499f..49a36d6db 100644 --- a/recipes/recipe_modules/gclient/api.py +++ b/recipes/recipe_modules/gclient/api.py @@ -4,6 +4,12 @@ import re +# TODO(crbug.com/1227140): Clean up when py2 is no longer supported. +try: + _STRING_TYPE = basestring +except NameError: # pragma: no cover + _STRING_TYPE = str + from recipe_engine import recipe_api class DepsDiffException(Exception): @@ -62,7 +68,7 @@ def jsonish_to_python(spec, is_top=False): ret += '[' ret += ', '.join(jsonish_to_python(x) for x in spec) ret += ']' - elif isinstance(spec, str): + elif isinstance(spec, _STRING_TYPE): ret = repr(str(spec)) else: ret = repr(spec) diff --git a/recipes/recipe_modules/gclient/examples/full.py b/recipes/recipe_modules/gclient/examples/full.py index ccd40c57a..bddcf2e1c 100644 --- a/recipes/recipe_modules/gclient/examples/full.py +++ b/recipes/recipe_modules/gclient/examples/full.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'gclient', diff --git a/recipes/recipe_modules/gclient/resources/cleanup.py b/recipes/recipe_modules/gclient/resources/cleanup.py index d6ea2491a..557baeda9 100644 --- a/recipes/recipe_modules/gclient/resources/cleanup.py +++ b/recipes/recipe_modules/gclient/resources/cleanup.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +from __future__ import print_function import os, sys build_path = sys.argv[1] diff --git a/recipes/recipe_modules/gclient/resources/diff_deps.py b/recipes/recipe_modules/gclient/resources/diff_deps.py index 2b7ec0d17..1148d49aa 100755 --- a/recipes/recipe_modules/gclient/resources/diff_deps.py +++ b/recipes/recipe_modules/gclient/resources/diff_deps.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +from __future__ import print_function + import os import subprocess import sys diff --git a/recipes/recipe_modules/gclient/tests/diff_deps.py b/recipes/recipe_modules/gclient/tests/diff_deps.py index e267ca905..34f412c23 100644 --- a/recipes/recipe_modules/gclient/tests/diff_deps.py +++ b/recipes/recipe_modules/gclient/tests/diff_deps.py @@ -5,7 +5,7 @@ from recipe_engine.post_process import (DropExpectation, StatusSuccess, SummaryMarkdown) -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'recipe_engine/assertions', diff --git a/recipes/recipe_modules/gclient/tests/patch_project.py b/recipes/recipe_modules/gclient/tests/patch_project.py index c38e65e1a..02a41af49 100644 --- a/recipes/recipe_modules/gclient/tests/patch_project.py +++ b/recipes/recipe_modules/gclient/tests/patch_project.py @@ -6,7 +6,7 @@ from recipe_engine import post_process from recipe_engine import recipe_api -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'recipe_engine/buildbucket', diff --git a/recipes/recipe_modules/gclient/tests/sync_failure.py b/recipes/recipe_modules/gclient/tests/sync_failure.py index f295b1947..8d23c2897 100644 --- a/recipes/recipe_modules/gclient/tests/sync_failure.py +++ b/recipes/recipe_modules/gclient/tests/sync_failure.py @@ -4,7 +4,7 @@ from recipe_engine import post_process -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'recipe_engine/path', diff --git a/recipes/recipe_modules/gerrit/__init__.py b/recipes/recipe_modules/gerrit/__init__.py index a80536c85..f18d326ea 100644 --- a/recipes/recipe_modules/gerrit/__init__.py +++ b/recipes/recipe_modules/gerrit/__init__.py @@ -1,4 +1,4 @@ -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'recipe_engine/context', diff --git a/recipes/recipe_modules/gerrit/examples/full.py b/recipes/recipe_modules/gerrit/examples/full.py index 0178771c1..f297c67b0 100644 --- a/recipes/recipe_modules/gerrit/examples/full.py +++ b/recipes/recipe_modules/gerrit/examples/full.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'gerrit', diff --git a/recipes/recipe_modules/git/__init__.py b/recipes/recipe_modules/git/__init__.py index 9feb9feae..87a7d4c0f 100644 --- a/recipes/recipe_modules/git/__init__.py +++ b/recipes/recipe_modules/git/__init__.py @@ -1,4 +1,4 @@ -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'depot_tools', diff --git a/recipes/recipe_modules/git/api.py b/recipes/recipe_modules/git/api.py index fc3bf92d8..a29c8a5a8 100644 --- a/recipes/recipe_modules/git/api.py +++ b/recipes/recipe_modules/git/api.py @@ -2,9 +2,17 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +from __future__ import division + import itertools import re +# TODO(crbug.com/1227140): Clean up when py2 is no longer supported. +try: + _INTEGER_TYPES = (int, long) +except NameError: # pragma: no cover + _INTEGER_TYPES = (int,) + from recipe_engine import recipe_api from recipe_engine import util as recipe_util @@ -53,7 +61,8 @@ class GitApi(recipe_api.RecipeApi): """ if previous_result: assert isinstance(previous_result, dict) - assert all(isinstance(v, int) for v in previous_result.values()) + assert all( + isinstance(v, _INTEGER_TYPES) for v in previous_result.values()) assert 'size' in previous_result assert 'size-pack' in previous_result diff --git a/recipes/recipe_modules/git/examples/full.expected/new_branch_failed.json b/recipes/recipe_modules/git/examples/full.expected/new_branch_failed.json index efa4feb98..09be91141 100644 --- a/recipes/recipe_modules/git/examples/full.expected/new_branch_failed.json +++ b/recipes/recipe_modules/git/examples/full.expected/new_branch_failed.json @@ -184,7 +184,7 @@ "Traceback (most recent call last):", " File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/git/examples/full.py\", line 81, in RunSteps", " api.git.new_branch('failed_new_branch', upstream='will_fail', upstream_current=True) #pylint: disable = line-too-long", - " File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/git/api.py\", line 403, in new_branch", + " File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/git/api.py\", line 412, in new_branch", " raise ValueError('Can not define both upstream and upstream_current')", "ValueError('Can not define both upstream and upstream_current')" ] diff --git a/recipes/recipe_modules/git/examples/full.py b/recipes/recipe_modules/git/examples/full.py index ca2618a8a..50e6383f8 100644 --- a/recipes/recipe_modules/git/examples/full.py +++ b/recipes/recipe_modules/git/examples/full.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'recipe_engine/buildbucket', diff --git a/recipes/recipe_modules/git/tests/number.py b/recipes/recipe_modules/git/tests/number.py index 0e7c223df..409ba7810 100644 --- a/recipes/recipe_modules/git/tests/number.py +++ b/recipes/recipe_modules/git/tests/number.py @@ -4,7 +4,7 @@ from recipe_engine import post_process -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'git', diff --git a/recipes/recipe_modules/git_cl/__init__.py b/recipes/recipe_modules/git_cl/__init__.py index 49251fae0..ce1b5f6af 100644 --- a/recipes/recipe_modules/git_cl/__init__.py +++ b/recipes/recipe_modules/git_cl/__init__.py @@ -1,4 +1,4 @@ -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'recipe_engine/context', diff --git a/recipes/recipe_modules/gitiles/__init__.py b/recipes/recipe_modules/gitiles/__init__.py index a4e92dfa6..bafccecbf 100644 --- a/recipes/recipe_modules/gitiles/__init__.py +++ b/recipes/recipe_modules/gitiles/__init__.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'recipe_engine/json', diff --git a/recipes/recipe_modules/gitiles/api.py b/recipes/recipe_modules/gitiles/api.py index 41aae0596..e422063d5 100644 --- a/recipes/recipe_modules/gitiles/api.py +++ b/recipes/recipe_modules/gitiles/api.py @@ -2,8 +2,15 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +from __future__ import division + import base64 -import urllib.parse +import sys + +try: + import urlparse +except ImportError: # pragma: no cover + import urllib.parse as urlparse from recipe_engine import recipe_api @@ -154,8 +161,10 @@ class Gitiles(recipe_api.RecipeApi): value = base64.b64decode(step_result.json.output['value']) try: + # TODO(crbug.com/1227140): Clean up when py2 is no longer supported. # If the file is not utf-8 encodable, return the bytes - value = value.decode('utf-8') + if sys.version_info >= (3,): + value = value.decode('utf-8') finally: return value @@ -231,9 +240,9 @@ class Gitiles(recipe_api.RecipeApi): def parse_http_host_and_path(url): # Copied from https://chromium.googlesource.com/infra/luci/recipes-py/+/809e57935211b3fcb802f74a7844d4f36eff6b87/recipe_modules/buildbucket/util.py - parsed = urllib.parse.urlparse(url) + parsed = urlparse.urlparse(url) if not parsed.scheme: - parsed = urllib.parse.urlparse('https://' + url) + parsed = urlparse.urlparse('https://' + url) if (parsed.scheme in ('http', 'https') and not parsed.params and not parsed.query and diff --git a/recipes/recipe_modules/gitiles/examples/full.py b/recipes/recipe_modules/gitiles/examples/full.py index e19cb0d25..502aa8c18 100644 --- a/recipes/recipe_modules/gitiles/examples/full.py +++ b/recipes/recipe_modules/gitiles/examples/full.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'gitiles', diff --git a/recipes/recipe_modules/gitiles/resources/gerrit_client.py b/recipes/recipe_modules/gitiles/resources/gerrit_client.py index 31c271027..db5245528 100755 --- a/recipes/recipe_modules/gitiles/resources/gerrit_client.py +++ b/recipes/recipe_modules/gitiles/resources/gerrit_client.py @@ -10,6 +10,8 @@ Example usage: -u https://chromium.googlesource.com/chromium/src/+log """ +from __future__ import print_function + import argparse import json import logging @@ -17,7 +19,13 @@ import os import sys import tarfile import time -import urllib.parse + +try: + from urllib import urlencode + import urlparse +except ImportError: # pragma: no cover + from urllib.parse import urlencode + import urllib.parse as urlparse DEPOT_TOOLS = os.path.abspath( os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, @@ -28,13 +36,13 @@ from gerrit_util import CreateHttpConn, ReadHttpResponse, ReadHttpJsonResponse def reparse_url(parsed_url, query_params): - return urllib.parse.ParseResult( + return urlparse.ParseResult( scheme=parsed_url.scheme, netloc=parsed_url.netloc, path=parsed_url.path, params=parsed_url.params, fragment=parsed_url.fragment, - query=urllib.parse.urlencode(query_params, doseq=True)) + query=urlencode(query_params, doseq=True)) def gitiles_get(parsed_url, handler, attempts): diff --git a/recipes/recipe_modules/gitiles/tests/parse_repo_url.py b/recipes/recipe_modules/gitiles/tests/parse_repo_url.py index f68a6c8f4..e0aea64d0 100644 --- a/recipes/recipe_modules/gitiles/tests/parse_repo_url.py +++ b/recipes/recipe_modules/gitiles/tests/parse_repo_url.py @@ -4,7 +4,7 @@ from recipe_engine.post_process import DropExpectation, StatusSuccess -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'gitiles', diff --git a/recipes/recipe_modules/gsutil/__init__.py b/recipes/recipe_modules/gsutil/__init__.py index 606f7220e..e3bd83d2a 100644 --- a/recipes/recipe_modules/gsutil/__init__.py +++ b/recipes/recipe_modules/gsutil/__init__.py @@ -1,6 +1,6 @@ from PB.recipe_modules.depot_tools.gsutil import properties -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'recipe_engine/context', diff --git a/recipes/recipe_modules/gsutil/examples/custom_boto.py b/recipes/recipe_modules/gsutil/examples/custom_boto.py index 5e25f0cc6..c8861d098 100644 --- a/recipes/recipe_modules/gsutil/examples/custom_boto.py +++ b/recipes/recipe_modules/gsutil/examples/custom_boto.py @@ -5,7 +5,7 @@ from recipe_engine import post_process from recipe_engine.recipe_api import Property -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'gsutil', diff --git a/recipes/recipe_modules/gsutil/examples/full.py b/recipes/recipe_modules/gsutil/examples/full.py index b3763f22f..9f524418b 100644 --- a/recipes/recipe_modules/gsutil/examples/full.py +++ b/recipes/recipe_modules/gsutil/examples/full.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'gsutil', diff --git a/recipes/recipe_modules/osx_sdk/__init__.py b/recipes/recipe_modules/osx_sdk/__init__.py index ab3f27b38..53ac956a6 100644 --- a/recipes/recipe_modules/osx_sdk/__init__.py +++ b/recipes/recipe_modules/osx_sdk/__init__.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'recipe_engine/cipd', diff --git a/recipes/recipe_modules/osx_sdk/examples/full.py b/recipes/recipe_modules/osx_sdk/examples/full.py index 7db537acb..c5c603a7e 100644 --- a/recipes/recipe_modules/osx_sdk/examples/full.py +++ b/recipes/recipe_modules/osx_sdk/examples/full.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'osx_sdk', diff --git a/recipes/recipe_modules/presubmit/__init__.py b/recipes/recipe_modules/presubmit/__init__.py index 949286b9d..aa38d5a45 100644 --- a/recipes/recipe_modules/presubmit/__init__.py +++ b/recipes/recipe_modules/presubmit/__init__.py @@ -8,7 +8,7 @@ from recipe_engine.recipe_api import Property from PB.recipe_modules.depot_tools.presubmit import properties -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'bot_update', diff --git a/recipes/recipe_modules/presubmit/examples/full.py b/recipes/recipe_modules/presubmit/examples/full.py index 1d9039ffb..f64090883 100755 --- a/recipes/recipe_modules/presubmit/examples/full.py +++ b/recipes/recipe_modules/presubmit/examples/full.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'presubmit', diff --git a/recipes/recipe_modules/presubmit/tests/execute.py b/recipes/recipe_modules/presubmit/tests/execute.py index 85f756534..545f71ca6 100644 --- a/recipes/recipe_modules/presubmit/tests/execute.py +++ b/recipes/recipe_modules/presubmit/tests/execute.py @@ -7,7 +7,7 @@ import textwrap from recipe_engine import post_process from recipe_engine import recipe_api -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'gclient', diff --git a/recipes/recipe_modules/presubmit/tests/prepare.py b/recipes/recipe_modules/presubmit/tests/prepare.py index d1a7160cc..4aaad2676 100644 --- a/recipes/recipe_modules/presubmit/tests/prepare.py +++ b/recipes/recipe_modules/presubmit/tests/prepare.py @@ -6,7 +6,7 @@ from recipe_engine import post_process from recipe_engine import recipe_api -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'gclient', diff --git a/recipes/recipe_modules/tryserver/__init__.py b/recipes/recipe_modules/tryserver/__init__.py index 5833da2dc..d2a434cfa 100644 --- a/recipes/recipe_modules/tryserver/__init__.py +++ b/recipes/recipe_modules/tryserver/__init__.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'gerrit', diff --git a/recipes/recipe_modules/tryserver/examples/full.py b/recipes/recipe_modules/tryserver/examples/full.py index f9d537e6e..a8504c561 100644 --- a/recipes/recipe_modules/tryserver/examples/full.py +++ b/recipes/recipe_modules/tryserver/examples/full.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'gerrit', diff --git a/recipes/recipe_modules/tryserver/tests/gerrit_change_fetch_ref_timeout.py b/recipes/recipe_modules/tryserver/tests/gerrit_change_fetch_ref_timeout.py index c072d9805..d343f5dc2 100644 --- a/recipes/recipe_modules/tryserver/tests/gerrit_change_fetch_ref_timeout.py +++ b/recipes/recipe_modules/tryserver/tests/gerrit_change_fetch_ref_timeout.py @@ -4,7 +4,7 @@ from recipe_engine import post_process -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'gerrit', diff --git a/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.py b/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.py index 691c6e225..fecec8b9d 100644 --- a/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.py +++ b/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.py @@ -5,7 +5,7 @@ from recipe_engine.post_process import (DropExpectation, StatusSuccess, StepCommandContains) -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'gerrit', diff --git a/recipes/recipe_modules/tryserver/tests/gerrit_change_target_ref.py b/recipes/recipe_modules/tryserver/tests/gerrit_change_target_ref.py index b11d85508..fd84d09cc 100644 --- a/recipes/recipe_modules/tryserver/tests/gerrit_change_target_ref.py +++ b/recipes/recipe_modules/tryserver/tests/gerrit_change_target_ref.py @@ -4,7 +4,7 @@ from recipe_engine import post_process -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'gerrit', diff --git a/recipes/recipe_modules/tryserver/tests/get_change_description.py b/recipes/recipe_modules/tryserver/tests/get_change_description.py index 0d266a862..b56553d78 100644 --- a/recipes/recipe_modules/tryserver/tests/get_change_description.py +++ b/recipes/recipe_modules/tryserver/tests/get_change_description.py @@ -5,7 +5,7 @@ from recipe_engine.post_process import (DropExpectation, StatusSuccess, MustRun, DoesNotRun) -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'tryserver', diff --git a/recipes/recipe_modules/tryserver/tests/get_files_affected_by_patch.py b/recipes/recipe_modules/tryserver/tests/get_files_affected_by_patch.py index 2a65f6183..9607b6fe2 100644 --- a/recipes/recipe_modules/tryserver/tests/get_files_affected_by_patch.py +++ b/recipes/recipe_modules/tryserver/tests/get_files_affected_by_patch.py @@ -4,7 +4,7 @@ from recipe_engine import post_process -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'tryserver', diff --git a/recipes/recipe_modules/tryserver/tests/get_footers.py b/recipes/recipe_modules/tryserver/tests/get_footers.py index 1934d23c3..070bbf677 100644 --- a/recipes/recipe_modules/tryserver/tests/get_footers.py +++ b/recipes/recipe_modules/tryserver/tests/get_footers.py @@ -4,7 +4,7 @@ from recipe_engine import post_process -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'tryserver', diff --git a/recipes/recipe_modules/tryserver/tests/require_is_tryserver.py b/recipes/recipe_modules/tryserver/tests/require_is_tryserver.py index 928cbc33d..8cc7e020d 100644 --- a/recipes/recipe_modules/tryserver/tests/require_is_tryserver.py +++ b/recipes/recipe_modules/tryserver/tests/require_is_tryserver.py @@ -7,7 +7,7 @@ from recipe_engine import post_process from PB.go.chromium.org.luci.swarming.proto.api import swarming as swarming_pb from PB.recipe_modules.recipe_engine.led import properties as led_properties_pb -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'tryserver', diff --git a/recipes/recipe_modules/windows_sdk/__init__.py b/recipes/recipe_modules/windows_sdk/__init__.py index 85edde49c..d5a79dd17 100644 --- a/recipes/recipe_modules/windows_sdk/__init__.py +++ b/recipes/recipe_modules/windows_sdk/__init__.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'recipe_engine/cipd', diff --git a/recipes/recipe_modules/windows_sdk/examples/full.py b/recipes/recipe_modules/windows_sdk/examples/full.py index d956f35c1..20c998d7b 100644 --- a/recipes/recipe_modules/windows_sdk/examples/full.py +++ b/recipes/recipe_modules/windows_sdk/examples/full.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -PYTHON_VERSION_COMPATIBILITY = 'PY3' +PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'windows_sdk',