Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-hatch_vcs for 
openSUSE:Factory checked in at 2022-12-12 17:37:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-hatch_vcs (Old)
 and      /work/SRC/openSUSE:Factory/.python-hatch_vcs.new.1835 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-hatch_vcs"

Mon Dec 12 17:37:14 2022 rev:4 rq:1042089 version:0.3.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-hatch_vcs/python-hatch_vcs.changes        
2022-12-08 16:50:16.599204000 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-hatch_vcs.new.1835/python-hatch_vcs.changes  
    2022-12-12 17:37:15.288440107 +0100
@@ -1,0 +2,10 @@
+Sat Dec 10 17:00:57 UTC 2022 - Johannes Kastl <ka...@b1-systems.de>
+
+- update to 0.3.0:
+  * Changed
+    - Drop support for Python 2
+  * Added
+    - Add a metadata hook for injecting VCS metadata
+    - Bump the minimum supported version of Hatchling
+
+-------------------------------------------------------------------

Old:
----
  hatch_vcs-0.2.1.tar.gz

New:
----
  hatch_vcs-0.3.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-hatch_vcs.spec ++++++
--- /var/tmp/diff_new_pack.FPyzT6/_old  2022-12-12 17:37:16.040443900 +0100
+++ /var/tmp/diff_new_pack.FPyzT6/_new  2022-12-12 17:37:16.044443920 +0100
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python3-%{**}}
 %define skip_python2 1
 Name:           python-hatch_vcs
-Version:        0.2.1
+Version:        0.3.0
 Release:        0
 Summary:        Hatch plugin for versioning with your preferred VCS
 License:        MIT

++++++ hatch_vcs-0.2.1.tar.gz -> hatch_vcs-0.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/.github/dependabot.yml 
new/hatch_vcs-0.3.0/.github/dependabot.yml
--- old/hatch_vcs-0.2.1/.github/dependabot.yml  1970-01-01 01:00:00.000000000 
+0100
+++ new/hatch_vcs-0.3.0/.github/dependabot.yml  2020-02-02 01:00:00.000000000 
+0100
@@ -0,0 +1,6 @@
+version: 2
+updates:
+- package-ecosystem: github-actions
+  directory: /
+  schedule:
+    interval: monthly
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/.github/workflows/build.yml 
new/hatch_vcs-0.3.0/.github/workflows/build.yml
--- old/hatch_vcs-0.2.1/.github/workflows/build.yml     2020-02-02 
01:00:00.000000000 +0100
+++ new/hatch_vcs-0.3.0/.github/workflows/build.yml     2020-02-02 
01:00:00.000000000 +0100
@@ -14,7 +14,7 @@
     runs-on: ubuntu-latest
 
     steps:
-    - uses: actions/checkout@v2
+    - uses: actions/checkout@v3
 
     - name: Install build dependencies
       run: python -m pip install --upgrade build
@@ -22,7 +22,7 @@
     - name: Build
       run: python -m build
 
