Hello community, here is the log from the commit of package python-zipp for openSUSE:Factory checked in at 2020-11-29 12:26:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-zipp (Old) and /work/SRC/openSUSE:Factory/.python-zipp.new.5913 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-zipp" Sun Nov 29 12:26:56 2020 rev:10 rq:850769 version:3.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-zipp/python-zipp.changes 2020-10-29 09:46:15.104052180 +0100 +++ /work/SRC/openSUSE:Factory/.python-zipp.new.5913/python-zipp.changes 2020-11-29 12:26:57.681913158 +0100 @@ -1,0 +2,13 @@ +Wed Nov 25 14:52:25 UTC 2020 - Dirk Mueller <dmuel...@suse.com> + +- update to 3.4.0: + #68 and bpo-42090: ``Path.joinpath`` now takes arbitrary + positional arguments and no longer accepts ``add`` as a + keyword argument. + Updated project metadata including badges. + bpo-42043: Add tests capturing subclassing requirements. + #9: ``Path`` objects now expose a ``.filename`` attribute + and rely on that to resolve ``.name`` and ``.parent`` when + the ``Path`` object is at the root of the zipfile. + +------------------------------------------------------------------- Old: ---- zipp-3.2.0.tar.gz New: ---- zipp-3.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-zipp.spec ++++++ --- /var/tmp/diff_new_pack.cAmgup/_old 2020-11-29 12:26:58.297913781 +0100 +++ /var/tmp/diff_new_pack.cAmgup/_new 2020-11-29 12:26:58.297913781 +0100 @@ -27,7 +27,7 @@ %bcond_with test %endif Name: python-zipp%{psuffix} -Version: 3.2.0 +Version: 3.4.0 Release: 0 Summary: Pathlib-compatible object wrapper for zip files License: MIT ++++++ zipp-3.2.0.tar.gz -> zipp-3.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zipp-3.2.0/.github/workflows/main.yml new/zipp-3.4.0/.github/workflows/main.yml --- old/zipp-3.2.0/.github/workflows/main.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/zipp-3.4.0/.github/workflows/main.yml 2020-10-25 19:40:04.000000000 +0100 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zipp-3.2.0/.readthedocs.yml new/zipp-3.4.0/.readthedocs.yml --- old/zipp-3.2.0/.readthedocs.yml 2020-09-22 17:28:55.000000000 +0200 +++ new/zipp-3.4.0/.readthedocs.yml 2020-10-25 19:40:04.000000000 +0100 @@ -1,5 +1,6 @@ +version: 2 python: - version: 3 - extra_requirements: - - docs - pip_install: true + install: + - path: . + extra_requirements: + - docs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zipp-3.2.0/.travis.yml new/zipp-3.4.0/.travis.yml --- old/zipp-3.2.0/.travis.yml 2020-09-22 17:28:55.000000000 +0200 +++ new/zipp-3.4.0/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,19 +0,0 @@ -dist: bionic -language: python - -python: -- 3.6 -- &latest_py3 3.8 - -cache: pip - -install: -# ensure virtualenv is upgraded to avoid issues like jaraco/path#188 -- pip install -U --upgrade-strategy=eager tox - -before_script: - # Enable 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zipp-3.2.0/CHANGES.rst new/zipp-3.4.0/CHANGES.rst --- old/zipp-3.2.0/CHANGES.rst 2020-09-22 17:28:55.000000000 +0200 +++ new/zipp-3.4.0/CHANGES.rst 2020-10-25 19:40:04.000000000 +0100 @@ -1,3 +1,27 @@ +v3.4.0 +====== + +#68 and bpo-42090: ``Path.joinpath`` now takes arbitrary +positional arguments and no longer accepts ``add`` as a +keyword argument. + +v3.3.2 +====== + +Updated project metadata including badges. + +v3.3.1 +====== + +bpo-42043: Add tests capturing subclassing requirements. + +v3.3.0 +====== + +#9: ``Path`` objects now expose a ``.filename`` attribute +and rely on that to resolve ``.name`` and ``.parent`` when +the ``Path`` object is at the root of the zipfile. + v3.2.0 ====== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zipp-3.2.0/PKG-INFO new/zipp-3.4.0/PKG-INFO --- old/zipp-3.2.0/PKG-INFO 2020-09-22 17:29:17.801306000 +0200 +++ new/zipp-3.4.0/PKG-INFO 2020-10-25 19:40:22.124914600 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: zipp -Version: 3.2.0 +Version: 3.4.0 Summary: Backport of pathlib-compatible object wrapper for zip files Home-page: https://github.com/jaraco/zipp Author: Jason R. Coombs @@ -14,19 +14,14 @@ .. _PyPI link: https://pypi.org/project/zipp - .. image:: https://dev.azure.com/jaraco/zipp/_apis/build/status/jaraco.zipp?branchName=master - :target: https://dev.azure.com/jaraco/zipp/_build/latest?definitionId=1&branchName=master - - .. image:: https://img.shields.io/travis/jaraco/zipp/master.svg - :target: https://travis-ci.org/jaraco/zipp + .. image:: https://github.com/jaraco/zipp/workflows/Automated%20Tests/badge.svg + :target: https://github.com/jaraco/zipp/actions?query=workflow%3A%22Automated+Tests%22 + :alt: Automated Tests .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zipp-3.2.0/README.rst new/zipp-3.4.0/README.rst --- old/zipp-3.2.0/README.rst 2020-09-22 17:28:55.000000000 +0200 +++ new/zipp-3.4.0/README.rst 2020-10-25 19:40:04.000000000 +0100 @@ -6,19 +6,14 @@ .. _PyPI link: https://pypi.org/project/zipp -.. image:: https://dev.azure.com/jaraco/zipp/_apis/build/status/jaraco.zipp?branchName=master - :target: https://dev.azure.com/jaraco/zipp/_build/latest?definitionId=1&branchName=master - -.. image:: https://img.shields.io/travis/jaraco/zipp/master.svg - :target: https://travis-ci.org/jaraco/zipp +.. image:: https://github.com/jaraco/zipp/workflows/Automated%20Tests/badge.svg + :target: https://github.com/jaraco/zipp/actions?query=workflow%3A%22Automated+Tests%22 + :alt: Automated Tests .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zipp-3.2.0/appveyor.yml new/zipp-3.4.0/appveyor.yml --- old/zipp-3.2.0/appveyor.yml 2020-09-22 17:28:55.000000000 +0200 +++ new/zipp-3.4.0/appveyor.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,24 +0,0 @@ -environment: - - APPVEYOR: true - - matrix: - - PYTHON: "C:\\Python36-x64" - - PYTHON: "C:\\Python38-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 virtualenv" - - "tox" - -version: '{build}' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zipp-3.2.0/azure-pipelines.yml new/zipp-3.4.0/azure-pipelines.yml --- old/zipp-3.2.0/azure-pipelines.yml 2020-09-22 17:28:55.000000000 +0200 +++ new/zipp-3.4.0/azure-pipelines.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,95 +0,0 @@ -# Create the project in Azure with: -# az devops project create --name $name --organization https://dev.azure.com/$org/ --visibility public -# then configure the pipelines (through web UI) - -trigger: - branches: - include: - - '*' - tags: - include: - - '*' - -pool: - vmImage: $(pool_vm_image) - -variables: -- group: Azure secrets -- name: pool_vm_image - value: Ubuntu-18.04 - -stages: -- stage: Test - jobs: - - - job: 'Test' - strategy: - matrix: - Bionic Python 3.6: - python.version: '3.6' - Bionic Python 3.8: - python.version: '3.8' - Windows Python 3.8: - python.version: '3.8' - pool_vm_image: vs2017-win2016 - Windows Python Prerelease: - python.version: '3.9' - pool_vm_image: vs2017-win2016 - MacOS: - python.version: '3.8' - pool_vm_image: macos-10.15 - - maxParallel: 4 - - steps: - - task: NuGetToolInstaller@1 - displayName: 'Install NuGet' - condition: eq(variables['pool_vm_image'], 'vs2017-win2016') - - - powershell: | - nuget install python -Prerelease -OutputDirectory "$(Build.BinariesDirectory)" -ExcludeVersion -NonInteractive - Write-Host "##vso[task.prependpath]$(Build.BinariesDirectory)\python\tools" - Write-Host "##vso[task.prependpath]$(Build.BinariesDirectory)\python\tools\Scripts" - condition: and(succeeded(), and(eq(variables['python.version'], '3.9'), eq(variables['pool_vm_image'], 'vs2017-win2016'))) - - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - architecture: 'x64' - condition: and(succeeded(), ne(variables['python.version'], '3.9')) - - - script: python -m pip install tox - displayName: 'Install tox' - - - script: | - tox -- --junit-xml=test-results.xml - displayName: 'run tests' - - - task: PublishTestResults@2 - inputs: - testResultsFiles: '**/test-results.xml' - testRunTitle: 'Python $(python.version)' - condition: succeededOrFailed() - -- stage: Publish - dependsOn: Test - jobs: - - job: 'Publish' - - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.8' - architecture: 'x64' - - - script: python -m pip install tox - displayName: 'Install tox' - - - script: | - tox -e release - env: - TWINE_PASSWORD: $(PyPI-token) - GITHUB_TOKEN: $(Github-token) - displayName: 'publish to PyPI' - - condition: contains(variables['Build.SourceBranch'], 'tags') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zipp-3.2.0/docs/conf.py new/zipp-3.4.0/docs/conf.py --- old/zipp-3.2.0/docs/conf.py 2020-09-22 17:28:55.000000000 +0200 +++ new/zipp-3.4.0/docs/conf.py 2020-10-25 19:40:04.000000000 +0100 @@ -21,6 +21,10 @@ pattern=r'PEP[- ](?P<pep_number>\d+)', url='https://www.python.org/dev/peps/pep-{pep_number:0>4}/', ), + dict( + pattern=r'(Python #|bpo-)(?P<python>\d+)', + url='http://bugs.python.org/issue{python}', + ), ], ) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zipp-3.2.0/skeleton.md new/zipp-3.4.0/skeleton.md --- old/zipp-3.2.0/skeleton.md 2020-09-22 17:28:55.000000000 +0200 +++ new/zipp-3.4.0/skeleton.md 2020-10-25 19:40:04.000000000 +0100 @@ -56,6 +56,7 @@ - A README.rst as reStructuredText with some popular badges, but with Read the Docs 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) +- Integrated type checking through [mypy](https://github.com/python/mypy/). ## Packaging Conventions @@ -107,47 +108,25 @@ ## Continuous Integration -The project is pre-configured to run tests through multiple CI providers. +The project is pre-configured to run Continuous Integration tests. -### Azure Pipelines +### Github Actions -[Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) are the preferred provider as they provide free, fast, multi-platform services. See azure-pipelines.yml for more details. +[Github Actions](https://docs.github.com/en/free-pro-team@latest/actions) are the preferred provider as they provide free, fast, multi-platform services with straightforward configuration. Configured in `.github/workflows`. Features include: - - test against multiple Python versions -- run on Ubuntu Bionic - -### Travis CI - -[Travis CI](https://travis-ci.org) is configured through .travis.yml. Any new project must be enabled either through their web site or with the `travis enable` command. - -Features include: -- test against Python 3 -- run on Ubuntu Bionic -- correct for broken IPv6 - -### AppVeyor - -A minimal template for running under AppVeyor (Windows) is provided. +- run on late (and updated) platform versions +- automated releases of tagged commits ### 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 Azure as the `Azure secrets` variable group. This variable group needs to be created only once per organization. For example: +In addition to running tests, an additional publish 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 each Github project (or org) `PYPI_TOKEN` [secret](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets). Example: ``` -# create a resource group if none exists -az group create --name main --location eastus2 -# create the vault (try different names until something works) -az keyvault create --name secrets007 --resource-group main -# create the secret -az keyvault secret set --vault-name secrets007 --name PyPI-token --value $token +pip-run -q jaraco.develop -- -m jaraco.develop.add-github-secrets ``` -Then, in the web UI for the project's Pipelines Library, create the `Azure secrets` variable group referencing the key vault name. - -For more details, see [this blog entry](https://blog.jaraco.com/configuring-azure-pipelines-with-secets/). - ## 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 docs`. Both techniques rely on the dependencies declared in `setup.cfg/options.extras_require.docs`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zipp-3.2.0/test_zipp.py new/zipp-3.4.0/test_zipp.py --- old/zipp-3.2.0/test_zipp.py 2020-09-22 17:28:55.000000000 +0200 +++ new/zipp-3.4.0/test_zipp.py 2020-10-25 19:40:04.000000000 +0100 @@ -6,6 +6,7 @@ import tempfile import shutil import string +import functools import jaraco.itertools import func_timeout @@ -70,6 +71,20 @@ shutil.rmtree(tmpdir) +def pass_alpharep(meth): + """ + Given a method, wrap it in a for loop that invokes method + with each subtest. + """ + + @functools.wraps(meth) + def wrapper(self): + for alpharep in self.zipfile_alpharep(): + meth(self, alpharep=alpharep) + + return wrapper + + class TestPath(unittest.TestCase): def setUp(self): self.fixtures = contextlib.ExitStack() @@ -81,59 +96,58 @@ with self.subTest(): yield add_dirs(build_alpharep_fixture()) - def zipfile_ondisk(self): + def zipfile_ondisk(self, alpharep): 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_is_file_missing(self): - for alpharep in self.zipfile_alpharep(): - root = zipp.Path(alpharep) - assert not root.joinpath('missing.txt').is_file() - - def test_iterdir_on_file(self): - for alpharep in self.zipfile_alpharep(): - root = zipp.Path(alpharep) - a, b, g = root.iterdir() - with self.assertRaises(ValueError): - a.iterdir() - - def test_subdir_is_dir(self): - for alpharep in self.zipfile_alpharep(): - root = zipp.Path(alpharep) - assert (root / 'b').is_dir() - assert (root / 'b/').is_dir() - assert (root / 'g').is_dir() - assert (root / 'g/').is_dir() - - 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" + buffer = alpharep.fp + alpharep.close() + path = tmpdir / alpharep.filename + with path.open("wb") as strm: + strm.write(buffer.getvalue()) + return path + + @pass_alpharep + def test_iterdir_and_types(self, 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() + + @pass_alpharep + def test_is_file_missing(self, alpharep): + root = zipp.Path(alpharep) + assert not root.joinpath('missing.txt').is_file() + + @pass_alpharep + def test_iterdir_on_file(self, alpharep): + root = zipp.Path(alpharep) + a, b, g = root.iterdir() + with self.assertRaises(ValueError): + a.iterdir() + + @pass_alpharep + def test_subdir_is_dir(self, alpharep): + root = zipp.Path(alpharep) + assert (root / 'b').is_dir() + assert (root / 'b/').is_dir() + assert (root / 'g').is_dir() + assert (root / 'g/').is_dir() + + @pass_alpharep + def test_open(self, 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_open_write(self): """ @@ -154,13 +168,13 @@ with self.assertRaises(IsADirectoryError): zf.joinpath('b').open() - def test_open_binary_invalid_args(self): - for alpharep in self.zipfile_alpharep(): - root = zipp.Path(alpharep) - with self.assertRaises(ValueError): - root.joinpath('a.txt').open('rb', encoding='utf-8') - with self.assertRaises(ValueError): - root.joinpath('a.txt').open('rb', 'utf-8') + @pass_alpharep + def test_open_binary_invalid_args(self, alpharep): + root = zipp.Path(alpharep) + with self.assertRaises(ValueError): + root.joinpath('a.txt').open('rb', encoding='utf-8') + with self.assertRaises(ValueError): + root.joinpath('a.txt').open('rb', 'utf-8') def test_open_missing_directory(self): """ @@ -170,86 +184,93 @@ with self.assertRaises(FileNotFoundError): zf.joinpath('z').open() - 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" + @pass_alpharep + def test_read(self, 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" + + @pass_alpharep + def test_joinpath(self, alpharep): + root = zipp.Path(alpharep) + a = root.joinpath("a.txt") + assert a.is_file() + e = root.joinpath("b").joinpath("d").joinpath("e.txt") + assert e.read_text() == "content of e" + + @pass_alpharep + def test_joinpath_multiple(self, alpharep): + root = zipp.Path(alpharep) + e = root.joinpath("b", "d", "e.txt") + assert e.read_text() == "content of e" + + @pass_alpharep + def test_traverse_truediv(self, alpharep): + root = zipp.Path(alpharep) + a = root / "a.txt" + assert a.is_file() + e = root / "b" / "d" / "e.txt" + assert e.read_text() == "content of e" - def test_joinpath(self): - for alpharep in self.zipfile_alpharep(): - root = zipp.Path(alpharep) - a = root.joinpath("a.txt") - 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.txt" - assert a.is_file() - e = root / "b" / "d" / "e.txt" - assert e.read_text() == "content of e" - - def test_traverse_simplediv(self): + @pass_alpharep + def test_traverse_simplediv(self, alpharep): """ 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) + code = compile( + source="zipp.Path(alpharep) / 'a'", + filename="(test)", + mode="eval", + dont_inherit=True, + ) + eval(code) - def test_pathlike_construction(self): + @pass_alpharep + def test_pathlike_construction(self, alpharep): """ 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") + zipfile_ondisk = self.zipfile_ondisk(alpharep) + pathlike = pathlib.Path(str(zipfile_ondisk)) + zipp.Path(pathlike) + + @pass_alpharep + def test_traverse_pathlike(self, alpharep): + root = zipp.Path(alpharep) + root / pathlib.Path("a") + + @pass_alpharep + def test_parent(self, alpharep): + root = zipp.Path(alpharep) + assert (root / 'a').parent.at == '' + assert (root / 'a' / 'b').parent.at == 'a/' + + @pass_alpharep + def test_dir_parent(self, alpharep): + root = zipp.Path(alpharep) + assert (root / 'b').parent.at == '' + assert (root / 'b/').parent.at == '' + + @pass_alpharep + def test_missing_dir_parent(self, alpharep): + root = zipp.Path(alpharep) + assert (root / 'missing dir/').parent.at == '' - 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): + @pass_alpharep + def test_mutability(self, alpharep): """ 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', 'foo') - alpharep.writestr('bar/baz.txt', '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' + root = zipp.Path(alpharep) + a, b, g = root.iterdir() + alpharep.writestr('foo.txt', 'foo') + alpharep.writestr('bar/baz.txt', '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 @@ -278,16 +299,62 @@ data = ['/'.join(string.ascii_lowercase + str(n)) for n in range(10000)] zipp.CompleteDirs._implied_dirs(data) - def test_read_does_not_close(self): - for alpharep in self.zipfile_ondisk(): - with zipfile.ZipFile(alpharep) as file: - for rep in range(2): - zipp.Path(file, 'a.txt').read_text() + @pass_alpharep + def test_read_does_not_close(self, alpharep): + alpharep = self.zipfile_ondisk(alpharep) + with zipfile.ZipFile(alpharep) as file: + for rep in range(2): + zipp.Path(file, 'a.txt').read_text() - def test_subclass(self): + @pass_alpharep + def test_subclass(self, alpharep): class Subclass(zipp.Path): pass + root = Subclass(alpharep) + assert isinstance(root / 'b', Subclass) + + @pass_alpharep + def test_filename(self, alpharep): + root = zipp.Path(alpharep) + assert root.filename == pathlib.Path('alpharep.zip') + + @pass_alpharep + def test_root_name(self, alpharep): + """ + The name of the root should be the name of the zipfile + """ + root = zipp.Path(alpharep) + assert root.name == 'alpharep.zip' == root.filename.name + + @pass_alpharep + def test_root_parent(self, alpharep): + root = zipp.Path(alpharep) + assert root.parent == pathlib.Path('.') + root.root.filename = 'foo/bar.zip' + assert root.parent == pathlib.Path('foo') + + @pass_alpharep + def test_root_unnamed(self, alpharep): + """ + It is an error to attempt to get the name + or parent of an unnamed zipfile. + """ + alpharep.filename = None + root = zipp.Path(alpharep) + with self.assertRaises(TypeError): + root.name + with self.assertRaises(TypeError): + root.parent + + # .name and .parent should still work on subs + sub = root / "b" + assert sub.name == "b" + assert sub.parent + + @pass_alpharep + def test_inheritance(self, alpharep): + cls = type('PathChild', (zipp.Path,), {}) for alpharep in self.zipfile_alpharep(): - root = Subclass(alpharep) - assert isinstance(root / 'b', Subclass) + file = cls(alpharep).joinpath('some dir').parent + assert isinstance(file, cls) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zipp-3.2.0/zipp.egg-info/PKG-INFO new/zipp-3.4.0/zipp.egg-info/PKG-INFO --- old/zipp-3.2.0/zipp.egg-info/PKG-INFO 2020-09-22 17:29:17.000000000 +0200 +++ new/zipp-3.4.0/zipp.egg-info/PKG-INFO 2020-10-25 19:40:21.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: zipp -Version: 3.2.0 +Version: 3.4.0 Summary: Backport of pathlib-compatible object wrapper for zip files Home-page: https://github.com/jaraco/zipp Author: Jason R. Coombs @@ -14,19 +14,14 @@ .. _PyPI link: https://pypi.org/project/zipp - .. image:: https://dev.azure.com/jaraco/zipp/_apis/build/status/jaraco.zipp?branchName=master - :target: https://dev.azure.com/jaraco/zipp/_build/latest?definitionId=1&branchName=master - - .. image:: https://img.shields.io/travis/jaraco/zipp/master.svg - :target: https://travis-ci.org/jaraco/zipp + .. image:: https://github.com/jaraco/zipp/workflows/Automated%20Tests/badge.svg + :target: https://github.com/jaraco/zipp/actions?query=workflow%3A%22Automated+Tests%22 + :alt: Automated Tests .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zipp-3.2.0/zipp.egg-info/SOURCES.txt new/zipp-3.4.0/zipp.egg-info/SOURCES.txt --- old/zipp-3.2.0/zipp.egg-info/SOURCES.txt 2020-09-22 17:29:17.000000000 +0200 +++ new/zipp-3.4.0/zipp.egg-info/SOURCES.txt 2020-10-25 19:40:22.000000000 +0100 @@ -2,12 +2,9 @@ .flake8 .pre-commit-config.yaml .readthedocs.yml -.travis.yml CHANGES.rst LICENSE README.rst -appveyor.yml -azure-pipelines.yml conftest.py mypy.ini pyproject.toml @@ -18,6 +15,7 @@ test_zipp.py tox.ini zipp.py +.github/workflows/main.yml docs/conf.py docs/history.rst docs/index.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zipp-3.2.0/zipp.py new/zipp-3.4.0/zipp.py --- old/zipp-3.2.0/zipp.py 2020-09-22 17:28:55.000000000 +0200 +++ new/zipp-3.4.0/zipp.py 2020-10-25 19:40:04.000000000 +0100 @@ -4,6 +4,7 @@ import itertools import contextlib import sys +import pathlib if sys.version_info < (3, 7): from collections import OrderedDict @@ -161,7 +162,7 @@ >>> 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' + >>> zf.filename = 'mem/abcde.zip' Path accepts the zipfile object itself or a filename @@ -173,9 +174,9 @@ >>> a, b = root.iterdir() >>> a - Path('abcde.zip', 'a.txt') + Path('mem/abcde.zip', 'a.txt') >>> b - Path('abcde.zip', 'b/') + Path('mem/abcde.zip', 'b/') name property: @@ -186,7 +187,7 @@ >>> c = b / 'c.txt' >>> c - Path('abcde.zip', 'b/c.txt') + Path('mem/abcde.zip', 'b/c.txt') >>> c.name 'c.txt' @@ -204,8 +205,21 @@ Coercion to string: - >>> str(c) - 'abcde.zip/b/c.txt' + >>> import os + >>> str(c).replace(os.sep, posixpath.sep) + 'mem/abcde.zip/b/c.txt' + + At the root, ``name``, ``filename``, and ``parent`` + resolve to the zipfile. Note these attributes are not + valid and will raise a ``ValueError`` if the zipfile + has no filename. + + >>> root.name + 'abcde.zip' + >>> str(root.filename).replace(os.sep, posixpath.sep) + 'mem/abcde.zip' + >>> str(root.parent) + 'mem' """ __repr = "{self.__class__.__name__}({self.root.filename!r}, {self.at!r})" @@ -243,7 +257,11 @@ @property def name(self): - return posixpath.basename(self.at.rstrip("/")) + return pathlib.Path(self.at).name or self.filename.name + + @property + def filename(self): + return pathlib.Path(self.root.filename).joinpath(self.at) def read_text(self, *args, **kwargs): with self.open('r', *args, **kwargs) as strm: @@ -280,14 +298,16 @@ def __repr__(self): return self.__repr.format(self=self) - def joinpath(self, add): - next = posixpath.join(self.at, _pathlib_compat(add)) + def joinpath(self, *other): + next = posixpath.join(self.at, *map(_pathlib_compat, other)) return self._next(self.root.resolve_dir(next)) __truediv__ = joinpath @property def parent(self): + if not self.at: + return self.filename.parent parent_at = posixpath.dirname(self.at.rstrip('/')) if parent_at: parent_at += '/' _______________________________________________ openSUSE Commits mailing list -- commit@lists.opensuse.org To unsubscribe, email commit-le...@lists.opensuse.org List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/commit@lists.opensuse.org