Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solidify Python 3 support in the manifest code #23733

Merged
merged 10 commits into from Jul 7, 2020
Merged

Conversation

jgraham
Copy link
Contributor

@jgraham jgraham commented May 21, 2020

No description provided.

@jgraham
Copy link
Contributor Author

jgraham commented May 21, 2020

Oops, meant to mark this as a draft. Will certainly fail some tests

@wpt-pr-bot wpt-pr-bot temporarily deployed to wpt-preview-23733 May 21, 2020 19:07 Inactive
@wpt-pr-bot wpt-pr-bot temporarily deployed to wpt-preview-23733 May 22, 2020 11:48 Inactive
@wpt-pr-bot wpt-pr-bot added the wptrunner The automated test runner, commonly called through ./wpt run label May 22, 2020
@wpt-pr-bot wpt-pr-bot temporarily deployed to wpt-preview-23733 May 22, 2020 13:07 Inactive
@wpt-pr-bot wpt-pr-bot temporarily deployed to wpt-preview-23733 May 22, 2020 13:24 Inactive
@wpt-pr-bot wpt-pr-bot temporarily deployed to wpt-preview-23733 May 22, 2020 17:39 Inactive
@wpt-pr-bot wpt-pr-bot temporarily deployed to wpt-preview-23733 May 22, 2020 17:56 Inactive
@wpt-pr-bot wpt-pr-bot requested a deployment to wpt-preview-23733 July 6, 2020 12:38 Pending
@@ -159,7 +159,8 @@ def download_manifest(
fileobj = io.BytesIO(resp.read())
try:
with gzip.GzipFile(fileobj=fileobj) as gzf:
decompressed = gzf.read() # type: ignore
data = read_gzf(gzf)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need type: ignore here too.

The goal here is to get mypy passing in Python 3; prior to this patch
there were a lot of cases where Python 3 behaviour was broken but not
picked up by the tests (e.g. because it only happened when updating
the manifest or with certain caches or similar). Many of these issues
were seen by mypy, but that had been disabled for Py3 specfically to
avoid having to fix all the issues at the time the annotations were
added. But now we do need that support.

The general approach here is to use the same types for Py 2 and Py
3. In particular we use Text where possible (with a couple of
exceptions where it was easier not to), rather than bytes. The native
str type is avoided wherever possible since this introduces difficult
to debug differences between Python versions.

The preference for Text includes paths, which means we no longer
support running in non-unicode directories (in practice it is likely
to be broken if the path isn't UTF-8 compatible on Unix or UTF-16
compatible on Windows).
Seems like bare pip started defaulting to python 3
RUN pip3 install --upgrade pip
RUN pip3 install virtualenv

# Ensure we have up-to-date six
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting that this still needs addressed as far as I can tell (as in, filing a followup issue or sending a followup PR)

Copy link
Member

@Hexcles Hexcles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FTR, the overall change LGTM. My only concerns back then were the mypy breakage which seems to have been addressed. I'm assuming Stephen's proposed fixes were adopted (not sure since the branch was rebased). These fixes LGTM, too. IMHO, they are not "horrific hacks", but thoughtful workarounds :) Thanks again for the in-depth investigation here and getting this unblocked, Stephen!

@jgraham jgraham merged commit 6a53164 into master Jul 7, 2020
@jgraham jgraham deleted the python3_type_branch branch July 7, 2020 09:52
Hexcles added a commit that referenced this pull request Jul 8, 2020
With #24484 removing the dependency on system six, we are now able to
remove it from the Docker image, which was introduced in #23733.

Removing this has the benefit of avoiding introducing accidental
dependency.
Hexcles added a commit that referenced this pull request Jul 9, 2020
With #24484 removing the dependency on system six, we are now able to
remove it from the Docker image, which was introduced in #23733.

Removing this has the benefit of avoiding introducing accidental
dependency.
gsnedders added a commit to gsnedders/web-platform-tests that referenced this pull request Sep 30, 2021
At least at times, we could end up with the rename limit warning being
output (i.e., `inexact rename detection was skipped due to too many
files`). This then caused our assert to fail, as it relied on the
output following the -z argument and ending without any trailing out.

This warning is absolutely useless for us, as we're just looking to
find out what files have changed, so we don't care if the file is a
rename or not, so we can avoid it by just outright disabling rename
detection.