-    - uses: actions/upload-artifact@v2
+    - uses: actions/upload-artifact@v3
       with:
         name: artifacts
         path: dist/*
@@ -35,13 +35,13 @@
     runs-on: ubuntu-latest
 
     steps:
-    - uses: actions/download-artifact@v2
+    - uses: actions/download-artifact@v3
       with:
         name: artifacts
         path: dist
 
     - name: Push build artifacts to PyPI
-      uses: pypa/gh-action-pypi-publish@v1.4.2
+      uses: pypa/gh-action-pypi-publish@v1.6.4
       with:
         skip_existing: true
         user: __token__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/.github/workflows/test.yml 
new/hatch_vcs-0.3.0/.github/workflows/test.yml
--- old/hatch_vcs-0.2.1/.github/workflows/test.yml      2020-02-02 
01:00:00.000000000 +0100
+++ new/hatch_vcs-0.3.0/.github/workflows/test.yml      2020-02-02 
01:00:00.000000000 +0100
@@ -27,10 +27,10 @@
         python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
 
     steps:
-    - uses: actions/checkout@v2
+    - uses: actions/checkout@v3
 
     - name: Set up Python ${{ matrix.python-version }}
-      uses: actions/setup-python@v2
+      uses: actions/setup-python@v4
       with:
         python-version: ${{ matrix.python-version }}
 
@@ -43,13 +43,3 @@
 
     - name: Run tests
       run: hatch run cov
-
-    - if: matrix.python-version == '3.9'
-      name: Set up Python 2.7
-      uses: actions/setup-python@v2
-      with:
-        python-version: '2.7'
-
-    - if: matrix.python-version == '3.9'
-      name: Run tests on Python 2.7
-      run: hatch run all.py2.7:test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/HISTORY.md 
new/hatch_vcs-0.3.0/HISTORY.md
--- old/hatch_vcs-0.2.1/HISTORY.md      2020-02-02 01:00:00.000000000 +0100
+++ new/hatch_vcs-0.3.0/HISTORY.md      2020-02-02 01:00:00.000000000 +0100
@@ -8,6 +8,17 @@
 
 ## Unreleased
 
+## 0.3.0 - 2022-12-10
+
+***Changed:***
+
+- Drop support for Python 2
+
+***Added:***
+
+- Add a metadata hook for injecting VCS metadata
+- Bump the minimum supported version of Hatchling
+
 ## 0.2.1 - 2022-12-06
 
 ***Fixed:***
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/PKG-INFO new/hatch_vcs-0.3.0/PKG-INFO
--- old/hatch_vcs-0.2.1/PKG-INFO        2020-02-02 01:00:00.000000000 +0100
+++ new/hatch_vcs-0.3.0/PKG-INFO        2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: hatch-vcs
-Version: 0.2.1
+Version: 0.3.0
 Summary: Hatch plugin for versioning with your preferred VCS
 Project-URL: Funding, https://github.com/sponsors/ofek
 Project-URL: History, https://github.com/ofek/hatch-vcs/blob/master/HISTORY.md
@@ -12,7 +12,6 @@
 Keywords: git,hatch,mercurial,plugin,scm,vcs,version
 Classifier: Development Status :: 4 - Beta
 Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.9
@@ -20,9 +19,9 @@
 Classifier: Programming Language :: Python :: 3.11
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
-Requires-Dist: hatchling>=0.21.0
-Requires-Dist: setuptools-scm<6; python_version < '3'
-Requires-Dist: setuptools-scm>=6.4.0; python_version > '3'
+Requires-Python: >=3.7
+Requires-Dist: hatchling>=1.1.0
+Requires-Dist: setuptools-scm>=6.4.0
 Description-Content-Type: text/markdown
 
 # hatch-vcs
@@ -46,6 +45,10 @@
 - [Build hook](#build-hook)
   - [Build hook options](#build-hook-options)
   - [Editable installs](#editable-installs)
+- [Metadata hook](#metadata-hook)
+  - [Metadata hook options](#metadata-hook-options)
+    - [URLs](#urls)
+  - [Example](#example)
 - [License](#license)
 
 ## Global dependency
@@ -60,7 +63,7 @@
 
 ## Version source
 
-The [version source 
plugin](https://hatch.pypa.io/latest/plugins/version-source/) name is `vcs`.
+The [version source 
plugin](https://hatch.pypa.io/latest/plugins/version-source/reference/) name is 
`vcs`.
 
 - ***pyproject.toml***
 
@@ -90,7 +93,7 @@
 
 ## Build hook
 
-The [build hook plugin](https://hatch.pypa.io/latest/plugins/build-hook/) name 
is `vcs`.
+The [build hook 
plugin](https://hatch.pypa.io/latest/plugins/build-hook/reference/) name is 
`vcs`.
 
 - ***pyproject.toml***
 
@@ -129,6 +132,50 @@
 
 The version file is only updated upon install or build. Thus the version 
number in an [editable 
install](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs)
 (Hatch's [dev mode](https://hatch.pypa.io/latest/config/build/#dev-mode)) will 
be incorrect if the version changes and the project is not rebuilt. An 
unsupported workaround for keeping the version number up-to-date can be found 
at 
[hatch-vcs-footgun-example](https://github.com/maresb/hatch-vcs-footgun-example).
 
+## Metadata hook
+
+**Note:** only Git is supported
+
+The [metadata hook 
plugin](https://hatch.pypa.io/latest/plugins/metadata-hook/reference/) name is 
`vcs`.
+
+- ***pyproject.toml***
+
+    ```toml
+    [tool.hatch.metadata.hooks.vcs]
+    ```
+
+- ***hatch.toml***
+
+    ```toml
+    [metadata.hooks.vcs]
+    ```
+
+### Metadata hook options
+
+#### URLs
+
+The `urls` option is equivalent to 
[`project.urls`](https://hatch.pypa.io/latest/config/metadata/#urls) except 
that each URL supports [context 
formatting](https://hatch.pypa.io/latest/config/context/) with the following 
fields:
+
+- `commit_hash` - the latest commit hash
+
+### Example
+
+- ***pyproject.toml***
+
+    ```toml
+    [tool.hatch.metadata.hooks.vcs]
+    Homepage = "https://www.example.com";
+    source_archive = "https://github.com/org/repo/archive/{commit_hash}.zip";
+    ```
+
+- ***hatch.toml***
+
+    ```toml
+    [metadata.hooks.vcs]
+    Homepage = "https://www.example.com";
+    source_archive = "https://github.com/org/repo/archive/{commit_hash}.zip";
+    ```
+
 ## License
 
 `hatch-vcs` is distributed under the terms of the 
[MIT](https://spdx.org/licenses/MIT.html) license.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/README.md 
new/hatch_vcs-0.3.0/README.md
--- old/hatch_vcs-0.2.1/README.md       2020-02-02 01:00:00.000000000 +0100
+++ new/hatch_vcs-0.3.0/README.md       2020-02-02 01:00:00.000000000 +0100
@@ -19,6 +19,10 @@
 - [Build hook](#build-hook)
   - [Build hook options](#build-hook-options)
   - [Editable installs](#editable-installs)
+- [Metadata hook](#metadata-hook)
+  - [Metadata hook options](#metadata-hook-options)
+    - [URLs](#urls)
+  - [Example](#example)
 - [License](#license)
 
 ## Global dependency
@@ -33,7 +37,7 @@
 
 ## Version source
 
-The [version source 
plugin](https://hatch.pypa.io/latest/plugins/version-source/) name is `vcs`.
+The [version source 
plugin](https://hatch.pypa.io/latest/plugins/version-source/reference/) name is 
`vcs`.
 
 - ***pyproject.toml***
 
@@ -63,7 +67,7 @@
 
 ## Build hook
 
-The [build hook plugin](https://hatch.pypa.io/latest/plugins/build-hook/) name 
is `vcs`.
+The [build hook 
plugin](https://hatch.pypa.io/latest/plugins/build-hook/reference/) name is 
`vcs`.
 
 - ***pyproject.toml***
 
@@ -102,6 +106,50 @@
 
 The version file is only updated upon install or build. Thus the version 
number in an [editable 
install](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs)
 (Hatch's [dev mode](https://hatch.pypa.io/latest/config/build/#dev-mode)) will 
be incorrect if the version changes and the project is not rebuilt. An 
unsupported workaround for keeping the version number up-to-date can be found 
at 
[hatch-vcs-footgun-example](https://github.com/maresb/hatch-vcs-footgun-example).
 
+## Metadata hook
+
+**Note:** only Git is supported
+
+The [metadata hook 
plugin](https://hatch.pypa.io/latest/plugins/metadata-hook/reference/) name is 
`vcs`.
+
+- ***pyproject.toml***
+
+    ```toml
+    [tool.hatch.metadata.hooks.vcs]
+    ```
+
+- ***hatch.toml***
+
+    ```toml
+    [metadata.hooks.vcs]
+    ```
+
+### Metadata hook options
+
+#### URLs
+
+The `urls` option is equivalent to 
[`project.urls`](https://hatch.pypa.io/latest/config/metadata/#urls) except 
that each URL supports [context 
formatting](https://hatch.pypa.io/latest/config/context/) with the following 
fields:
+
+- `commit_hash` - the latest commit hash
+
+### Example
+
+- ***pyproject.toml***
+
+    ```toml
+    [tool.hatch.metadata.hooks.vcs]
+    Homepage = "https://www.example.com";
+    source_archive = "https://github.com/org/repo/archive/{commit_hash}.zip";
+    ```
+
+- ***hatch.toml***
+
+    ```toml
+    [metadata.hooks.vcs]
+    Homepage = "https://www.example.com";
+    source_archive = "https://github.com/org/repo/archive/{commit_hash}.zip";
+    ```
+
 ## License
 
 `hatch-vcs` is distributed under the terms of the 
[MIT](https://spdx.org/licenses/MIT.html) license.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/hatch.toml 
new/hatch_vcs-0.3.0/hatch.toml
--- old/hatch_vcs-0.2.1/hatch.toml      2020-02-02 01:00:00.000000000 +0100
+++ new/hatch_vcs-0.3.0/hatch.toml      2020-02-02 01:00:00.000000000 +0100
@@ -15,13 +15,8 @@
   "cov-report",
 ]
 
-[envs.all.overrides]
-matrix.python.dev-mode = [
-  { value = false, if = ["2.7"] },
-]
-
 [[envs.all.matrix]]
-python = ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11"]
+python = ["3.7", "3.8", "3.9", "3.10", "3.11"]
 
 [envs.lint]
 detached = true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/hatch_vcs/__about__.py 
new/hatch_vcs-0.3.0/hatch_vcs/__about__.py
--- old/hatch_vcs-0.2.1/hatch_vcs/__about__.py  2020-02-02 01:00:00.000000000 
+0100
+++ new/hatch_vcs-0.3.0/hatch_vcs/__about__.py  2020-02-02 01:00:00.000000000 
+0100
@@ -1,4 +1,4 @@
 # SPDX-FileCopyrightText: 2022-present Ofek Lev <o...@ofek.dev>
 #
 # SPDX-License-Identifier: MIT
-__version__ = '0.2.1'
+__version__ = '0.3.0'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/hatch_vcs/build_hook.py 
new/hatch_vcs-0.3.0/hatch_vcs/build_hook.py
--- old/hatch_vcs-0.2.1/hatch_vcs/build_hook.py 2020-02-02 01:00:00.000000000 
+0100
+++ new/hatch_vcs-0.3.0/hatch_vcs/build_hook.py 2020-02-02 01:00:00.000000000 
+0100
@@ -8,7 +8,7 @@
     PLUGIN_NAME = 'vcs'
 
     def __init__(self, *args, **kwargs):
-        super(VCSBuildHook, self).__init__(*args, **kwargs)  # noqa: UP008
+        super().__init__(*args, **kwargs)
 
         self.__config_version_file = None
         self.__config_template = None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/hatch_vcs/hooks.py 
new/hatch_vcs-0.3.0/hatch_vcs/hooks.py
--- old/hatch_vcs-0.2.1/hatch_vcs/hooks.py      2020-02-02 01:00:00.000000000 
+0100
+++ new/hatch_vcs-0.3.0/hatch_vcs/hooks.py      2020-02-02 01:00:00.000000000 
+0100
@@ -4,6 +4,7 @@
 from hatchling.plugin import hookimpl
 
 from hatch_vcs.build_hook import VCSBuildHook
+from hatch_vcs.metadata_hook import VCSMetadataHook
 from hatch_vcs.version_source import VCSVersionSource
 
 
@@ -15,3 +16,8 @@
 @hookimpl
 def hatch_register_build_hook():
     return VCSBuildHook
+
+
+@hookimpl
+def hatch_register_metadata_hook():
+    return VCSMetadataHook
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/hatch_vcs/metadata_hook.py 
new/hatch_vcs-0.3.0/hatch_vcs/metadata_hook.py
--- old/hatch_vcs-0.2.1/hatch_vcs/metadata_hook.py      1970-01-01 
01:00:00.000000000 +0100
+++ new/hatch_vcs-0.3.0/hatch_vcs/metadata_hook.py      2020-02-02 
01:00:00.000000000 +0100
@@ -0,0 +1,47 @@
+# SPDX-FileCopyrightText: 2022-present Ofek Lev <o...@ofek.dev>
+#
+# SPDX-License-Identifier: MIT
+from collections import ChainMap
+
+from hatchling.metadata.plugin.interface import MetadataHookInterface
+from hatchling.utils.context import ContextStringFormatter
+
+from hatch_vcs import vcs_utils
+
+
+class VCSMetadataHook(MetadataHookInterface):
+    PLUGIN_NAME = 'vcs'
+
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args, **kwargs)
+
+        self.__config_urls = None
+
+    @property
+    def config_urls(self):
+        if self.__config_urls is None:
+            urls = self.config.get('urls', {})
+            if not isinstance(urls, dict):
+                raise TypeError('option `urls` must be a table')
+
+            for key, url in urls.items():
+                if not isinstance(url, str):
+                    raise TypeError(f'URL `{key}` in option `urls` must be a 
string')
+
+            self.__config_urls = urls
+
+        return self.__config_urls
+
+    def update(self, metadata):
+        formatter = ContextStringFormatter(
+            ChainMap(
+                {
+                    'commit_hash': lambda *args: 
vcs_utils.get_commit_hash(self.root),
+                },
+            )
+        )
+        urls = self.config_urls.copy()
+        for key, url in urls.items():
+            urls[key] = formatter.format(url)
+
+        metadata['urls'] = urls
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/hatch_vcs/vcs_utils.py 
new/hatch_vcs-0.3.0/hatch_vcs/vcs_utils.py
--- old/hatch_vcs-0.2.1/hatch_vcs/vcs_utils.py  1970-01-01 01:00:00.000000000 
+0100
+++ new/hatch_vcs-0.3.0/hatch_vcs/vcs_utils.py  2020-02-02 01:00:00.000000000 
+0100
@@ -0,0 +1,10 @@
+# SPDX-FileCopyrightText: 2022-present Ofek Lev <o...@ofek.dev>
+#
+# SPDX-License-Identifier: MIT
+import subprocess
+from functools import lru_cache
+
+
+@lru_cache(maxsize=None)
+def get_commit_hash(root: str):
+    return subprocess.check_output(['git', 'rev-parse', 'HEAD'], 
cwd=root).decode('utf-8').strip()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/hatch_vcs/version_source.py 
new/hatch_vcs-0.3.0/hatch_vcs/version_source.py
--- old/hatch_vcs-0.2.1/hatch_vcs/version_source.py     2020-02-02 
01:00:00.000000000 +0100
+++ new/hatch_vcs-0.3.0/hatch_vcs/version_source.py     2020-02-02 
01:00:00.000000000 +0100
@@ -8,7 +8,7 @@
     PLUGIN_NAME = 'vcs'
 
     def __init__(self, *args, **kwargs):
-        super(VCSVersionSource, self).__init__(*args, **kwargs)  # noqa: UP008
+        super().__init__(*args, **kwargs)
 
         self.__config_tag_pattern = None
         self.__config_fallback_version = None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/pyproject.toml 
new/hatch_vcs-0.3.0/pyproject.toml
--- old/hatch_vcs-0.2.1/pyproject.toml  2020-02-02 01:00:00.000000000 +0100
+++ new/hatch_vcs-0.3.0/pyproject.toml  2020-02-02 01:00:00.000000000 +0100
@@ -1,5 +1,5 @@
 [build-system]
-requires = ["hatchling>=0.21.0"]
+requires = ["hatchling>=1.1.0"]
 build-backend = "hatchling.build"
 
 [project]
@@ -8,6 +8,7 @@
 description = 'Hatch plugin for versioning with your preferred VCS'
 readme = "README.md"
 license = { text = "MIT" }
+requires-python = ">= 3.7"
 keywords = [
   "git",
   "hatch",
@@ -23,7 +24,6 @@
 classifiers = [
   "Development Status :: 4 - Beta",
   "Programming Language :: Python",
-  "Programming Language :: Python :: 2.7",
   "Programming Language :: Python :: 3.7",
   "Programming Language :: Python :: 3.8",
   "Programming Language :: Python :: 3.9",
@@ -33,9 +33,8 @@
   "Programming Language :: Python :: Implementation :: PyPy",
 ]
 dependencies = [
-  "hatchling>=0.21.0",
-  "setuptools-scm>=6.4.0; python_version > '3'",
-  "setuptools-scm<6; python_version < '3'",
+  "hatchling>=1.1.0",
+  "setuptools-scm>=6.4.0",
 ]
 
 [project.urls]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/tests/conftest.py 
new/hatch_vcs-0.3.0/tests/conftest.py
--- old/hatch_vcs-0.2.1/tests/conftest.py       2020-02-02 01:00:00.000000000 
+0100
+++ new/hatch_vcs-0.3.0/tests/conftest.py       2020-02-02 01:00:00.000000000 
+0100
@@ -33,7 +33,7 @@
 
 
 @contextmanager
-def create_project(directory, metadata, setup_vcs=True, nested=False):  # 
noqa: FBT002
+def create_project(directory, metadata, *, setup_vcs=True, nested=False):
     root_dir = project_dir = os.path.join(directory, 'my-app')
     os.mkdir(root_dir)
 
@@ -162,3 +162,27 @@
         nested=True,
     ) as project:
         yield project
+
+
+@pytest.fixture
+def new_project_metadata(temp_dir):
+    with create_project(
+        temp_dir,
+        """\
+[build-system]
+requires = ["hatchling", "hatch-vcs"]
+build-backend = "hatchling.build"
+
+[project]
+name = "my-app"
+dynamic = ["version", "urls"]
+
+[tool.hatch.version]
+source = "vcs"
+
+[tool.hatch.metadata.hooks.vcs.urls]
+Homepage = "https://www.google.com";
+foo = "https://github.com/bar/baz#{commit_hash}";
+""",
+    ) as project:
+        yield project
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/tests/test_build.py 
new/hatch_vcs-0.3.0/tests/test_build.py
--- old/hatch_vcs-0.2.1/tests/test_build.py     2020-02-02 01:00:00.000000000 
+0100
+++ new/hatch_vcs-0.3.0/tests/test_build.py     2020-02-02 01:00:00.000000000 
+0100
@@ -7,7 +7,7 @@
 
 import pytest
 
-from .utils import build_project, read_file
+from .utils import build_project, git, read_file
 
 
 def test_basic(new_project_basic):
@@ -140,3 +140,40 @@
     assert os.path.isfile(os.path.join(package_directory, 'foo.py'))
     assert os.path.isfile(os.path.join(package_directory, 'bar.py'))
     assert os.path.isfile(os.path.join(package_directory, 'baz.py'))
+
+
+def test_metadata(new_project_metadata):
+    build_project('-t', 'wheel')
+
+    build_dir = os.path.join(new_project_metadata, 'dist')
+    assert os.path.isdir(build_dir)
+
+    artifacts = os.listdir(build_dir)
+    assert len(artifacts) == 1
+    wheel_file = artifacts[0]
+
+    assert wheel_file == 'my_app-1.2.3-py2.py3-none-any.whl'
+
+    extraction_directory = os.path.join(os.path.dirname(new_project_metadata), 
'_archive')
+    os.mkdir(extraction_directory)
+
+    with zipfile.ZipFile(os.path.join(build_dir, wheel_file), 'r') as 
zip_archive:
+        zip_archive.extractall(extraction_directory)
+
+    metadata_directory = os.path.join(extraction_directory, 
'my_app-1.2.3.dist-info')
+    assert os.path.isdir(metadata_directory)
+
+    package_directory = os.path.join(extraction_directory, 'my_app')
+    assert os.path.isdir(package_directory)
+    assert len(os.listdir(package_directory)) == 4
+
+    assert os.path.isfile(os.path.join(package_directory, '__init__.py'))
+    assert os.path.isfile(os.path.join(package_directory, 'foo.py'))
+    assert os.path.isfile(os.path.join(package_directory, 'bar.py'))
+    assert os.path.isfile(os.path.join(package_directory, 'baz.py'))
+
+    metadata_file = os.path.join(metadata_directory, 'METADATA')
+    with open(metadata_file, encoding='utf-8') as f:
+        contents = f.read()
+
+        assert f'Project-URL: foo, 
https://github.com/bar/baz#{git("rev-parse", "HEAD")}' in contents
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/tests/test_metadata_config.py 
new/hatch_vcs-0.3.0/tests/test_metadata_config.py
--- old/hatch_vcs-0.2.1/tests/test_metadata_config.py   1970-01-01 
01:00:00.000000000 +0100
+++ new/hatch_vcs-0.3.0/tests/test_metadata_config.py   2020-02-02 
01:00:00.000000000 +0100
@@ -0,0 +1,34 @@
+# SPDX-FileCopyrightText: 2022-present Ofek Lev <o...@ofek.dev>
+#
+# SPDX-License-Identifier: MIT
+import pytest
+
+from hatch_vcs.metadata_hook import VCSMetadataHook
+
+
+class TestURLs:
+    def test_correct(self, new_project_basic):
+        config = {'urls': {'foo': 'url'}}
+        metadata_hook = VCSMetadataHook(new_project_basic, config)
+
+        assert metadata_hook.config_urls == {'foo': 'url'}
+
+    def test_not_table(self, new_project_basic):
+        config = {'urls': 9000}
+        metadata_hook = VCSMetadataHook(new_project_basic, config)
+
+        with pytest.raises(TypeError, match='option `urls` must be a table'):
+            _ = metadata_hook.config_urls
+
+    def test_url_not_string(self, new_project_basic):
+        config = {'urls': {'foo': 9000}}
+        metadata_hook = VCSMetadataHook(new_project_basic, config)
+
+        with pytest.raises(TypeError, match='URL `foo` in option `urls` must 
be a string'):
+            _ = metadata_hook.config_urls
+
+
+def test_coverage(new_project_basic):
+    metadata_hook = VCSMetadataHook(new_project_basic, {})
+
+    assert metadata_hook.config_urls is metadata_hook.config_urls
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatch_vcs-0.2.1/tests/utils.py 
new/hatch_vcs-0.3.0/tests/utils.py
--- old/hatch_vcs-0.2.1/tests/utils.py  2020-02-02 01:00:00.000000000 +0100
+++ new/hatch_vcs-0.3.0/tests/utils.py  2020-02-02 01:00:00.000000000 +0100
@@ -31,12 +31,15 @@
 
 
 def git(*args):
-    _run_command('git', *args)
+    return _run_command('git', *args)
 
 
 def _run_command(*command, **kwargs):
     process = subprocess.Popen(command, stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT, **kwargs)
     stdout, _ = process.communicate()
+    stdout = stdout.decode('utf-8')
 
     if process.returncode:  # no cov
-        raise Exception(stdout.decode('utf-8'))
+        raise Exception(stdout)
+
+    return stdout

Reply via email to