Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-setuptools_scm for openSUSE:Factory checked in at 2023-05-19 11:55:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-setuptools_scm (Old) and /work/SRC/openSUSE:Factory/.python-setuptools_scm.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-setuptools_scm" Fri May 19 11:55:11 2023 rev:33 rq:1086175 version:7.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-setuptools_scm/python-setuptools_scm.changes 2023-04-22 22:00:01.593060805 +0200 +++ /work/SRC/openSUSE:Factory/.python-setuptools_scm.new.1533/python-setuptools_scm.changes 2023-05-19 11:55:36.671294003 +0200 @@ -1,0 +2,19 @@ +Wed May 10 23:05:26 UTC 2023 - Ben Greiner <c...@bnavigator.de> + +- Reinstate tomli requirement for Python < 3.11 + +------------------------------------------------------------------- +Wed May 10 06:24:15 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 7.1.0: + * use tomllib from stdlib + * handle non-ascii in setup.cfg + * implement fallback file finders for archives + * removed coding header in python template + * declared Python 3.11 support + * update .git_archival.txt templates match + * git-describe invocation + * fix handling of .git-archival.txt from tagged + commit + +------------------------------------------------------------------- Old: ---- setuptools_scm-7.0.5.tar.gz New: ---- setuptools_scm-7.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-setuptools_scm.spec ++++++ --- /var/tmp/diff_new_pack.8fQnw7/_old 2023-05-19 11:55:37.243297277 +0200 +++ /var/tmp/diff_new_pack.8fQnw7/_new 2023-05-19 11:55:37.247297300 +0200 @@ -27,7 +27,7 @@ %{?sle15_python_module_pythons} Name: python-setuptools_scm%{psuffix} -Version: 7.0.5 +Version: 7.1.0 Release: 0 Summary: Python setuptools handler for SCM tags License: MIT @@ -43,17 +43,19 @@ BuildRequires: python-rpm-macros Requires: python-packaging >= 20.0 Requires: python-setuptools -Requires: python-tomli >= 1.0.0 Requires: python-typing-extensions %if 0%{?python_version_nodots} < 38 Requires: python-importlib-metadata %endif +%if 0%{?python_version_nodots} < 311 +Requires: python-tomli >= 1 +%endif BuildArch: noarch %if %{with test} # Testing requirements BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools_scm = %{version}} -BuildRequires: %{python_module virtualenv} +BuildRequires: %{python_module virtualenv > 20} BuildRequires: git-core BuildRequires: mercurial %endif ++++++ setuptools_scm-7.0.5.tar.gz -> setuptools_scm-7.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/.github/workflows/python-tests.yml new/setuptools_scm-7.1.0/.github/workflows/python-tests.yml --- old/setuptools_scm-7.0.5/.github/workflows/python-tests.yml 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/.github/workflows/python-tests.yml 2022-12-17 17:05:30.000000000 +0100 @@ -4,16 +4,17 @@ pull_request: push: branches: - - main + - "*" tags: - "v*" - release: - types: [published] concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true +env: + FORCE_COLOR: 1 + jobs: test: runs-on: ${{ matrix.os }} @@ -68,10 +69,7 @@ - run: pip install -U 'setuptools>=45' if: matrix.python_version != 'msys2' - run: pip install -e .[toml,test] - # pip2 is needed because Mercurial uses python2 on Ubuntu 20.04 - run: | - curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py - sudo python2 get-pip.py $(hg debuginstall --template "{pythonexe}") -m pip install hg-git --user if: matrix.os == 'ubuntu-latest' - run: pytest @@ -79,9 +77,9 @@ test_legacy_setuptools: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Setup python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.7" architecture: x64 @@ -98,7 +96,7 @@ steps: - uses: actions/checkout@v3 - name: Setup python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python_version }} architecture: x64 @@ -118,8 +116,8 @@ needs: [test] name: Python sdist/wheel steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: "3.8" - name: Install dependencies @@ -129,7 +127,7 @@ - name: Build package run: python -m build -o dist/ - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: dist path: dist @@ -139,12 +137,12 @@ runs-on: ubuntu-latest needs: [dist] steps: - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: "3.8" - name: Install dependencies run: pip install twine - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: dist path: dist @@ -156,7 +154,7 @@ if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') needs: [dist_check] steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: dist path: dist diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/CHANGELOG.rst new/setuptools_scm-7.1.0/CHANGELOG.rst --- old/setuptools_scm-7.0.5/CHANGELOG.rst 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/CHANGELOG.rst 2022-12-17 17:05:30.000000000 +0100 @@ -1,3 +1,14 @@ +v7.1.0 +====== + +* #748: use tomllib from stdlib +* fix #762: handle non-ascii in setup.cfg +* #752: implement fallback file finders for archives +* #765: removed coding header in python template +* declared Python 3.11 support +* fix #759: update .git_archival.txt templates match + git-describe invocation +* fix #772: fix handling of .git-archival.txt from tagged commit v7.0.5 ======= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/PKG-INFO new/setuptools_scm-7.1.0/PKG-INFO --- old/setuptools_scm-7.0.5/PKG-INFO 2022-07-11 14:50:44.510526400 +0200 +++ new/setuptools_scm-7.1.0/PKG-INFO 2022-12-17 17:05:44.405958700 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: setuptools_scm -Version: 7.0.5 +Version: 7.1.0 Summary: the blessed package to manage your versions by scm tags Home-page: https://github.com/pypa/setuptools_scm/ Author: Ronny Pfannschmidt @@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Software Development :: Version Control Classifier: Topic :: System :: Software Distribution @@ -29,21 +30,20 @@ setuptools_scm ============== -``setuptools_scm`` extract Python package versions from ``git`` or +``setuptools_scm`` extracts Python package versions from ``git`` or ``hg`` metadata instead of declaring them as the version argument or in a SCM managed file. -Additionally ``setuptools_scm`` provides setuptools with a list of files that are managed by the SCM -(i.e. it automatically adds all of the SCM-managed files to the sdist). -Unwanted files must be excluded by discarding them via ``MANIFEST.in``. +Additionally ``setuptools_scm`` provides setuptools with a list of +files that are managed by the SCM (i.e. it automatically adds all of +the SCM-managed files to the sdist). Unwanted files must be excluded +by discarding them via ``MANIFEST.in``. -``setuptools_scm`` support the following scm out of the box: +``setuptools_scm`` supports the following scm out of the box: * git * mercurial - - .. image:: https://github.com/pypa/setuptools_scm/workflows/python%20tests+artifacts+release/badge.svg :target: https://github.com/pypa/setuptools_scm/actions @@ -71,7 +71,6 @@ [build-system] requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] - That will be sufficient to require ``setuptools_scm`` for projects that support PEP 518 (`pip <https://pypi.org/project/pip>`_ and `pep517 <https://pypi.org/project/pep517/>`_). Many tools, @@ -80,7 +79,17 @@ with those uses, consider also including a ``setup_requires`` directive (described below in ``setup.py usage`` and ``setup.cfg``). -To enable version inference, add this section to your ``pyproject.toml``: +To enable version inference, you need to set the version +dynamically in the ``project`` section of ``pyproject.toml``: + +.. code:: toml + + # pyproject.toml + [project] + # version = "0.0.1" # Remove any existing version parameter. + dynamic = ["version"] + +Then add this section to your ``pyproject.toml``: .. code:: toml @@ -95,10 +104,10 @@ .. code:: toml # pyproject.toml - [tool.setuptools_scm] write_to = "pkg/_version.py" +Where ``pkg`` is the name of your package. If you need to confirm which version string is being generated or debug the configuration, you can install @@ -180,6 +189,7 @@ usage in ``setup.cfg`` is considered deprecated, please use ``pyproject.toml`` whenever possible. + Programmatic usage ------------------ @@ -250,6 +260,7 @@ the working directory for good reasons and using the installed metadata prevents using needless volatile data there. + Usage from Docker ----------------- @@ -283,6 +294,7 @@ version as a build argument. Note that ``SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${UPPERCASED_DIST_NAME}`` is preferred over ``SETUPTOOLS_SCM_PRETEND_VERSION``. + Default versioning scheme ------------------------- @@ -306,10 +318,10 @@ The next version is calculated by adding ``1`` to the last numeric component of the tag. - For Git projects, the version relies on `git describe <https://git-scm.com/docs/git-describe>`_, so you will see an additional ``g`` prepended to the ``{revision hash}``. + Semantic Versioning (SemVer) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -334,6 +346,7 @@ 3. ``.git_archival.txt`` files (git archives, see subsection below) 4. ``PKG-INFO`` + Git archives ~~~~~~~~~~~~ @@ -344,7 +357,7 @@ node: $Format:%H$ node-date: $Format:%cI$ - describe-name: $Format:%(describe:tags=true)$ + describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ ref-names: $Format:%D$ Create the ``.gitattributes`` file in the root directory of your repository @@ -356,6 +369,9 @@ git add .git_archival.txt .gitattributes && git commit +Note that if you are creating a ``_version.py`` file, note that it should not +be kept in version control. + File finders hook makes most of MANIFEST.in unnecessary ------------------------------------------------------- @@ -481,7 +497,6 @@ that setuptools will still normalize it to create the final distribution, so as to stay compliant with the python packaging standards. - To use ``setuptools_scm`` in other Python code you can use the ``get_version`` function: @@ -507,6 +522,7 @@ } ) + Environment variables --------------------- @@ -515,7 +531,6 @@ its used as the primary source for the version number in which case it will be a unparsed string - :SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${UPPERCASED_DIST_NAME}: when defined and not empty, its used as the primary source for the version number @@ -523,7 +538,6 @@ it takes precedence over ``SETUPTOOLS_SCM_PRETEND_VERSION`` - :SETUPTOOLS_SCM_DEBUG: when defined and not empty, a lot of debug information will be printed as part of ``setuptools_scm`` @@ -535,17 +549,18 @@ derived, otherwise the current time is used (https://reproducible-builds.org/docs/source-date-epoch/) - :SETUPTOOLS_SCM_IGNORE_VCS_ROOTS: when defined, a ``os.pathsep`` separated list of directory names to ignore for root finding + Extending setuptools_scm ------------------------ ``setuptools_scm`` ships with a few ``setuptools`` entrypoints based hooks to extend its default capabilities. + Adding a new SCM ~~~~~~~~~~~~~~~~ @@ -567,6 +582,7 @@ Also use then name of your SCM control directory as name of the entrypoint. + Version number construction ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -622,7 +638,6 @@ Within that callable, ``setuptools_scm`` is available for import. The callable must return the configuration. - .. code:: python # content of setup.py @@ -669,7 +684,6 @@ and/or install the package by using wheels or eggs. - Code of Conduct --------------- @@ -679,6 +693,7 @@ .. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md + Security Contact ================ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/README.rst new/setuptools_scm-7.1.0/README.rst --- old/setuptools_scm-7.0.5/README.rst 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/README.rst 2022-12-17 17:05:30.000000000 +0100 @@ -1,21 +1,20 @@ setuptools_scm ============== -``setuptools_scm`` extract Python package versions from ``git`` or +``setuptools_scm`` extracts Python package versions from ``git`` or ``hg`` metadata instead of declaring them as the version argument or in a SCM managed file. -Additionally ``setuptools_scm`` provides setuptools with a list of files that are managed by the SCM -(i.e. it automatically adds all of the SCM-managed files to the sdist). -Unwanted files must be excluded by discarding them via ``MANIFEST.in``. +Additionally ``setuptools_scm`` provides setuptools with a list of +files that are managed by the SCM (i.e. it automatically adds all of +the SCM-managed files to the sdist). Unwanted files must be excluded +by discarding them via ``MANIFEST.in``. -``setuptools_scm`` support the following scm out of the box: +``setuptools_scm`` supports the following scm out of the box: * git * mercurial - - .. image:: https://github.com/pypa/setuptools_scm/workflows/python%20tests+artifacts+release/badge.svg :target: https://github.com/pypa/setuptools_scm/actions @@ -43,7 +42,6 @@ [build-system] requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] - That will be sufficient to require ``setuptools_scm`` for projects that support PEP 518 (`pip <https://pypi.org/project/pip>`_ and `pep517 <https://pypi.org/project/pep517/>`_). Many tools, @@ -52,7 +50,17 @@ with those uses, consider also including a ``setup_requires`` directive (described below in ``setup.py usage`` and ``setup.cfg``). -To enable version inference, add this section to your ``pyproject.toml``: +To enable version inference, you need to set the version +dynamically in the ``project`` section of ``pyproject.toml``: + +.. code:: toml + + # pyproject.toml + [project] + # version = "0.0.1" # Remove any existing version parameter. + dynamic = ["version"] + +Then add this section to your ``pyproject.toml``: .. code:: toml @@ -67,10 +75,10 @@ .. code:: toml # pyproject.toml - [tool.setuptools_scm] write_to = "pkg/_version.py" +Where ``pkg`` is the name of your package. If you need to confirm which version string is being generated or debug the configuration, you can install @@ -152,6 +160,7 @@ usage in ``setup.cfg`` is considered deprecated, please use ``pyproject.toml`` whenever possible. + Programmatic usage ------------------ @@ -222,6 +231,7 @@ the working directory for good reasons and using the installed metadata prevents using needless volatile data there. + Usage from Docker ----------------- @@ -255,6 +265,7 @@ version as a build argument. Note that ``SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${UPPERCASED_DIST_NAME}`` is preferred over ``SETUPTOOLS_SCM_PRETEND_VERSION``. + Default versioning scheme ------------------------- @@ -278,10 +289,10 @@ The next version is calculated by adding ``1`` to the last numeric component of the tag. - For Git projects, the version relies on `git describe <https://git-scm.com/docs/git-describe>`_, so you will see an additional ``g`` prepended to the ``{revision hash}``. + Semantic Versioning (SemVer) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -306,6 +317,7 @@ 3. ``.git_archival.txt`` files (git archives, see subsection below) 4. ``PKG-INFO`` + Git archives ~~~~~~~~~~~~ @@ -316,7 +328,7 @@ node: $Format:%H$ node-date: $Format:%cI$ - describe-name: $Format:%(describe:tags=true)$ + describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ ref-names: $Format:%D$ Create the ``.gitattributes`` file in the root directory of your repository @@ -328,6 +340,9 @@ git add .git_archival.txt .gitattributes && git commit +Note that if you are creating a ``_version.py`` file, note that it should not +be kept in version control. + File finders hook makes most of MANIFEST.in unnecessary ------------------------------------------------------- @@ -453,7 +468,6 @@ that setuptools will still normalize it to create the final distribution, so as to stay compliant with the python packaging standards. - To use ``setuptools_scm`` in other Python code you can use the ``get_version`` function: @@ -479,6 +493,7 @@ } ) + Environment variables --------------------- @@ -487,7 +502,6 @@ its used as the primary source for the version number in which case it will be a unparsed string - :SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${UPPERCASED_DIST_NAME}: when defined and not empty, its used as the primary source for the version number @@ -495,7 +509,6 @@ it takes precedence over ``SETUPTOOLS_SCM_PRETEND_VERSION`` - :SETUPTOOLS_SCM_DEBUG: when defined and not empty, a lot of debug information will be printed as part of ``setuptools_scm`` @@ -507,17 +520,18 @@ derived, otherwise the current time is used (https://reproducible-builds.org/docs/source-date-epoch/) - :SETUPTOOLS_SCM_IGNORE_VCS_ROOTS: when defined, a ``os.pathsep`` separated list of directory names to ignore for root finding + Extending setuptools_scm ------------------------ ``setuptools_scm`` ships with a few ``setuptools`` entrypoints based hooks to extend its default capabilities. + Adding a new SCM ~~~~~~~~~~~~~~~~ @@ -539,6 +553,7 @@ Also use then name of your SCM control directory as name of the entrypoint. + Version number construction ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -594,7 +609,6 @@ Within that callable, ``setuptools_scm`` is available for import. The callable must return the configuration. - .. code:: python # content of setup.py @@ -641,7 +655,6 @@ and/or install the package by using wheels or eggs. - Code of Conduct --------------- @@ -651,6 +664,7 @@ .. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md + Security Contact ================ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/setup.cfg new/setuptools_scm-7.1.0/setup.cfg --- old/setuptools_scm-7.0.5/setup.cfg 2022-07-11 14:50:44.510526400 +0200 +++ new/setuptools_scm-7.1.0/setup.cfg 2022-12-17 17:05:44.405958700 +0100 @@ -19,6 +19,7 @@ Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 Topic :: Software Development :: Libraries Topic :: Software Development :: Version Control Topic :: System :: Software Distribution @@ -29,9 +30,9 @@ install_requires = packaging>=20.0 setuptools - tomli>=1.0.0 # keep in sync typing-extensions importlib-metadata;python_version < '3.8' + tomli>=1.0.0;python_version < '3.11' # keep in sync python_requires = >=3.7 package_dir = =src @@ -50,6 +51,9 @@ setuptools_scm.files_command = .hg = setuptools_scm.file_finder_hg:hg_find_files .git = setuptools_scm.file_finder_git:git_find_files +setuptools_scm.files_command_fallback = + .hg_archival.txt = setuptools_scm.file_finder_hg:hg_archive_find_files + .git_archival.txt = setuptools_scm.file_finder_git:git_archive_find_files setuptools_scm.local_scheme = node-and-date = setuptools_scm.version:get_local_node_and_date node-and-timestamp = setuptools_scm.version:get_local_node_and_timestamp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/src/setuptools_scm/.git_archival.txt new/setuptools_scm-7.1.0/src/setuptools_scm/.git_archival.txt --- old/setuptools_scm-7.0.5/src/setuptools_scm/.git_archival.txt 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/src/setuptools_scm/.git_archival.txt 2022-12-17 17:05:30.000000000 +0100 @@ -1,4 +1,4 @@ node: $Format:%H$ node-date: $Format:%cI$ -describe-name: $Format:%(describe)$ +describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ ref-names: $Format:%D$ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/src/setuptools_scm/__init__.py new/setuptools_scm-7.1.0/src/setuptools_scm/__init__.py --- old/setuptools_scm-7.0.5/src/setuptools_scm/__init__.py 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/src/setuptools_scm/__init__.py 2022-12-17 17:05:30.000000000 +0100 @@ -36,7 +36,6 @@ TEMPLATES = { ".py": """\ -# coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control __version__ = version = {version!r} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/src/setuptools_scm/_integration/pyproject_reading.py new/setuptools_scm-7.1.0/src/setuptools_scm/_integration/pyproject_reading.py --- old/setuptools_scm-7.0.5/src/setuptools_scm/_integration/pyproject_reading.py 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/src/setuptools_scm/_integration/pyproject_reading.py 2022-12-17 17:05:30.000000000 +0100 @@ -1,5 +1,6 @@ from __future__ import annotations +import sys import warnings from typing import Any from typing import Callable @@ -28,8 +29,11 @@ return self.project.get("name") -def lazy_tomli_load(data: str) -> TOML_RESULT: - from tomli import loads +def lazy_toml_load(data: str) -> TOML_RESULT: + if sys.version_info >= (3, 11): + from tomllib import loads + else: + from tomli import loads return loads(data) @@ -40,7 +44,7 @@ _load_toml: TOML_LOADER | None = None, ) -> PyProjectData: if _load_toml is None: - _load_toml = lazy_tomli_load + _load_toml = lazy_toml_load with open(name, encoding="UTF-8") as strm: data = strm.read() defn = _load_toml(data) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/src/setuptools_scm/_integration/setuptools.py new/setuptools_scm-7.1.0/src/setuptools_scm/_integration/setuptools.py --- old/setuptools_scm-7.0.5/src/setuptools_scm/_integration/setuptools.py 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/src/setuptools_scm/_integration/setuptools.py 2022-12-17 17:05:30.000000000 +0100 @@ -14,7 +14,7 @@ parser = configparser.ConfigParser() if isinstance(input, (os.PathLike, str)): - parser.read([input]) + parser.read([input], encoding="utf-8") else: parser.read_file(input) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/src/setuptools_scm/file_finder.py new/setuptools_scm-7.1.0/src/setuptools_scm/file_finder.py --- old/setuptools_scm-7.0.5/src/setuptools_scm/file_finder.py 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/src/setuptools_scm/file_finder.py 2022-12-17 17:05:30.000000000 +0100 @@ -11,7 +11,10 @@ def scm_find_files( - path: _t.PathT, scm_files: set[str], scm_dirs: set[str] + path: _t.PathT, + scm_files: set[str], + scm_dirs: set[str], + force_all_files: bool = False, ) -> list[str]: """ setuptools compatible file finder that follows symlinks @@ -20,6 +23,7 @@ (including symlinks to directories) - scm_dirs: set of scm controlled directories (including directories containing no scm controlled files) + - force_all_files: ignore ``scm_files`` and ``scm_dirs`` and list everything. scm_files and scm_dirs must be absolute with symlinks resolved (realpath), with normalized case (normcase) @@ -38,7 +42,7 @@ fn = os.path.join(realdirpath, os.path.normcase(n)) return os.path.islink(fn) and fn not in scm_files - if realdirpath not in scm_dirs: + if not force_all_files and realdirpath not in scm_dirs: # directory not in scm, don't walk it's content dirnames[:] = [] continue @@ -54,13 +58,16 @@ # symlink loop protection dirnames[:] = [] continue - dirnames[:] = [dn for dn in dirnames if not _link_not_in_scm(dn)] + dirnames[:] = [ + dn for dn in dirnames if force_all_files or not _link_not_in_scm(dn) + ] for filename in filenames: - if _link_not_in_scm(filename): + if not force_all_files and _link_not_in_scm(filename): continue # dirpath + filename with symlinks preserved fullfilename = os.path.join(dirpath, filename) - if os.path.normcase(os.path.realpath(fullfilename)) in scm_files: + is_tracked = os.path.normcase(os.path.realpath(fullfilename)) in scm_files + if force_all_files or is_tracked: res.append(os.path.join(path, os.path.relpath(fullfilename, realpath))) seen.add(realdirpath) return res diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/src/setuptools_scm/file_finder_git.py new/setuptools_scm-7.1.0/src/setuptools_scm/file_finder_git.py --- old/setuptools_scm-7.0.5/src/setuptools_scm/file_finder_git.py 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/src/setuptools_scm/file_finder_git.py 2022-12-17 17:05:30.000000000 +0100 @@ -9,6 +9,7 @@ from .file_finder import is_toplevel_acceptable from .file_finder import scm_find_files +from .utils import data_from_mime from .utils import do_ex from .utils import trace @@ -101,3 +102,20 @@ trace("toplevel mismatch", toplevel, fullpath) git_files, git_dirs = _git_ls_files_and_dirs(toplevel) return scm_find_files(path, git_files, git_dirs) + + +def git_archive_find_files(path: _t.PathT = "") -> list[str]: + # This function assumes that ``path`` is obtained from a git archive + # and therefore all the files that should be ignored were already removed. + archival = os.path.join(path, ".git_archival.txt") + if not os.path.exists(archival): + return [] + + data = data_from_mime(archival) + + if "$Format" in data.get("node", ""): + # Substitutions have not been performed, so not a reliable archive + return [] + + trace("git archive detected - fallback to listing all files") + return scm_find_files(path, set(), set(), force_all_files=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/src/setuptools_scm/file_finder_hg.py new/setuptools_scm-7.1.0/src/setuptools_scm/file_finder_hg.py --- old/setuptools_scm-7.0.5/src/setuptools_scm/file_finder_hg.py 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/src/setuptools_scm/file_finder_hg.py 2022-12-17 17:05:30.000000000 +0100 @@ -2,10 +2,16 @@ import os import subprocess +from typing import TYPE_CHECKING from .file_finder import is_toplevel_acceptable from .file_finder import scm_find_files +from .utils import data_from_mime from .utils import do_ex +from .utils import trace + +if TYPE_CHECKING: + from . import _types as _t def _hg_toplevel(path: str) -> str | None: @@ -49,3 +55,20 @@ assert toplevel is not None hg_files, hg_dirs = _hg_ls_files_and_dirs(toplevel) return scm_find_files(path, hg_files, hg_dirs) + + +def hg_archive_find_files(path: _t.PathT = "") -> list[str]: + # This function assumes that ``path`` is obtained from a mercurial archive + # and therefore all the files that should be ignored were already removed. + archival = os.path.join(path, ".hg_archival.txt") + if not os.path.exists(archival): + return [] + + data = data_from_mime(archival) + + if "node" not in data: + # Ensure file is valid + return [] + + trace("hg archive detected - fallback to listing all files") + return scm_find_files(path, set(), set(), force_all_files=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/src/setuptools_scm/git.py new/setuptools_scm-7.1.0/src/setuptools_scm/git.py --- old/setuptools_scm-7.0.5/src/setuptools_scm/git.py 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/src/setuptools_scm/git.py 2022-12-17 17:05:30.000000000 +0100 @@ -232,9 +232,13 @@ ) -def _git_parse_describe(describe_output: str) -> tuple[str, int, str, bool]: +def _git_parse_describe( + describe_output: str, +) -> tuple[str, int | None, str | None, bool]: # 'describe_output' looks e.g. like 'v1.5.0-0-g4060507' or # 'v1.15.1rc1-37-g9bd1298-dirty'. + # It may also just be a bare tag name if this is a tagged commit and we are + # parsing a .git_archival.txt file. if describe_output.endswith("-dirty"): dirty = True @@ -242,8 +246,15 @@ else: dirty = False - tag, number, node = describe_output.rsplit("-", 2) - return tag, int(number), node, dirty + split = describe_output.rsplit("-", 2) + if len(split) < 3: # probably a tagged commit + tag = describe_output + number = None + node = None + else: + tag, number_, node = split + number = int(number_) + return tag, number, node, dirty def search_parent(dirname: _t.PathT) -> GitWorkdir | None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/src/setuptools_scm/integration.py new/setuptools_scm-7.1.0/src/setuptools_scm/integration.py --- old/setuptools_scm-7.0.5/src/setuptools_scm/integration.py 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/src/setuptools_scm/integration.py 2022-12-17 17:05:30.000000000 +0100 @@ -1,5 +1,6 @@ from __future__ import annotations +import itertools import os import warnings from typing import Any @@ -91,7 +92,10 @@ def find_files(path: _t.PathT = "") -> list[str]: - for ep in iter_entry_points("setuptools_scm.files_command"): + for ep in itertools.chain( + iter_entry_points("setuptools_scm.files_command"), + iter_entry_points("setuptools_scm.files_command_fallback"), + ): command = ep.load() if isinstance(command, str): # this technique is deprecated diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/src/setuptools_scm.egg-info/PKG-INFO new/setuptools_scm-7.1.0/src/setuptools_scm.egg-info/PKG-INFO --- old/setuptools_scm-7.0.5/src/setuptools_scm.egg-info/PKG-INFO 2022-07-11 14:50:44.000000000 +0200 +++ new/setuptools_scm-7.1.0/src/setuptools_scm.egg-info/PKG-INFO 2022-12-17 17:05:44.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: setuptools-scm -Version: 7.0.5 +Version: 7.1.0 Summary: the blessed package to manage your versions by scm tags Home-page: https://github.com/pypa/setuptools_scm/ Author: Ronny Pfannschmidt @@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Software Development :: Version Control Classifier: Topic :: System :: Software Distribution @@ -29,21 +30,20 @@ setuptools_scm ============== -``setuptools_scm`` extract Python package versions from ``git`` or +``setuptools_scm`` extracts Python package versions from ``git`` or ``hg`` metadata instead of declaring them as the version argument or in a SCM managed file. -Additionally ``setuptools_scm`` provides setuptools with a list of files that are managed by the SCM -(i.e. it automatically adds all of the SCM-managed files to the sdist). -Unwanted files must be excluded by discarding them via ``MANIFEST.in``. +Additionally ``setuptools_scm`` provides setuptools with a list of +files that are managed by the SCM (i.e. it automatically adds all of +the SCM-managed files to the sdist). Unwanted files must be excluded +by discarding them via ``MANIFEST.in``. -``setuptools_scm`` support the following scm out of the box: +``setuptools_scm`` supports the following scm out of the box: * git * mercurial - - .. image:: https://github.com/pypa/setuptools_scm/workflows/python%20tests+artifacts+release/badge.svg :target: https://github.com/pypa/setuptools_scm/actions @@ -71,7 +71,6 @@ [build-system] requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] - That will be sufficient to require ``setuptools_scm`` for projects that support PEP 518 (`pip <https://pypi.org/project/pip>`_ and `pep517 <https://pypi.org/project/pep517/>`_). Many tools, @@ -80,7 +79,17 @@ with those uses, consider also including a ``setup_requires`` directive (described below in ``setup.py usage`` and ``setup.cfg``). -To enable version inference, add this section to your ``pyproject.toml``: +To enable version inference, you need to set the version +dynamically in the ``project`` section of ``pyproject.toml``: + +.. code:: toml + + # pyproject.toml + [project] + # version = "0.0.1" # Remove any existing version parameter. + dynamic = ["version"] + +Then add this section to your ``pyproject.toml``: .. code:: toml @@ -95,10 +104,10 @@ .. code:: toml # pyproject.toml - [tool.setuptools_scm] write_to = "pkg/_version.py" +Where ``pkg`` is the name of your package. If you need to confirm which version string is being generated or debug the configuration, you can install @@ -180,6 +189,7 @@ usage in ``setup.cfg`` is considered deprecated, please use ``pyproject.toml`` whenever possible. + Programmatic usage ------------------ @@ -250,6 +260,7 @@ the working directory for good reasons and using the installed metadata prevents using needless volatile data there. + Usage from Docker ----------------- @@ -283,6 +294,7 @@ version as a build argument. Note that ``SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${UPPERCASED_DIST_NAME}`` is preferred over ``SETUPTOOLS_SCM_PRETEND_VERSION``. + Default versioning scheme ------------------------- @@ -306,10 +318,10 @@ The next version is calculated by adding ``1`` to the last numeric component of the tag. - For Git projects, the version relies on `git describe <https://git-scm.com/docs/git-describe>`_, so you will see an additional ``g`` prepended to the ``{revision hash}``. + Semantic Versioning (SemVer) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -334,6 +346,7 @@ 3. ``.git_archival.txt`` files (git archives, see subsection below) 4. ``PKG-INFO`` + Git archives ~~~~~~~~~~~~ @@ -344,7 +357,7 @@ node: $Format:%H$ node-date: $Format:%cI$ - describe-name: $Format:%(describe:tags=true)$ + describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ ref-names: $Format:%D$ Create the ``.gitattributes`` file in the root directory of your repository @@ -356,6 +369,9 @@ git add .git_archival.txt .gitattributes && git commit +Note that if you are creating a ``_version.py`` file, note that it should not +be kept in version control. + File finders hook makes most of MANIFEST.in unnecessary ------------------------------------------------------- @@ -481,7 +497,6 @@ that setuptools will still normalize it to create the final distribution, so as to stay compliant with the python packaging standards. - To use ``setuptools_scm`` in other Python code you can use the ``get_version`` function: @@ -507,6 +522,7 @@ } ) + Environment variables --------------------- @@ -515,7 +531,6 @@ its used as the primary source for the version number in which case it will be a unparsed string - :SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${UPPERCASED_DIST_NAME}: when defined and not empty, its used as the primary source for the version number @@ -523,7 +538,6 @@ it takes precedence over ``SETUPTOOLS_SCM_PRETEND_VERSION`` - :SETUPTOOLS_SCM_DEBUG: when defined and not empty, a lot of debug information will be printed as part of ``setuptools_scm`` @@ -535,17 +549,18 @@ derived, otherwise the current time is used (https://reproducible-builds.org/docs/source-date-epoch/) - :SETUPTOOLS_SCM_IGNORE_VCS_ROOTS: when defined, a ``os.pathsep`` separated list of directory names to ignore for root finding + Extending setuptools_scm ------------------------ ``setuptools_scm`` ships with a few ``setuptools`` entrypoints based hooks to extend its default capabilities. + Adding a new SCM ~~~~~~~~~~~~~~~~ @@ -567,6 +582,7 @@ Also use then name of your SCM control directory as name of the entrypoint. + Version number construction ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -622,7 +638,6 @@ Within that callable, ``setuptools_scm`` is available for import. The callable must return the configuration. - .. code:: python # content of setup.py @@ -669,7 +684,6 @@ and/or install the package by using wheels or eggs. - Code of Conduct --------------- @@ -679,6 +693,7 @@ .. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md + Security Contact ================ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/src/setuptools_scm.egg-info/entry_points.txt new/setuptools_scm-7.1.0/src/setuptools_scm.egg-info/entry_points.txt --- old/setuptools_scm-7.0.5/src/setuptools_scm.egg-info/entry_points.txt 2022-07-11 14:50:44.000000000 +0200 +++ new/setuptools_scm-7.1.0/src/setuptools_scm.egg-info/entry_points.txt 2022-12-17 17:05:44.000000000 +0100 @@ -11,6 +11,10 @@ .git = setuptools_scm.file_finder_git:git_find_files .hg = setuptools_scm.file_finder_hg:hg_find_files +[setuptools_scm.files_command_fallback] +.git_archival.txt = setuptools_scm.file_finder_git:git_archive_find_files +.hg_archival.txt = setuptools_scm.file_finder_hg:hg_archive_find_files + [setuptools_scm.local_scheme] dirty-tag = setuptools_scm.version:get_local_dirty_tag no-local-version = setuptools_scm.version:get_no_local_node diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/src/setuptools_scm.egg-info/requires.txt new/setuptools_scm-7.1.0/src/setuptools_scm.egg-info/requires.txt --- old/setuptools_scm-7.0.5/src/setuptools_scm.egg-info/requires.txt 2022-07-11 14:50:44.000000000 +0200 +++ new/setuptools_scm-7.1.0/src/setuptools_scm.egg-info/requires.txt 2022-12-17 17:05:44.000000000 +0100 @@ -1,8 +1,10 @@ packaging>=20.0 setuptools -tomli>=1.0.0 typing-extensions +[:python_version < "3.11"] +tomli>=1.0.0 + [:python_version < "3.8"] importlib-metadata diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/testing/test_file_finder.py new/setuptools_scm-7.1.0/testing/test_file_finder.py --- old/setuptools_scm-7.0.5/testing/test_file_finder.py 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/testing/test_file_finder.py 2022-12-17 17:05:30.000000000 +0100 @@ -201,3 +201,33 @@ @pytest.mark.skip_commit def test_not_commited(inwd: WorkDir) -> None: assert find_files() == [] + + +def test_unexpanded_git_archival(wd: WorkDir, monkeypatch: pytest.MonkeyPatch) -> None: + # When substitutions in `.git_archival.txt` are not expanded, files should + # not be automatically listed. + monkeypatch.chdir(wd.cwd) + (wd.cwd / ".git_archival.txt").write_text("node: $Format:%H$", encoding="utf-8") + (wd.cwd / "file1.txt").touch() + assert find_files() == [] + + +@pytest.mark.parametrize("archive_file", (".git_archival.txt", ".hg_archival.txt")) +def test_archive( + wd: WorkDir, monkeypatch: pytest.MonkeyPatch, archive_file: str +) -> None: + # When substitutions in `.git_archival.txt` are not expanded, files should + # not be automatically listed. + monkeypatch.chdir(wd.cwd) + sha = "a1bda3d984d1a40d7b00ae1d0869354d6d503001" + (wd.cwd / archive_file).write_text(f"node: {sha}", encoding="utf-8") + (wd.cwd / "data").mkdir() + (wd.cwd / "data" / "datafile").touch() + + datalink = wd.cwd / "data" / "datalink" + if sys.platform != "win32": + datalink.symlink_to("data/datafile") + else: + os.link("data/datafile", datalink) + + assert set(find_files()) == _sep({archive_file, "data/datafile", "data/datalink"}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/testing/test_git.py new/setuptools_scm-7.1.0/testing/test_git.py --- old/setuptools_scm-7.0.5/testing/test_git.py 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/testing/test_git.py 2022-12-17 17:05:30.000000000 +0100 @@ -24,7 +24,6 @@ from setuptools_scm import NonNormalizedVersion from setuptools_scm.file_finder_git import git_find_files from setuptools_scm.git import archival_to_version -from setuptools_scm.utils import data_from_mime from setuptools_scm.utils import do from setuptools_scm.utils import has_command @@ -524,6 +523,7 @@ ("0.0", {"node": "0" * 20}), ("1.2.2", {"describe-name": "release-1.2.2-0-g00000"}), ("1.2.2.dev0", {"ref-names": "tag: release-1.2.2.dev"}), + ("1.2.2", {"describe-name": "v1.2.2"}), ], ) @pytest.mark.filterwarnings("ignore:git archive did not support describe output") @@ -546,12 +546,9 @@ assert version is None -def test_git_archhival_from_unfiltered() -> None: +def test_git_archival_from_unfiltered() -> None: config = Configuration() - import setuptools_scm - - data = data_from_mime(Path(setuptools_scm.__file__).parent / ".git_archival.txt") with pytest.warns(UserWarning, match="unexported git archival found"): - version = archival_to_version(data, config=config) + version = archival_to_version({"node": "$Format:%H$"}, config=config) assert version is None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/testing/test_integration.py new/setuptools_scm-7.1.0/testing/test_integration.py --- old/setuptools_scm-7.0.5/testing/test_integration.py 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/testing/test_integration.py 2022-12-17 17:05:30.000000000 +0100 @@ -6,6 +6,7 @@ import pytest +import setuptools_scm._integration.setuptools from .wd_wrapper import WorkDir from setuptools_scm import PRETEND_KEY from setuptools_scm import PRETEND_KEY_NAMED @@ -24,7 +25,8 @@ def test_pyproject_support(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: - pytest.importorskip("tomli") + if sys.version_info <= (3, 10): + pytest.importorskip("tomli") monkeypatch.delenv("SETUPTOOLS_SCM_DEBUG") pkg = tmp_path / "package" pkg.mkdir() @@ -83,7 +85,8 @@ @with_metadata_in def test_pyproject_support_with_git(wd: WorkDir, metadata_in: str) -> None: - pytest.importorskip("tomli") + if sys.version_info <= (3, 10): + pytest.importorskip("tomli") wd.write("pyproject.toml", PYPROJECT_FILES[metadata_in]) wd.write("setup.py", SETUP_PY_FILES[metadata_in]) wd.write("setup.cfg", SETUP_CFG_FILES[metadata_in]) @@ -150,3 +153,20 @@ dist = distribution("setuptools_scm") assert sorted(dist.metadata.get_all("Provides-Extra")) == ["test", "toml"] + + +@pytest.mark.issue(760) +def test_unicode_in_setup_cfg(tmp_path: Path) -> None: + cfg = tmp_path / "setup.cfg" + cfg.write_text( + textwrap.dedent( + """ + [metadata] + name = configparser + author = Åukasz Langa + """ + ), + encoding="utf-8", + ) + name = setuptools_scm._integration.setuptools.read_dist_name_from_setup_cfg(cfg) + assert name == "configparser" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools_scm-7.0.5/tox.ini new/setuptools_scm-7.1.0/tox.ini --- old/setuptools_scm-7.0.5/tox.ini 2022-07-11 14:50:33.000000000 +0200 +++ new/setuptools_scm-7.1.0/tox.ini 2022-12-17 17:05:30.000000000 +0100 @@ -1,5 +1,5 @@ [tox] -envlist=py{37,38,39,310}-{test,selfcheck},check_readme,check-dist,check-bootstrap +envlist=py{37,38,39,310,311}-{test,selfcheck},check_readme,check-dist,check-bootstrap [pytest] testpaths=testing @@ -27,7 +27,6 @@ deps= pytest setuptools >= 45 - tomli virtualenv>20 typing_extensions commands=