This was previously fixed in
web-platform-tests#18879 (30c42ec) by
just outright ignoring stderr, but was regressed in
web-platform-tests#23733
(6539f1e). Avoiding the warning being output in the first place
seems like a better solution than ignoring any errors git might
produce.
jgraham pushed a commit that referenced this pull request Oct 1, 2021
At least at times, we could end up with the rename limit warning being
output (i.e., `inexact rename detection was skipped due to too many
files`). This then caused our assert to fail, as it relied on the
output following the -z argument and ending without any trailing out.

This warning is absolutely useless for us, as we're just looking to
find out what files have changed, so we don't care if the file is a
rename or not, so we can avoid it by just outright disabling rename
detection.

This was previously fixed in
#18879 (30c42ec) by
just outright ignoring stderr, but was regressed in
#23733
(6539f1e). Avoiding the warning being output in the first place
seems like a better solution than ignoring any errors git might
produce.
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Oct 5, 2021
… on TC, a=testonly

Automatic update from web-platform-tests
Disable rename detection when looking for changed tests

At least at times, we could end up with the rename limit warning being
output (i.e., `inexact rename detection was skipped due to too many
files`). This then caused our assert to fail, as it relied on the
output following the -z argument and ending without any trailing out.

This warning is absolutely useless for us, as we're just looking to
find out what files have changed, so we don't care if the file is a
rename or not, so we can avoid it by just outright disabling rename
detection.

This was previously fixed in
web-platform-tests/wpt#18879 (30c42ecf9a) by
just outright ignoring stderr, but was regressed in
web-platform-tests/wpt#23733
(6539f1e343). Avoiding the warning being output in the first place
seems like a better solution than ignoring any errors git might
produce.

--
Deal with the different semantics of A..B in git-diff in repo_files_changed

At the moment on TaskCluster we pass something like

{PR base}..{PR head} which is sometimes a small range when parsed as a
range (see gitrevisions(7)), as it is everything reachable from PR
head but not from PR base. By comparison, for git-diff, A..B gives all
changes between the two trees A and B, which if the PR is filed with a
merge-base a long way behind master would be a much larger change.

As such, change repo_files_changed to use the merge-base of A..B, as
this gives us the diff of the commits that are new on the PR branch.

--

wpt-commits: 7cba72c881e666578f1f01c790d2298dd3ee756d, a7514a7da22289bccf9e0ce5e7bc28f75b9dc9bc
wpt-pr: 31037
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Oct 6, 2021
… on TC, a=testonly

Automatic update from web-platform-tests
Disable rename detection when looking for changed tests

At least at times, we could end up with the rename limit warning being
output (i.e., `inexact rename detection was skipped due to too many
files`). This then caused our assert to fail, as it relied on the
output following the -z argument and ending without any trailing out.

This warning is absolutely useless for us, as we're just looking to
find out what files have changed, so we don't care if the file is a
rename or not, so we can avoid it by just outright disabling rename
detection.

This was previously fixed in
web-platform-tests/wpt#18879 (30c42ecf9a) by
just outright ignoring stderr, but was regressed in
web-platform-tests/wpt#23733
(6539f1e343). Avoiding the warning being output in the first place
seems like a better solution than ignoring any errors git might
produce.

--
Deal with the different semantics of A..B in git-diff in repo_files_changed

At the moment on TaskCluster we pass something like

{PR base}..{PR head} which is sometimes a small range when parsed as a
range (see gitrevisions(7)), as it is everything reachable from PR
head but not from PR base. By comparison, for git-diff, A..B gives all
changes between the two trees A and B, which if the PR is filed with a
merge-base a long way behind master would be a much larger change.

As such, change repo_files_changed to use the merge-base of A..B, as
this gives us the diff of the commits that are new on the PR branch.

--

wpt-commits: 7cba72c881e666578f1f01c790d2298dd3ee756d, a7514a7da22289bccf9e0ce5e7bc28f75b9dc9bc
wpt-pr: 31037
Gabisampaio pushed a commit to Gabisampaio/wpt that referenced this pull request Nov 18, 2021
At least at times, we could end up with the rename limit warning being
output (i.e., `inexact rename detection was skipped due to too many
files`). This then caused our assert to fail, as it relied on the
output following the -z argument and ending without any trailing out.

This warning is absolutely useless for us, as we're just looking to
find out what files have changed, so we don't care if the file is a
rename or not, so we can avoid it by just outright disabling rename
detection.

This was previously fixed in
web-platform-tests#18879 (30c42ec) by
just outright ignoring stderr, but was regressed in
web-platform-tests#23733
(6539f1e). Avoiding the warning being output in the first place
seems like a better solution than ignoring any errors git might
produce.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants