diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/tools/third_party/zipp | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/tools/third_party/zipp')
28 files changed, 1187 insertions, 0 deletions
diff --git a/testing/web-platform/tests/tools/third_party/zipp/.flake8 b/testing/web-platform/tests/tools/third_party/zipp/.flake8 new file mode 100644 index 0000000000..790c109fdb --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/.flake8 @@ -0,0 +1,9 @@ +[flake8] +max-line-length = 88 +ignore = + # W503 violates spec https://github.com/PyCQA/pycodestyle/issues/513 + W503 + # W504 has issues https://github.com/OCA/maintainer-quality-tools/issues/545 + W504 + # Black creates whitespace before colon + E203 diff --git a/testing/web-platform/tests/tools/third_party/zipp/.github/workflows/main.yml b/testing/web-platform/tests/tools/third_party/zipp/.github/workflows/main.yml new file mode 100644 index 0000000000..8c5c232c36 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/.github/workflows/main.yml @@ -0,0 +1,42 @@ +name: Automated Tests + +on: [push, pull_request] + +jobs: + test: + strategy: + matrix: + python: [3.6, 3.8, 3.9] + platform: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Install tox + run: | + python -m pip install tox + - name: Run tests + run: tox + + release: + needs: test + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install tox + run: | + python -m pip install tox + - name: Release + run: tox -e release + env: + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/testing/web-platform/tests/tools/third_party/zipp/.pre-commit-config.yaml b/testing/web-platform/tests/tools/third_party/zipp/.pre-commit-config.yaml new file mode 100644 index 0000000000..922d94247a --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: +- repo: https://github.com/ambv/black + rev: 18.9b0 + hooks: + - id: black diff --git a/testing/web-platform/tests/tools/third_party/zipp/.readthedocs.yml b/testing/web-platform/tests/tools/third_party/zipp/.readthedocs.yml new file mode 100644 index 0000000000..8ae4468428 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/.readthedocs.yml @@ -0,0 +1,5 @@ +python: + version: 3 + extra_requirements: + - docs + pip_install: true diff --git a/testing/web-platform/tests/tools/third_party/zipp/.travis.yml b/testing/web-platform/tests/tools/third_party/zipp/.travis.yml new file mode 100644 index 0000000000..b7d8f3ac9d --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/.travis.yml @@ -0,0 +1,28 @@ +dist: xenial +language: python + +python: +- 2.7 +- 3.6 +- &latest_py3 3.8 + +jobs: + fast_finish: true + include: + - stage: deploy + if: tag IS present + python: *latest_py3 + before_script: skip + script: tox -e release + +cache: pip + +install: +- pip install tox tox-venv + +before_script: + # Disable IPv6. Ref travis-ci/travis-ci#8361 + - if [ "${TRAVIS_OS_NAME}" == "linux" ]; then + sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'; + fi +script: tox diff --git a/testing/web-platform/tests/tools/third_party/zipp/CHANGES.rst b/testing/web-platform/tests/tools/third_party/zipp/CHANGES.rst new file mode 100644 index 0000000000..a464a6324b --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/CHANGES.rst @@ -0,0 +1,100 @@ +v1.2.0 +====== + +#44: ``zipp.Path.open()`` now supports a compatible signature +as ``pathlib.Path.open()``, accepting text (default) or binary +modes and soliciting keyword parameters passed through to +``io.TextIOWrapper`` (encoding, newline, etc). The stream is +opened in text-mode by default now. ``open`` no +longer accepts ``pwd`` as a positional argument and does not +accept the ``force_zip64`` parameter at all. This change is +a backward-incompatible change for that single function. + +v1.1.1 +====== + +#43: Restored performance of implicit dir computation. + +v1.1.0 +====== + +#32: For read-only zip files, complexity of ``.exists`` and +``joinpath`` is now constant time instead of ``O(n)``, preventing +quadratic time in common use-cases and rendering large +zip files unusable for Path. Big thanks to Benjy Weinberger +for the bug report and contributed fix (#33). + +v1.0.0 +====== + +Re-release of 0.6 to correspond with release as found in +Python 3.8. + +v0.6.0 +====== + +#12: When adding implicit dirs, ensure that ancestral directories +are added and that duplicates are excluded. + +The library now relies on +`more_itertools <https://pypi.org/project/more_itertools>`_. + +v0.5.2 +====== + +#7: Parent of a directory now actually returns the parent. + +v0.5.1 +====== + +Declared package as backport. + +v0.5.0 +====== + +Add ``.joinpath()`` method and ``.parent`` property. + +Now a backport release of the ``zipfile.Path`` class. + +v0.4.0 +====== + +#4: Add support for zip files with implied directories. + +v0.3.3 +====== + +#3: Fix issue where ``.name`` on a directory was empty. + +v0.3.2 +====== + +#2: Fix TypeError on Python 2.7 when classic division is used. + +v0.3.1 +====== + +#1: Fix TypeError on Python 3.5 when joining to a path-like object. + +v0.3.0 +====== + +Add support for constructing a ``zipp.Path`` from any path-like +object. + +``zipp.Path`` is now a new-style class on Python 2.7. + +v0.2.1 +====== + +Fix issue with ``__str__``. + +v0.2.0 +====== + +Drop reliance on future-fstrings. + +v0.1.0 +====== + +Initial release with basic functionality. diff --git a/testing/web-platform/tests/tools/third_party/zipp/LICENSE b/testing/web-platform/tests/tools/third_party/zipp/LICENSE new file mode 100644 index 0000000000..5e795a61f3 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/LICENSE @@ -0,0 +1,7 @@ +Copyright Jason R. Coombs + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/testing/web-platform/tests/tools/third_party/zipp/PKG-INFO b/testing/web-platform/tests/tools/third_party/zipp/PKG-INFO new file mode 100644 index 0000000000..33ef1cf01c --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/PKG-INFO @@ -0,0 +1,39 @@ +Metadata-Version: 2.1 +Name: zipp +Version: 1.2.0 +Summary: Backport of pathlib-compatible object wrapper for zip files +Home-page: https://github.com/jaraco/zipp +Author: Jason R. Coombs +Author-email: jaraco@jaraco.com +License: UNKNOWN +Description: .. image:: https://img.shields.io/pypi/v/zipp.svg + :target: https://pypi.org/project/zipp + + .. image:: https://img.shields.io/pypi/pyversions/zipp.svg + + .. image:: https://img.shields.io/travis/jaraco/zipp/master.svg + :target: https://travis-ci.org/jaraco/zipp + + .. image:: https://img.shields.io/badge/code%20style-black-000000.svg + :target: https://github.com/ambv/black + :alt: Code style: Black + + .. image:: https://img.shields.io/appveyor/ci/jaraco/zipp/master.svg + :target: https://ci.appveyor.com/project/jaraco/zipp/branch/master + + .. .. image:: https://readthedocs.org/projects/zipp/badge/?version=latest + .. :target: https://zipp.readthedocs.io/en/latest/?badge=latest + + + A pathlib-compatible Zipfile object wrapper. A backport of the + `Path object <https://docs.python.org/3.8/library/zipfile.html#path-objects>`_. + +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Requires-Python: >=2.7 +Provides-Extra: testing +Provides-Extra: docs diff --git a/testing/web-platform/tests/tools/third_party/zipp/README.rst b/testing/web-platform/tests/tools/third_party/zipp/README.rst new file mode 100644 index 0000000000..ce128a32ba --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/README.rst @@ -0,0 +1,21 @@ +.. image:: https://img.shields.io/pypi/v/zipp.svg + :target: https://pypi.org/project/zipp + +.. image:: https://img.shields.io/pypi/pyversions/zipp.svg + +.. image:: https://img.shields.io/travis/jaraco/zipp/master.svg + :target: https://travis-ci.org/jaraco/zipp + +.. image:: https://img.shields.io/badge/code%20style-black-000000.svg + :target: https://github.com/ambv/black + :alt: Code style: Black + +.. image:: https://img.shields.io/appveyor/ci/jaraco/zipp/master.svg + :target: https://ci.appveyor.com/project/jaraco/zipp/branch/master + +.. .. image:: https://readthedocs.org/projects/zipp/badge/?version=latest +.. :target: https://zipp.readthedocs.io/en/latest/?badge=latest + + +A pathlib-compatible Zipfile object wrapper. A backport of the +`Path object <https://docs.python.org/3.8/library/zipfile.html#path-objects>`_. diff --git a/testing/web-platform/tests/tools/third_party/zipp/appveyor.yml b/testing/web-platform/tests/tools/third_party/zipp/appveyor.yml new file mode 100644 index 0000000000..f35aa27d68 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/appveyor.yml @@ -0,0 +1,24 @@ +environment: + + APPVEYOR: true + + matrix: + - PYTHON: "C:\\Python36-x64" + - PYTHON: "C:\\Python27-x64" + +install: + # symlink python from a directory with a space + - "mklink /d \"C:\\Program Files\\Python\" %PYTHON%" + - "SET PYTHON=\"C:\\Program Files\\Python\"" + - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" + +build: off + +cache: + - '%LOCALAPPDATA%\pip\Cache' + +test_script: + - "python -m pip install -U tox tox-venv virtualenv" + - "tox" + +version: '{build}' diff --git a/testing/web-platform/tests/tools/third_party/zipp/conftest.py b/testing/web-platform/tests/tools/third_party/zipp/conftest.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/conftest.py diff --git a/testing/web-platform/tests/tools/third_party/zipp/docs/conf.py b/testing/web-platform/tests/tools/third_party/zipp/docs/conf.py new file mode 100644 index 0000000000..41b53557fb --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/docs/conf.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +extensions = ['sphinx.ext.autodoc', 'jaraco.packaging.sphinx', 'rst.linker'] + +master_doc = "index" + +link_files = { + '../CHANGES.rst': dict( + using=dict(GH='https://github.com'), + replace=[ + dict( + pattern=r'(Issue #|\B#)(?P<issue>\d+)', + url='{package_url}/issues/{issue}', + ), + dict( + pattern=r'^(?m)((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n', + with_scm='{text}\n{rev[timestamp]:%d %b %Y}\n', + ), + dict( + pattern=r'PEP[- ](?P<pep_number>\d+)', + url='https://www.python.org/dev/peps/pep-{pep_number:0>4}/', + ), + ], + ) +} diff --git a/testing/web-platform/tests/tools/third_party/zipp/docs/history.rst b/testing/web-platform/tests/tools/third_party/zipp/docs/history.rst new file mode 100644 index 0000000000..8e217503ba --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/docs/history.rst @@ -0,0 +1,8 @@ +:tocdepth: 2 + +.. _changes: + +History +******* + +.. include:: ../CHANGES (links).rst diff --git a/testing/web-platform/tests/tools/third_party/zipp/docs/index.rst b/testing/web-platform/tests/tools/third_party/zipp/docs/index.rst new file mode 100644 index 0000000000..ff49bf9dc7 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/docs/index.rst @@ -0,0 +1,22 @@ +Welcome to zipp documentation! +======================================== + +.. toctree:: + :maxdepth: 1 + + history + + +.. automodule:: zipp + :members: + :undoc-members: + :show-inheritance: + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/testing/web-platform/tests/tools/third_party/zipp/mypy.ini b/testing/web-platform/tests/tools/third_party/zipp/mypy.ini new file mode 100644 index 0000000000..976ba02946 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/mypy.ini @@ -0,0 +1,2 @@ +[mypy] +ignore_missing_imports = True diff --git a/testing/web-platform/tests/tools/third_party/zipp/pyproject.toml b/testing/web-platform/tests/tools/third_party/zipp/pyproject.toml new file mode 100644 index 0000000000..3afc8c33b7 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = ["setuptools>=34.4", "wheel", "setuptools_scm>=1.15"] +build-backend = "setuptools.build_meta" + +[tool.black] +skip-string-normalization = true diff --git a/testing/web-platform/tests/tools/third_party/zipp/pytest.ini b/testing/web-platform/tests/tools/third_party/zipp/pytest.ini new file mode 100644 index 0000000000..d7f0b11559 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/pytest.ini @@ -0,0 +1,9 @@ +[pytest] +norecursedirs=dist build .tox .eggs +addopts=--doctest-modules +doctest_optionflags=ALLOW_UNICODE ELLIPSIS +# workaround for warning pytest-dev/pytest#6178 +junit_family=xunit2 +filterwarnings= + # https://github.com/pytest-dev/pytest/issues/6928 + ignore:direct construction of .*Item has been deprecated:DeprecationWarning diff --git a/testing/web-platform/tests/tools/third_party/zipp/setup.cfg b/testing/web-platform/tests/tools/third_party/zipp/setup.cfg new file mode 100644 index 0000000000..ef4abd248a --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/setup.cfg @@ -0,0 +1,45 @@ +[bdist_wheel] +universal = 1 + +[metadata] +license_file = LICENSE +name = zipp +author = Jason R. Coombs +author_email = jaraco@jaraco.com +description = Backport of pathlib-compatible object wrapper for zip files +long_description = file:README.rst +url = https://github.com/jaraco/zipp +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + +[options] +py_modules = zipp +packages = find: +include_package_data = true +python_requires = >=2.7 +install_requires = + contextlib2; python_version < "3.4" +setup_requires = setuptools_scm >= 1.15.0 + +[options.extras_require] +testing = + + pathlib2 + unittest2 + jaraco.itertools + func-timeout +docs = + sphinx + jaraco.packaging >= 3.2 + rst.linker >= 1.9 + +[options.entry_points] + +[egg_info] +tag_build = +tag_date = 0 + diff --git a/testing/web-platform/tests/tools/third_party/zipp/setup.py b/testing/web-platform/tests/tools/third_party/zipp/setup.py new file mode 100644 index 0000000000..827e955fcd --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/setup.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python + +import setuptools + +if __name__ == "__main__": + setuptools.setup(use_scm_version=True) diff --git a/testing/web-platform/tests/tools/third_party/zipp/skeleton.md b/testing/web-platform/tests/tools/third_party/zipp/skeleton.md new file mode 100644 index 0000000000..52b97f09b4 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/skeleton.md @@ -0,0 +1,137 @@ +# Overview + +This project is merged with [skeleton](https://github.com/jaraco/skeleton). What is skeleton? It's the scaffolding of a Python project jaraco [introduced in his blog](https://blog.jaraco.com/a-project-skeleton-for-python-projects/). It seeks to provide a means to re-use techniques and inherit advances when managing projects for distribution. + +## An SCM Managed Approach + +While maintaining dozens of projects in PyPI, jaraco derives best practices for project distribution and publishes them in the [skeleton repo](https://github.com/jaraco/skeleton), a git repo capturing the evolution and culmination of these best practices. + +It's intended to be used by a new or existing project to adopt these practices and honed and proven techniques. Adopters are encouraged to use the project directly and maintain a small deviation from the technique, make their own fork for more substantial changes unique to their environment or preferences, or simply adopt the skeleton once and abandon it thereafter. + +The primary advantage to using an SCM for maintaining these techniques is that those tools help facilitate the merge between the template and its adopting projects. + +Another advantage to using an SCM-managed approach is that tools like GitHub recognize that a change in the skeleton is the _same change_ across all projects that merge with that skeleton. Without the ancestry, with a traditional copy/paste approach, a [commit like this](https://github.com/jaraco/skeleton/commit/12eed1326e1bc26ce256e7b3f8cd8d3a5beab2d5) would produce notifications in the upstream project issue for each and every application, but because it's centralized, GitHub provides just the one notification when the change is added to the skeleton. + +# Usage + +## new projects + +To use skeleton for a new project, simply pull the skeleton into a new project: + +``` +$ git init my-new-project +$ cd my-new-project +$ git pull gh://jaraco/skeleton +``` + +Now customize the project to suit your individual project needs. + +## existing projects + +If you have an existing project, you can still incorporate the skeleton by merging it into the codebase. + +``` +$ git merge skeleton --allow-unrelated-histories +``` + +The `--allow-unrelated-histories` is necessary because the history from the skeleton was previously unrelated to the existing codebase. Resolve any merge conflicts and commit to the master, and now the project is based on the shared skeleton. + +## Updating + +Whenever a change is needed or desired for the general technique for packaging, it can be made in the skeleton project and then merged into each of the derived projects as needed, recommended before each release. As a result, features and best practices for packaging are centrally maintained and readily trickle into a whole suite of packages. This technique lowers the amount of tedious work necessary to create or maintain a project, and coupled with other techniques like continuous integration and deployment, lowers the cost of creating and maintaining refined Python projects to just a few, familiar git operations. + +Thereafter, the target project can make whatever customizations it deems relevant to the scaffolding. The project may even at some point decide that the divergence is too great to merit renewed merging with the original skeleton. This approach applies maximal guidance while creating minimal constraints. + +# Features + +The features/techniques employed by the skeleton include: + +- PEP 517/518 based build relying on setuptools as the build tool +- setuptools declarative configuration using setup.cfg +- tox for running tests +- A README.rst as reStructuredText with some popular badges, but with readthedocs and appveyor badges commented out +- A CHANGES.rst file intended for publishing release notes about the project +- Use of [black](https://black.readthedocs.io/en/stable/) for code formatting (disabled on unsupported Python 3.5 and earlier) + +## Packaging Conventions + +A pyproject.toml is included to enable PEP 517 and PEP 518 compatibility and declares the requirements necessary to build the project on setuptools (a minimum version compatible with setup.cfg declarative config). + +The setup.cfg file implements the following features: + +- Assumes universal wheel for release +- Advertises the project's LICENSE file (MIT by default) +- Reads the README.rst file into the long description +- Some common Trove classifiers +- Includes all packages discovered in the repo +- Data files in the package are also included (not just Python files) +- Declares the required Python versions +- Declares install requirements (empty by default) +- Declares setup requirements for legacy environments +- Supplies two 'extras': + - testing: requirements for running tests + - docs: requirements for building docs + - these extras split the declaration into "upstream" (requirements as declared by the skeleton) and "local" (those specific to the local project); these markers help avoid merge conflicts +- Placeholder for defining entry points + +Additionally, the setup.py file declares `use_scm_version` which relies on [setuptools_scm](https://pypi.org/project/setuptools_scm) to do two things: + +- derive the project version from SCM tags +- ensure that all files committed to the repo are automatically included in releases + +## Running Tests + +The skeleton assumes the developer has [tox](https://pypi.org/project/tox) installed. The developer is expected to run `tox` to run tests on the current Python version using [pytest](https://pypi.org/project/pytest). + +Other environments (invoked with `tox -e {name}`) supplied include: + + - a `build-docs` environment to build the documentation + - a `release` environment to publish the package to PyPI + +A pytest.ini is included to define common options around running tests. In particular: + +- rely on default test discovery in the current directory +- avoid recursing into common directories not containing tests +- run doctests on modules and invoke flake8 tests +- in doctests, allow unicode literals and regular literals to match, allowing for doctests to run on Python 2 and 3. Also enable ELLIPSES, a default that would be undone by supplying the prior option. +- filters out known warnings caused by libraries/functionality included by the skeleton + +Relies a .flake8 file to correct some default behaviors: + +- disable mutually incompatible rules W503 and W504 +- support for black format + +## Continuous Integration + +The project is pre-configured to run tests in [Travis-CI](https://travis-ci.org) (.travis.yml). Any new project must be enabled either through their web site or with the `travis enable` command. + +Features include: +- test against Python 2 and 3 +- run on Ubuntu Xenial +- correct for broken IPv6 + +Also provided is a minimal template for running under Appveyor (Windows). + +### Continuous Deployments + +In addition to running tests, an additional deploy stage is configured to automatically release tagged commits to PyPI using [API tokens](https://pypi.org/help/#apitoken). The release process expects an authorized token to be configured with Travis as the TWINE_PASSWORD environment variable. After the Travis project is created, configure the token through the web UI or with a command like the following (bash syntax): + +``` +TWINE_PASSWORD={token} travis env copy TWINE_PASSWORD +``` + +## Building Documentation + +Documentation is automatically built by [Read the Docs](https://readthedocs.org) when the project is registered with it, by way of the .readthedocs.yml file. To test the docs build manually, a tox env may be invoked as `tox -e build-docs`. Both techniques rely on the dependencies declared in `setup.cfg/options.extras_require.docs`. + +In addition to building the sphinx docs scaffolded in `docs/`, the docs build a `history.html` file that first injects release dates and hyperlinks into the CHANGES.rst before incorporating it as history in the docs. + +## Cutting releases + +By default, tagged commits are released through the continuous integration deploy stage. + +Releases may also be cut manually by invoking the tox environment `release` with the PyPI token set as the TWINE_PASSWORD: + +``` +TWINE_PASSWORD={token} tox -e release +``` diff --git a/testing/web-platform/tests/tools/third_party/zipp/test_zipp.py b/testing/web-platform/tests/tools/third_party/zipp/test_zipp.py new file mode 100644 index 0000000000..810d10bd68 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/test_zipp.py @@ -0,0 +1,245 @@ +# coding: utf-8 + +from __future__ import division, unicode_literals + +import io +import zipfile +import contextlib +import tempfile +import shutil +import string + +try: + import pathlib +except ImportError: + import pathlib2 as pathlib + +if not hasattr(contextlib, 'ExitStack'): + import contextlib2 + contextlib.ExitStack = contextlib2.ExitStack + +try: + import unittest + + unittest.TestCase.subTest +except AttributeError: + import unittest2 as unittest + +import jaraco.itertools +import func_timeout + +import zipp + +__metaclass__ = type +consume = tuple + + +def add_dirs(zf): + """ + Given a writable zip file zf, inject directory entries for + any directories implied by the presence of children. + """ + for name in zipp.CompleteDirs._implied_dirs(zf.namelist()): + zf.writestr(name, b"") + return zf + + +def build_alpharep_fixture(): + """ + Create a zip file with this structure: + + . + ├── a.txt + ├── b + │ ├── c.txt + │ ├── d + │ │ └── e.txt + │ └── f.txt + └── g + └── h + └── i.txt + + This fixture has the following key characteristics: + + - a file at the root (a) + - a file two levels deep (b/d/e) + - multiple files in a directory (b/c, b/f) + - a directory containing only a directory (g/h) + + "alpha" because it uses alphabet + "rep" because it's a representative example + """ + data = io.BytesIO() + zf = zipfile.ZipFile(data, "w") + zf.writestr("a.txt", b"content of a") + zf.writestr("b/c.txt", b"content of c") + zf.writestr("b/d/e.txt", b"content of e") + zf.writestr("b/f.txt", b"content of f") + zf.writestr("g/h/i.txt", b"content of i") + zf.filename = "alpharep.zip" + return zf + + +@contextlib.contextmanager +def temp_dir(): + tmpdir = tempfile.mkdtemp() + try: + yield pathlib.Path(tmpdir) + finally: + shutil.rmtree(tmpdir) + + +class TestPath(unittest.TestCase): + def setUp(self): + self.fixtures = contextlib.ExitStack() + self.addCleanup(self.fixtures.close) + + def zipfile_alpharep(self): + with self.subTest(): + yield build_alpharep_fixture() + with self.subTest(): + yield add_dirs(build_alpharep_fixture()) + + def zipfile_ondisk(self): + tmpdir = pathlib.Path(self.fixtures.enter_context(temp_dir())) + for alpharep in self.zipfile_alpharep(): + buffer = alpharep.fp + alpharep.close() + path = tmpdir / alpharep.filename + with path.open("wb") as strm: + strm.write(buffer.getvalue()) + yield path + + def test_iterdir_and_types(self): + for alpharep in self.zipfile_alpharep(): + root = zipp.Path(alpharep) + assert root.is_dir() + a, b, g = root.iterdir() + assert a.is_file() + assert b.is_dir() + assert g.is_dir() + c, f, d = b.iterdir() + assert c.is_file() and f.is_file() + e, = d.iterdir() + assert e.is_file() + h, = g.iterdir() + i, = h.iterdir() + assert i.is_file() + + def test_open(self): + for alpharep in self.zipfile_alpharep(): + root = zipp.Path(alpharep) + a, b, g = root.iterdir() + with a.open() as strm: + data = strm.read() + assert data == "content of a" + + def test_read(self): + for alpharep in self.zipfile_alpharep(): + root = zipp.Path(alpharep) + a, b, g = root.iterdir() + assert a.read_text() == "content of a" + assert a.read_bytes() == b"content of a" + + def test_joinpath(self): + for alpharep in self.zipfile_alpharep(): + root = zipp.Path(alpharep) + a = root.joinpath("a") + assert a.is_file() + e = root.joinpath("b").joinpath("d").joinpath("e.txt") + assert e.read_text() == "content of e" + + def test_traverse_truediv(self): + for alpharep in self.zipfile_alpharep(): + root = zipp.Path(alpharep) + a = root / "a" + assert a.is_file() + e = root / "b" / "d" / "e.txt" + assert e.read_text() == "content of e" + + def test_traverse_simplediv(self): + """ + Disable the __future__.division when testing traversal. + """ + for alpharep in self.zipfile_alpharep(): + code = compile( + source="zipp.Path(alpharep) / 'a'", + filename="(test)", + mode="eval", + dont_inherit=True, + ) + eval(code) + + def test_pathlike_construction(self): + """ + zipp.Path should be constructable from a path-like object + """ + for zipfile_ondisk in self.zipfile_ondisk(): + pathlike = pathlib.Path(str(zipfile_ondisk)) + zipp.Path(pathlike) + + def test_traverse_pathlike(self): + for alpharep in self.zipfile_alpharep(): + root = zipp.Path(alpharep) + root / pathlib.Path("a") + + def test_parent(self): + for alpharep in self.zipfile_alpharep(): + root = zipp.Path(alpharep) + assert (root / 'a').parent.at == '' + assert (root / 'a' / 'b').parent.at == 'a/' + + def test_dir_parent(self): + for alpharep in self.zipfile_alpharep(): + root = zipp.Path(alpharep) + assert (root / 'b').parent.at == '' + assert (root / 'b/').parent.at == '' + + def test_missing_dir_parent(self): + for alpharep in self.zipfile_alpharep(): + root = zipp.Path(alpharep) + assert (root / 'missing dir/').parent.at == '' + + def test_mutability(self): + """ + If the underlying zipfile is changed, the Path object should + reflect that change. + """ + for alpharep in self.zipfile_alpharep(): + root = zipp.Path(alpharep) + a, b, g = root.iterdir() + alpharep.writestr('foo.txt', b'foo') + alpharep.writestr('bar/baz.txt', b'baz') + assert any( + child.name == 'foo.txt' + for child in root.iterdir()) + assert (root / 'foo.txt').read_text() == 'foo' + baz, = (root / 'bar').iterdir() + assert baz.read_text() == 'baz' + + HUGE_ZIPFILE_NUM_ENTRIES = 2 ** 13 + + def huge_zipfile(self): + """Create a read-only zipfile with a huge number of entries entries.""" + strm = io.BytesIO() + zf = zipfile.ZipFile(strm, "w") + for entry in map(str, range(self.HUGE_ZIPFILE_NUM_ENTRIES)): + zf.writestr(entry, entry) + zf.mode = 'r' + return zf + + def test_joinpath_constant_time(self): + """ + Ensure joinpath on items in zipfile is linear time. + """ + root = zipp.Path(self.huge_zipfile()) + entries = jaraco.itertools.Counter(root.iterdir()) + for entry in entries: + entry.joinpath('suffix') + # Check the file iterated all items + assert entries.count == self.HUGE_ZIPFILE_NUM_ENTRIES + + @func_timeout.func_set_timeout(3) + def test_implied_dirs_performance(self): + data = ['/'.join(string.ascii_lowercase + str(n)) for n in range(10000)] + zipp.CompleteDirs._implied_dirs(data) diff --git a/testing/web-platform/tests/tools/third_party/zipp/tox.ini b/testing/web-platform/tests/tools/third_party/zipp/tox.ini new file mode 100644 index 0000000000..cb542c136c --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/tox.ini @@ -0,0 +1,36 @@ +[tox] +envlist = python +minversion = 3.2 +# https://github.com/jaraco/skeleton/issues/6 +tox_pip_extensions_ext_venv_update = true + +[testenv] +deps = + setuptools>=31.0.1 +commands = + python -m unittest discover +usedevelop = True +extras = testing + +[testenv:build-docs] +extras = + docs + testing +changedir = docs +commands = + python -m sphinx . {toxinidir}/build/html + +[testenv:release] +skip_install = True +deps = + pep517>=0.5 + twine>=1.13 + path.py +passenv = + TWINE_PASSWORD +setenv = + TWINE_USERNAME = {env:TWINE_USERNAME:__token__} +commands = + python -c "import path; path.Path('dist').rmtree_p()" + python -m pep517.build . + python -m twine upload dist/* diff --git a/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/PKG-INFO b/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/PKG-INFO new file mode 100644 index 0000000000..33ef1cf01c --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/PKG-INFO @@ -0,0 +1,39 @@ +Metadata-Version: 2.1 +Name: zipp +Version: 1.2.0 +Summary: Backport of pathlib-compatible object wrapper for zip files +Home-page: https://github.com/jaraco/zipp +Author: Jason R. Coombs +Author-email: jaraco@jaraco.com +License: UNKNOWN +Description: .. image:: https://img.shields.io/pypi/v/zipp.svg + :target: https://pypi.org/project/zipp + + .. image:: https://img.shields.io/pypi/pyversions/zipp.svg + + .. image:: https://img.shields.io/travis/jaraco/zipp/master.svg + :target: https://travis-ci.org/jaraco/zipp + + .. image:: https://img.shields.io/badge/code%20style-black-000000.svg + :target: https://github.com/ambv/black + :alt: Code style: Black + + .. image:: https://img.shields.io/appveyor/ci/jaraco/zipp/master.svg + :target: https://ci.appveyor.com/project/jaraco/zipp/branch/master + + .. .. image:: https://readthedocs.org/projects/zipp/badge/?version=latest + .. :target: https://zipp.readthedocs.io/en/latest/?badge=latest + + + A pathlib-compatible Zipfile object wrapper. A backport of the + `Path object <https://docs.python.org/3.8/library/zipfile.html#path-objects>`_. + +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Requires-Python: >=2.7 +Provides-Extra: testing +Provides-Extra: docs diff --git a/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/SOURCES.txt b/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/SOURCES.txt new file mode 100644 index 0000000000..845b342cef --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/SOURCES.txt @@ -0,0 +1,24 @@ +.flake8 +.pre-commit-config.yaml +.readthedocs.yml +.travis.yml +CHANGES.rst +LICENSE +README.rst +appveyor.yml +conftest.py +pyproject.toml +setup.cfg +setup.py +skeleton.md +test_zipp.py +tox.ini +zipp.py +docs/conf.py +docs/history.rst +docs/index.rst +zipp.egg-info/PKG-INFO +zipp.egg-info/SOURCES.txt +zipp.egg-info/dependency_links.txt +zipp.egg-info/requires.txt +zipp.egg-info/top_level.txt
\ No newline at end of file diff --git a/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/dependency_links.txt b/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/dependency_links.txt new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/requires.txt b/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/requires.txt new file mode 100644 index 0000000000..90bab46ac4 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/requires.txt @@ -0,0 +1,14 @@ + +[:python_version < "3.4"] +contextlib2 + +[docs] +sphinx +jaraco.packaging>=3.2 +rst.linker>=1.9 + +[testing] +pathlib2 +unittest2 +jaraco.itertools +func-timeout diff --git a/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/top_level.txt b/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/top_level.txt new file mode 100644 index 0000000000..e82f676f82 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/zipp.egg-info/top_level.txt @@ -0,0 +1 @@ +zipp diff --git a/testing/web-platform/tests/tools/third_party/zipp/zipp.py b/testing/web-platform/tests/tools/third_party/zipp/zipp.py new file mode 100644 index 0000000000..892205834a --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/zipp/zipp.py @@ -0,0 +1,286 @@ +# coding: utf-8 + +from __future__ import division + +import io +import sys +import posixpath +import zipfile +import functools +import itertools +from collections import OrderedDict + +try: + from contextlib import suppress +except ImportError: + from contextlib2 import suppress + +__metaclass__ = type + + +def _parents(path): + """ + Given a path with elements separated by + posixpath.sep, generate all parents of that path. + + >>> list(_parents('b/d')) + ['b'] + >>> list(_parents('/b/d/')) + ['/b'] + >>> list(_parents('b/d/f/')) + ['b/d', 'b'] + >>> list(_parents('b')) + [] + >>> list(_parents('')) + [] + """ + return itertools.islice(_ancestry(path), 1, None) + + +def _ancestry(path): + """ + Given a path with elements separated by + posixpath.sep, generate all elements of that path + + >>> list(_ancestry('b/d')) + ['b/d', 'b'] + >>> list(_ancestry('/b/d/')) + ['/b/d', '/b'] + >>> list(_ancestry('b/d/f/')) + ['b/d/f', 'b/d', 'b'] + >>> list(_ancestry('b')) + ['b'] + >>> list(_ancestry('')) + [] + """ + path = path.rstrip(posixpath.sep) + while path and path != posixpath.sep: + yield path + path, tail = posixpath.split(path) + + +class CompleteDirs(zipfile.ZipFile): + """ + A ZipFile subclass that ensures that implied directories + are always included in the namelist. + """ + + @staticmethod + def _implied_dirs(names): + parents = itertools.chain.from_iterable(map(_parents, names)) + # Cast names to a set for O(1) lookups + existing = set(names) + # Deduplicate entries in original order + implied_dirs = OrderedDict.fromkeys( + p + posixpath.sep for p in parents + if p + posixpath.sep not in existing + ) + return implied_dirs + + def namelist(self): + names = super(CompleteDirs, self).namelist() + return names + list(self._implied_dirs(names)) + + def _name_set(self): + return set(self.namelist()) + + def resolve_dir(self, name): + """ + If the name represents a directory, return that name + as a directory (with the trailing slash). + """ + names = self._name_set() + dirname = name + '/' + dir_match = name not in names and dirname in names + return dirname if dir_match else name + + @classmethod + def make(cls, source): + """ + Given a source (filename or zipfile), return an + appropriate CompleteDirs subclass. + """ + if isinstance(source, CompleteDirs): + return source + + if not isinstance(source, zipfile.ZipFile): + return cls(_pathlib_compat(source)) + + # Only allow for FastPath when supplied zipfile is read-only + if 'r' not in source.mode: + cls = CompleteDirs + + res = cls.__new__(cls) + vars(res).update(vars(source)) + return res + + +class FastLookup(CompleteDirs): + """ + ZipFile subclass to ensure implicit + dirs exist and are resolved rapidly. + """ + def namelist(self): + with suppress(AttributeError): + return self.__names + self.__names = super(FastLookup, self).namelist() + return self.__names + + def _name_set(self): + with suppress(AttributeError): + return self.__lookup + self.__lookup = super(FastLookup, self)._name_set() + return self.__lookup + + +def _pathlib_compat(path): + """ + For path-like objects, convert to a filename for compatibility + on Python 3.6.1 and earlier. + """ + try: + return path.__fspath__() + except AttributeError: + return str(path) + + +class Path: + """ + A pathlib-compatible interface for zip files. + + Consider a zip file with this structure:: + + . + ├── a.txt + └── b + ├── c.txt + └── d + └── e.txt + + >>> data = io.BytesIO() + >>> zf = zipfile.ZipFile(data, 'w') + >>> zf.writestr('a.txt', 'content of a') + >>> zf.writestr('b/c.txt', 'content of c') + >>> zf.writestr('b/d/e.txt', 'content of e') + >>> zf.filename = 'abcde.zip' + + Path accepts the zipfile object itself or a filename + + >>> root = Path(zf) + + From there, several path operations are available. + + Directory iteration (including the zip file itself): + + >>> a, b = root.iterdir() + >>> a + Path('abcde.zip', 'a.txt') + >>> b + Path('abcde.zip', 'b/') + + name property: + + >>> b.name + 'b' + + join with divide operator: + + >>> c = b / 'c.txt' + >>> c + Path('abcde.zip', 'b/c.txt') + >>> c.name + 'c.txt' + + Read text: + + >>> c.read_text() + 'content of c' + + existence: + + >>> c.exists() + True + >>> (b / 'missing.txt').exists() + False + + Coercion to string: + + >>> str(c) + 'abcde.zip/b/c.txt' + """ + + __repr = "{self.__class__.__name__}({self.root.filename!r}, {self.at!r})" + + def __init__(self, root, at=""): + self.root = FastLookup.make(root) + self.at = at + + def open(self, mode='r', *args, **kwargs): + """ + Open this entry as text or binary following the semantics + of ``pathlib.Path.open()`` by passing arguments through + to io.TextIOWrapper(). + """ + pwd = kwargs.pop('pwd', None) + zip_mode = mode[0] + stream = self.root.open(self.at, zip_mode, pwd=pwd) + if 'b' in mode: + if args or kwargs: + raise ValueError("encoding args invalid for binary operation") + return stream + return io.TextIOWrapper(stream, *args, **kwargs) + + @property + def name(self): + return posixpath.basename(self.at.rstrip("/")) + + def read_text(self, *args, **kwargs): + with self.open('r', *args, **kwargs) as strm: + return strm.read() + + def read_bytes(self): + with self.open('rb') as strm: + return strm.read() + + def _is_child(self, path): + return posixpath.dirname(path.at.rstrip("/")) == self.at.rstrip("/") + + def _next(self, at): + return Path(self.root, at) + + def is_dir(self): + return not self.at or self.at.endswith("/") + + def is_file(self): + return not self.is_dir() + + def exists(self): + return self.at in self.root._name_set() + + def iterdir(self): + if not self.is_dir(): + raise ValueError("Can't listdir a file") + subs = map(self._next, self.root.namelist()) + return filter(self._is_child, subs) + + def __str__(self): + return posixpath.join(self.root.filename, self.at) + + def __repr__(self): + return self.__repr.format(self=self) + + def joinpath(self, add): + next = posixpath.join(self.at, _pathlib_compat(add)) + return self._next(self.root.resolve_dir(next)) + + __truediv__ = joinpath + + @property + def parent(self): + parent_at = posixpath.dirname(self.at.rstrip('/')) + if parent_at: + parent_at += '/' + return self._next(parent_at) + + if sys.version_info < (3,): + __div__ = __truediv__ |