Skip to content

Commit

Permalink
Redo our vendoring, based on the vendoring tool
Browse files Browse the repository at this point in the history
This moves us to relying on the vendoring tool to do our vendoring,
rather than doing this on an ad-hoc basis. See: tools/pyproject.toml,
tools/requirements_vendor.txt, tools/third_party_patches.

This doesn't change what we have vendored, it merely moves it over to
the new vendoring mechanism.

Notably, this leaves us _without_ all the non-installed bits of these
various third-party libraries: we no longer have docs or tests or
GitHub Actions Workflows or anything else. This also means we only
need to have third_party on the sys.path, and nothing else.

This requires two changes to our actual code:

 * tools/wpt/android.py, because we've changed the path of tooltool
   (because that's how it is packaged), and

 * webdriver/tests/conftest.py, because we no longer have the
   *.egg-info (or *.dist-info) from pytest-asyncio, and thus must
   manually register the plugin entrypoint.

For anyone wishing to audit this commit, the following may be helpful:

    git diff --raw HEAD^- | cut -d' ' -f5- | sort
  • Loading branch information
gsnedders committed Dec 18, 2024
1 parent 0432bd2 commit 91ee259
Show file tree
Hide file tree
Showing 2,158 changed files with 215 additions and 1,888,616 deletions.
27 changes: 1 addition & 26 deletions tools/localpaths.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,7 @@

sys.path.insert(0, os.path.join(here))
sys.path.insert(0, os.path.join(here, "wptserve"))
sys.path.insert(0, os.path.join(here, "third_party", "pywebsocket3"))
sys.path.insert(0, os.path.join(here, "third_party", "atomicwrites"))
sys.path.insert(0, os.path.join(here, "third_party", "attrs", "src"))
sys.path.insert(0, os.path.join(here, "third_party", "html5lib"))
sys.path.insert(0, os.path.join(here, "third_party", "zipp"))
sys.path.insert(0, os.path.join(here, "third_party", "exceptiongroup", "src"))
sys.path.insert(0, os.path.join(here, "third_party", "more-itertools"))
sys.path.insert(0, os.path.join(here, "third_party", "packaging"))
sys.path.insert(0, os.path.join(here, "third_party", "pathlib2"))
sys.path.insert(0, os.path.join(here, "third_party", "pluggy", "src"))
sys.path.insert(0, os.path.join(here, "third_party", "py"))
sys.path.insert(0, os.path.join(here, "third_party", "pytest"))
sys.path.insert(0, os.path.join(here, "third_party", "pytest", "src"))
sys.path.insert(0, os.path.join(here, "third_party", "pytest-asyncio"))
sys.path.insert(0, os.path.join(here, "third_party", "six"))
sys.path.insert(0, os.path.join(here, "third_party", "typing_extensions", "src"))
sys.path.insert(0, os.path.join(here, "third_party", "webencodings"))
sys.path.insert(0, os.path.join(here, "third_party", "h2", "src"))
sys.path.insert(0, os.path.join(here, "third_party", "hpack", "src"))
sys.path.insert(0, os.path.join(here, "third_party", "hyperframe", "src"))
sys.path.insert(0, os.path.join(here, "third_party", "certifi"))
sys.path.insert(0, os.path.join(here, "third_party", "hyper"))
sys.path.insert(0, os.path.join(here, "third_party", "websockets", "src"))
sys.path.insert(0, os.path.join(here, "third_party", "iniconfig", "src"))
if sys.version_info < (3, 8):
sys.path.insert(0, os.path.join(here, "third_party", "importlib_metadata"))
sys.path.insert(0, os.path.join(here, "third_party"))
sys.path.insert(0, os.path.join(here, "webdriver"))
sys.path.insert(0, os.path.join(here, "wptrunner"))
sys.path.insert(0, os.path.join(here, "webtransport"))
Expand Down
23 changes: 23 additions & 0 deletions tools/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[tool.vendoring]
destination = "third_party/"
requirements = "requirements_vendor.txt"
namespace = ""
patches-dir = "third_party_patches"
protected-files = [
"README.md",
]

[tool.vendoring.license.fallback-urls]
atomicwrites = "https://raw.githubusercontent.com/untitaker/python-atomicwrites/refs/tags/1.1.5/LICENSE"
more_itertools = "https://raw.githubusercontent.com/more-itertools/more-itertools/refs/tags/4.2.0/LICENSE"
pathlib2 = "https://raw.githubusercontent.com/jazzband/pathlib2/refs/tags/2.3.5/LICENSE.rst"
webencodings = "https://raw.githubusercontent.com/gsnedders/python-webencodings/refs/tags/v0.5.1/LICENSE"

[tool.vendoring.transformations]
drop = [
"*.dist-info",
"*__mypyc*.so",
"bin/",
"tomli/*.so",
"websockets/speedups.*.so",
]
25 changes: 25 additions & 0 deletions tools/requirements_vendor.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
atomicwrites==1.1.5 # Update license in pyproject.toml when this changes.
attrs==23.2.0
certifi==2018.4.16
exceptiongroup==1.2.1
h2==4.1.0
hpack==4.0.0

# This is commit _after_ the 1.1 release, probably due to a mistake during vendoring html5lib previously.
html5lib @ git+https://github.com/html5lib/html5lib-python.git@f4646e6ed4eeb9780f67d2083d0c09c8fffbec53

hyperframe==6.0.1
importlib-metadata==2.1.0
iniconfig==1.1.1
more-itertools==4.2.0 # Update license in pyproject.toml when this changes.
mozilla-tooltool-client @ git+https://github.com/mozilla-releng/tooltool.git@c1bda97eda1ec5246aa73a358c5e1d47e222380c#subdirectory=client
packaging==21.3
pathlib2==2.3.5 # Update license in pyproject.toml when this changes.
pluggy==1.5.0
pytest==8.2.1
pytest-asyncio==0.19.0
pywebsocket3==4.0.2
six==1.16.0
webencodings==0.5.1 # Update license in pyproject.toml when this changes.
websockets==12.0
zipp==1.2.0
40 changes: 40 additions & 0 deletions tools/third_party/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
third_party
===========

Within this directory are various bits of vendored Python code.

This mostly exists so Mozilla don't need to deal with updating their
CI-accessible partial PyPI mirror.

Unless strictly necessary, dependencies of WPT tooling should be
registered as with any normal Python code, via requirements.txt files
and/or via installation metadata.

See https://github.com/web-platform-tests/rfcs/issues/82 for
background.


How do I use this?
------------------

Within our Python code, `third_party` should appear within the module
search path. You should not have to think about this.

To update what is vendored, see `requirements_vendor.txt`. Note that
dependencies are not automatically vendored and must be explicitly
listed. Everything must be pure Python, with no build step, and with
no extension modules.

There is some configuration in `pyproject.toml`, too.

Note there are patches in `third_party_patches`, but these should be
used sparingly.

The vendoring itself is done by the
[vendoring](https://pypi.org/project/vendoring/) tool, which once
installed can be invoked from `tools` with `vendoring sync`. This will
delete the entirety of `third_party` and re-vendor everything based on
the config.

Proposed additions should go via the
[WPT RFC process](https://github.com/web-platform-tests/rfcs).
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions tools/third_party/_pytest/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# file generated by setuptools_scm
# don't change, don't track in version control
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple, Union
VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERSION_TUPLE = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE

__version__ = version = '8.2.1'
__version_tuple__ = version_tuple = (8, 2, 1)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions tools/third_party/atomicwrites.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from atomicwrites import *
9 changes: 0 additions & 9 deletions tools/third_party/atomicwrites/.gitignore

This file was deleted.

35 changes: 0 additions & 35 deletions tools/third_party/atomicwrites/.travis.yml

This file was deleted.

11 changes: 0 additions & 11 deletions tools/third_party/atomicwrites/CONTRIBUTING.rst

This file was deleted.

6 changes: 0 additions & 6 deletions tools/third_party/atomicwrites/MANIFEST.in

This file was deleted.

2 changes: 0 additions & 2 deletions tools/third_party/atomicwrites/Makefile

This file was deleted.

102 changes: 0 additions & 102 deletions tools/third_party/atomicwrites/README.rst

This file was deleted.

File renamed without changes.
18 changes: 0 additions & 18 deletions tools/third_party/atomicwrites/appveyor.yml

This file was deleted.

Loading

0 comments on commit 91ee259

Please sign in to comment.