Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-hatchling for
openSUSE:Factory checked in at 2022-09-16 13:32:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-hatchling (Old)
and /work/SRC/openSUSE:Factory/.python-hatchling.new.2083 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-hatchling"
Fri Sep 16 13:32:02 2022 rev:8 rq:1003720 version:1.9.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-hatchling/python-hatchling.changes
2022-08-27 11:48:19.453615463 +0200
+++
/work/SRC/openSUSE:Factory/.python-hatchling.new.2083/python-hatchling.changes
2022-09-16 13:32:21.673272665 +0200
@@ -1,0 +2,25 @@
+Tue Sep 13 20:05:14 UTC 2022 - Beno??t Monin <[email protected]>
+
+- update to version 1.9.0:
+ * Changed:
+ + File pattern matching now more closely resembles Git's
+ behavior
+ * Added:
+ + Implement a minimal version of
+ prepare_metadata_for_build_wheel and
+ prepare_metadata_for_build_editable for non-frontend tools
+ that only need to inspect a project's metadata
+ + Add metadata command to view PEP 621 project metadata
+ + Improve error messages for SPDX license errors
+ + Retroactively support License-File for core metadata starting
+ at version 2.1
+ + Bump the minimum supported version of pathspec to 0.10.1
+ * Fixed:
+ + Allow the valid non-SPDX license values
+ LicenseRef-Public-Domain and LicenseRef-Proprietary
+ + Show the help text of the CLI when no subcommand is selected
+- requires python-base to set the minimum python version, -devel is
+ not needed
+- requires pathspec >= 0.10.1
+
+-------------------------------------------------------------------
Old:
----
hatchling-1.8.1.tar.gz
New:
----
hatchling-1.9.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-hatchling.spec ++++++
--- /var/tmp/diff_new_pack.JAfiJI/_old 2022-09-16 13:32:22.117274099 +0200
+++ /var/tmp/diff_new_pack.JAfiJI/_new 2022-09-16 13:32:22.121274112 +0200
@@ -19,17 +19,17 @@
%define skip_python2 1
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-hatchling
-Version: 1.8.1
+Version: 1.9.0
Release: 0
Summary: Build backend used by Hatch
License: MIT
URL: https://hatch.pypa.io/latest/
Source0:
https://files.pythonhosted.org/packages/source/h/hatchling/hatchling-%{version}.tar.gz
-BuildRequires: %{python_module devel >= 3.7}
+BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module editables >= 0.3}
BuildRequires: %{python_module importlib-metadata if %python-base < 3.8}
BuildRequires: %{python_module packaging >= 21.3}
-BuildRequires: %{python_module pathspec >= 0.9}
+BuildRequires: %{python_module pathspec >= 0.10.1}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pluggy >= 1.0.0}
BuildRequires: %{python_module tomli >= 1.2.2 if %python-base < 3.11}
@@ -37,7 +37,7 @@
BuildRequires: python-rpm-macros
Requires: python-editables >= 0.3
Requires: python-packaging >= 21.3
-Requires: python-pathspec >= 0.9
+Requires: python-pathspec >= 0.10.1
Requires: python-pluggy >= 1.0.0
Requires(post): update-alternatives
Requires(postun):update-alternatives
++++++ hatchling-1.8.1.tar.gz -> hatchling-1.9.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatchling-1.8.1/PKG-INFO new/hatchling-1.9.0/PKG-INFO
--- old/hatchling-1.8.1/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
+++ new/hatchling-1.9.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: hatchling
-Version: 1.8.1
+Version: 1.9.0
Summary: Modern, extensible Python build backend
Project-URL: Homepage, https://hatch.pypa.io/latest/
Project-URL: Sponsor, https://github.com/sponsors/ofek
@@ -8,6 +8,7 @@
Project-URL: Tracker, https://github.com/pypa/hatch/issues
Project-URL: Source, https://github.com/pypa/hatch/tree/master/backend
Author-email: Ofek Lev <[email protected]>
+License-File: LICENSE.txt
Keywords: build,hatch,packaging
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
@@ -27,7 +28,7 @@
Requires-Dist: editables>=0.3
Requires-Dist: importlib-metadata; python_version < '3.8'
Requires-Dist: packaging>=21.3
-Requires-Dist: pathspec>=0.9
+Requires-Dist: pathspec>=0.10.1
Requires-Dist: pluggy>=1.0.0
Requires-Dist: tomli>=1.2.2; python_version < '3.11'
Description-Content-Type: text/markdown
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatchling-1.8.1/src/hatchling/__about__.py
new/hatchling-1.9.0/src/hatchling/__about__.py
--- old/hatchling-1.8.1/src/hatchling/__about__.py 2020-02-02
01:00:00.000000000 +0100
+++ new/hatchling-1.9.0/src/hatchling/__about__.py 2020-02-02
01:00:00.000000000 +0100
@@ -1 +1 @@
-__version__ = '1.8.1'
+__version__ = '1.9.0'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatchling-1.8.1/src/hatchling/build.py
new/hatchling-1.9.0/src/hatchling/build.py
--- old/hatchling-1.8.1/src/hatchling/build.py 2020-02-02 01:00:00.000000000
+0100
+++ new/hatchling-1.9.0/src/hatchling/build.py 2020-02-02 01:00:00.000000000
+0100
@@ -31,6 +31,24 @@
return builder.config.dependencies
+def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None):
+ """
+ https://peps.python.org/pep-0517/#prepare-metadata-for-build-wheel
+ """
+ from hatchling.builders.wheel import WheelBuilder
+
+ builder = WheelBuilder(os.getcwd())
+
+ directory = os.path.join(metadata_directory,
f'{builder.artifact_project_id}.dist-info')
+ if not os.path.isdir(directory):
+ os.mkdir(directory)
+
+ with open(os.path.join(directory, 'METADATA'), 'w', encoding='utf-8') as f:
+ f.write(builder.config.core_metadata_constructor(builder.metadata))
+
+ return os.path.basename(directory)
+
+
def build_wheel(wheel_directory, config_settings=None,
metadata_directory=None):
"""
https://peps.python.org/pep-0517/#build-wheel
@@ -51,6 +69,28 @@
return builder.config.dependencies
+def prepare_metadata_for_build_editable(metadata_directory,
config_settings=None):
+ """
+ https://peps.python.org/pep-0660/#prepare-metadata-for-build-editable
+ """
+ from hatchling.builders.wheel import EDITABLES_MINIMUM_VERSION,
WheelBuilder
+
+ builder = WheelBuilder(os.getcwd())
+
+ directory = os.path.join(metadata_directory,
f'{builder.artifact_project_id}.dist-info')
+ if not os.path.isdir(directory):
+ os.mkdir(directory)
+
+ extra_dependencies = []
+ if not builder.config.dev_mode_dirs and builder.config.dev_mode_exact:
+ extra_dependencies.append(f'editables~={EDITABLES_MINIMUM_VERSION}')
+
+ with open(os.path.join(directory, 'METADATA'), 'w', encoding='utf-8') as f:
+ f.write(builder.config.core_metadata_constructor(builder.metadata,
extra_dependencies=extra_dependencies))
+
+ return os.path.basename(directory)
+
+
def build_editable(wheel_directory, config_settings=None,
metadata_directory=None):
"""
https://peps.python.org/pep-0660/#build-editable
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatchling-1.8.1/src/hatchling/builders/config.py
new/hatchling-1.9.0/src/hatchling/builders/config.py
--- old/hatchling-1.8.1/src/hatchling/builders/config.py 2020-02-02
01:00:00.000000000 +0100
+++ new/hatchling-1.9.0/src/hatchling/builders/config.py 2020-02-02
01:00:00.000000000 +0100
@@ -25,7 +25,7 @@
self.__force_include = None
self.__vcs_exclusion_files = None
- # Possible pathspec.PathSpec
+ # Possible pathspec.GitIgnoreSpec
self.__include_spec = None
self.__exclude_spec = None
self.__artifact_spec = None
@@ -151,9 +151,7 @@
all_include_patterns.append(f"/{relative_path.replace(os.sep,
'/')}/")
if all_include_patterns:
- self.__include_spec = pathspec.PathSpec.from_lines(
- pathspec.patterns.GitWildMatchPattern, all_include_patterns
- )
+ self.__include_spec =
pathspec.GitIgnoreSpec.from_lines(all_include_patterns)
self.__include_patterns = all_include_patterns
@@ -187,9 +185,7 @@
all_exclude_patterns.extend(self.load_vcs_exclusion_patterns())
if all_exclude_patterns:
- self.__exclude_spec = pathspec.PathSpec.from_lines(
- pathspec.patterns.GitWildMatchPattern, all_exclude_patterns
- )
+ self.__exclude_spec =
pathspec.GitIgnoreSpec.from_lines(all_exclude_patterns)
self.__exclude_patterns = all_exclude_patterns
@@ -220,9 +216,7 @@
all_artifact_patterns.append(artifact_pattern)
if all_artifact_patterns:
- self.__artifact_spec = pathspec.PathSpec.from_lines(
- pathspec.patterns.GitWildMatchPattern,
all_artifact_patterns
- )
+ self.__artifact_spec =
pathspec.GitIgnoreSpec.from_lines(all_artifact_patterns)
self.__artifact_patterns = all_artifact_patterns
@@ -808,9 +802,7 @@
# Include anything the hooks indicate
build_artifacts = build_data['artifacts']
if build_artifacts:
- self.build_artifact_spec = pathspec.PathSpec.from_lines(
- pathspec.patterns.GitWildMatchPattern, build_artifacts
- )
+ self.build_artifact_spec =
pathspec.GitIgnoreSpec.from_lines(build_artifacts)
self.build_force_include.update(normalize_inclusion_map(build_data['force_include'],
self.root))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatchling-1.8.1/src/hatchling/builders/wheel.py
new/hatchling-1.9.0/src/hatchling/builders/wheel.py
--- old/hatchling-1.8.1/src/hatchling/builders/wheel.py 2020-02-02
01:00:00.000000000 +0100
+++ new/hatchling-1.9.0/src/hatchling/builders/wheel.py 2020-02-02
01:00:00.000000000 +0100
@@ -21,11 +21,6 @@
)
from hatchling.metadata.spec import DEFAULT_METADATA_VERSION,
get_core_metadata_constructors
-try:
- from editables import EditableProject
-except ImportError: # no cov
- EditableProject = None
-
EDITABLES_MINIMUM_VERSION = '0.3'
@@ -335,6 +330,8 @@
return self.build_editable_detection(directory, **build_data)
def build_editable_detection(self, directory, **build_data):
+ from editables import EditableProject
+
build_data['tag'] = self.get_default_tag()
with WheelArchive(self.artifact_project_id, self.config.reproducible)
as archive, closing(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatchling-1.8.1/src/hatchling/cli/__init__.py
new/hatchling-1.9.0/src/hatchling/cli/__init__.py
--- old/hatchling-1.8.1/src/hatchling/cli/__init__.py 2020-02-02
01:00:00.000000000 +0100
+++ new/hatchling-1.9.0/src/hatchling/cli/__init__.py 2020-02-02
01:00:00.000000000 +0100
@@ -2,19 +2,25 @@
from hatchling.cli.build import build_command
from hatchling.cli.dep import dep_command
+from hatchling.cli.metadata import metadata_command
from hatchling.cli.version import version_command
def hatchling():
parser = argparse.ArgumentParser(prog='hatchling', allow_abbrev=False)
- subparsers = parser.add_subparsers(required=True)
+ subparsers = parser.add_subparsers()
defaults = {'metavar': ''}
build_command(subparsers, defaults)
dep_command(subparsers, defaults)
+ metadata_command(subparsers, defaults)
version_command(subparsers, defaults)
kwargs = vars(parser.parse_args())
- command = kwargs.pop('func')
- command(**kwargs)
+ try:
+ command = kwargs.pop('func')
+ except KeyError:
+ parser.print_help()
+ else:
+ command(**kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/hatchling-1.8.1/src/hatchling/cli/metadata/__init__.py
new/hatchling-1.9.0/src/hatchling/cli/metadata/__init__.py
--- old/hatchling-1.8.1/src/hatchling/cli/metadata/__init__.py 1970-01-01
01:00:00.000000000 +0100
+++ new/hatchling-1.9.0/src/hatchling/cli/metadata/__init__.py 2020-02-02
01:00:00.000000000 +0100
@@ -0,0 +1,47 @@
+import argparse
+
+
+def metadata_impl(called_by_app, field, compact):
+ import json
+ import os
+
+ from hatchling.bridge.app import get_application
+ from hatchling.metadata.core import ProjectMetadata
+ from hatchling.metadata.utils import resolve_metadata_fields
+ from hatchling.plugin.manager import PluginManager
+
+ app = get_application(called_by_app)
+
+ root = os.getcwd()
+ plugin_manager = PluginManager()
+ project_metadata = ProjectMetadata(root, plugin_manager)
+
+ metadata = resolve_metadata_fields(project_metadata)
+ if field: # no cov
+ if field not in metadata:
+ app.abort(f'Unknown metadata field: {field}')
+ elif field == 'readme':
+ app.display_info(metadata[field]['text'])
+ elif isinstance(metadata[field], str):
+ app.display_info(metadata[field])
+ else:
+ app.display_info(json.dumps(metadata[field], indent=4))
+
+ return
+
+ for key, value in list(metadata.items()):
+ if not value:
+ metadata.pop(key)
+
+ if compact:
+ app.display_info(json.dumps(metadata, separators=(',', ':')))
+ else: # no cov
+ app.display_info(json.dumps(metadata, indent=4))
+
+
+def metadata_command(subparsers, defaults):
+ parser = subparsers.add_parser('metadata')
+ parser.add_argument('field', nargs='?')
+ parser.add_argument('-c', '--compact', action='store_true')
+ parser.add_argument('--app', dest='called_by_app', action='store_true',
help=argparse.SUPPRESS)
+ parser.set_defaults(func=metadata_impl)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatchling-1.8.1/src/hatchling/dep/core.py
new/hatchling-1.9.0/src/hatchling/dep/core.py
--- old/hatchling-1.8.1/src/hatchling/dep/core.py 2020-02-02
01:00:00.000000000 +0100
+++ new/hatchling-1.9.0/src/hatchling/dep/core.py 2020-02-02
01:00:00.000000000 +0100
@@ -4,10 +4,10 @@
from packaging.markers import default_environment
from packaging.requirements import Requirement
-try:
+if sys.version_info >= (3, 8):
from importlib.metadata import Distribution, DistributionFinder
-except ImportError: # no cov
- from importlib_metadata import Distribution, DistributionFinder # type:
ignore
+else:
+ from importlib_metadata import Distribution, DistributionFinder
class DistributionCache:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatchling-1.8.1/src/hatchling/licenses/parse.py
new/hatchling-1.9.0/src/hatchling/licenses/parse.py
--- old/hatchling-1.8.1/src/hatchling/licenses/parse.py 2020-02-02
01:00:00.000000000 +0100
+++ new/hatchling-1.9.0/src/hatchling/licenses/parse.py 2020-02-02
01:00:00.000000000 +0100
@@ -1,13 +1,28 @@
from hatchling.licenses.supported import EXCEPTIONS, LICENSES
-def normalize_license_expression(license_expression):
- if not license_expression:
- return license_expression
+def get_valid_licenses():
+ valid_licenses = LICENSES.copy()
+
+ #
https://peps.python.org/pep-0639/#should-custom-license-identifiers-be-allowed
+ public_license = 'LicenseRef-Public-Domain'
+ valid_licenses[public_license.lower()] = {'id': public_license,
'deprecated': False}
+
+ proprietary_license = 'LicenseRef-Proprietary'
+ valid_licenses[proprietary_license.lower()] = {'id': proprietary_license,
'deprecated': False}
+
+ return valid_licenses
+
+
+def normalize_license_expression(raw_license_expression):
+ if not raw_license_expression:
+ return raw_license_expression
+
+ valid_licenses = get_valid_licenses()
# First normalize to lower case so we can look up licenses/exceptions
# and so boolean operators are Python-compatible
- license_expression = license_expression.lower()
+ license_expression = raw_license_expression.lower()
# Then pad parentheses so tokenization can be achieved by merely splitting
on white space
license_expression = license_expression.replace('(', ' ( ').replace(')', '
) ')
@@ -25,7 +40,7 @@
elif token == 'with':
python_tokens.append('or')
elif token == '(' and python_tokens and python_tokens[-1] not in
('or', 'and'):
- raise ValueError('Invalid license expression')
+ raise ValueError(f'invalid license expression:
{raw_license_expression}')
else:
python_tokens.append(token)
@@ -33,7 +48,7 @@
try:
assert eval(python_expression) is False
except Exception:
- raise ValueError('Invalid license expression')
+ raise ValueError(f'invalid license expression:
{raw_license_expression}') from None
# Take a final pass to check for unknown licenses/exceptions
normalized_tokens = []
@@ -44,7 +59,8 @@
if normalized_tokens and normalized_tokens[-1] == 'WITH':
if token not in EXCEPTIONS:
- raise ValueError(f'Unknown license exception: {token}')
+ raise ValueError(f'unknown license exception: {token}')
+
normalized_tokens.append(EXCEPTIONS[token]['id'])
else:
if token.endswith('+'):
@@ -53,10 +69,10 @@
else:
suffix = ''
- if token not in LICENSES:
- raise ValueError(f'Unknown license: {token}')
+ if token not in valid_licenses:
+ raise ValueError(f'unknown license: {token}')
- normalized_tokens.append(LICENSES[token]['id'] + suffix)
+ normalized_tokens.append(valid_licenses[token]['id'] + suffix)
# Construct the normalized expression
normalized_expression = ' '.join(normalized_tokens)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatchling-1.8.1/src/hatchling/metadata/core.py
new/hatchling-1.9.0/src/hatchling/metadata/core.py
--- old/hatchling-1.8.1/src/hatchling/metadata/core.py 2020-02-02
01:00:00.000000000 +0100
+++ new/hatchling-1.9.0/src/hatchling/metadata/core.py 2020-02-02
01:00:00.000000000 +0100
@@ -1,14 +1,15 @@
import os
+import sys
from copy import deepcopy
from hatchling.metadata.utils import get_normalized_dependency,
is_valid_project_name, normalize_project_name
from hatchling.utils.constants import DEFAULT_CONFIG_FILE
from hatchling.utils.fs import locate_file
-try:
+if sys.version_info >= (3, 11):
import tomllib
-except ImportError:
- import tomli as tomllib # type: ignore
+else:
+ import tomli as tomllib
def load_toml(path):
@@ -26,6 +27,8 @@
self._core = None
self._hatch = None
+ self._core_raw_metadata = None
+ self._name = None
self._version = None
self._project_file = None
@@ -47,6 +50,33 @@
return self._context
@property
+ def core_raw_metadata(self):
+ if self._core_raw_metadata is None:
+ if 'project' not in self.config:
+ raise ValueError('Missing `project` metadata table in
configuration')
+
+ core_raw_metadata = self.config['project']
+ if not isinstance(core_raw_metadata, dict):
+ raise TypeError('The `project` configuration must be a table')
+
+ self._core_raw_metadata = core_raw_metadata
+
+ return self._core_raw_metadata
+
+ @property
+ def name(self):
+ # Duplicate the name parsing here for situations where it's
+ # needed but metadata plugins might not be available
+ if self._name is None:
+ name = self.core_raw_metadata.get('name', '')
+ if not name:
+ raise ValueError('Missing required field `project.name`')
+
+ self._name = normalize_project_name(name)
+
+ return self._name
+
+ @property
def version(self):
"""
https://peps.python.org/pep-0621/#version
@@ -82,27 +112,20 @@
@property
def core(self):
if self._core is None:
- if 'project' not in self.config:
- raise ValueError('Missing `project` metadata table in
configuration')
-
- core_metadata = self.config['project']
- if not isinstance(core_metadata, dict):
- raise TypeError('The `project` configuration must be a table')
-
- metadata = CoreMetadata(self.root, core_metadata,
self.hatch.metadata, self.context)
+ metadata = CoreMetadata(self.root, self.core_raw_metadata,
self.hatch.metadata, self.context)
metadata_hooks = self.hatch.metadata.hooks
if metadata_hooks:
- static_fields = set(core_metadata)
+ static_fields = set(self.core_raw_metadata)
if 'version' in self.hatch.config:
self._set_version(metadata)
- core_metadata['version'] = self.version
+ self.core_raw_metadata['version'] = self.version
for metadata_hook in metadata_hooks.values():
- metadata_hook.update(core_metadata)
+ metadata_hook.update(self.core_raw_metadata)
metadata.add_known_classifiers(metadata_hook.get_known_classifiers())
- new_fields = set(core_metadata) - static_fields
+ new_fields = set(self.core_raw_metadata) - static_fields
for new_field in new_fields:
if new_field in metadata.dynamic:
metadata.dynamic.remove(new_field)
@@ -537,7 +560,11 @@
elif isinstance(data, str):
from hatchling.licenses.parse import
normalize_license_expression
- self._license_expression = normalize_license_expression(data)
+ try:
+ self._license_expression =
normalize_license_expression(data)
+ except ValueError as e:
+ raise ValueError(f'Error parsing field `project.license` -
{e}') from None
+
self._license = ''
elif isinstance(data, dict):
if 'file' in data and 'text' in data:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatchling-1.8.1/src/hatchling/metadata/spec.py
new/hatchling-1.9.0/src/hatchling/metadata/spec.py
--- old/hatchling-1.8.1/src/hatchling/metadata/spec.py 2020-02-02
01:00:00.000000000 +0100
+++ new/hatchling-1.9.0/src/hatchling/metadata/spec.py 2020-02-02
01:00:00.000000000 +0100
@@ -110,6 +110,10 @@
else:
metadata_file += f'{indent}{line}\n'
+ if metadata.core.license_files:
+ for license_file in metadata.core.license_files:
+ metadata_file += f'License-File: {license_file}\n'
+
if metadata.core.keywords:
metadata_file += f"Keywords: {','.join(metadata.core.keywords)}\n"
@@ -182,6 +186,10 @@
else:
metadata_file += f'{indent}{line}\n'
+ if metadata.core.license_files:
+ for license_file in metadata.core.license_files:
+ metadata_file += f'License-File: {license_file}\n'
+
if metadata.core.keywords:
metadata_file += f"Keywords: {','.join(metadata.core.keywords)}\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatchling-1.8.1/src/hatchling/metadata/utils.py
new/hatchling-1.9.0/src/hatchling/metadata/utils.py
--- old/hatchling-1.8.1/src/hatchling/metadata/utils.py 2020-02-02
01:00:00.000000000 +0100
+++ new/hatchling-1.9.0/src/hatchling/metadata/utils.py 2020-02-02
01:00:00.000000000 +0100
@@ -27,3 +27,25 @@
# All TOML writers use double quotes, so allow direct writing or
copy/pasting to avoid escaping
return str(requirement).replace('"', "'")
+
+
+def resolve_metadata_fields(metadata):
+ #
https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
+ return {
+ 'name': metadata.core.name,
+ 'version': metadata.version,
+ 'description': metadata.core.description,
+ 'readme': {'content-type': metadata.core.readme_content_type, 'text':
metadata.core.readme},
+ 'requires-python': metadata.core.requires_python,
+ 'license': metadata.core.license_expression or metadata.core.license,
+ 'authors': metadata.core.authors,
+ 'maintainers': metadata.core.maintainers,
+ 'keywords': metadata.core.keywords,
+ 'classifiers': metadata.core.classifiers,
+ 'urls': metadata.core.urls,
+ 'scripts': metadata.core.scripts,
+ 'gui-scripts': metadata.core.gui_scripts,
+ 'entry-points': metadata.core.entry_points,
+ 'dependencies': metadata.core.dependencies,
+ 'optional-dependencies': metadata.core.optional_dependencies,
+ }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatchling-1.8.1/src/hatchling/ouroboros.py
new/hatchling-1.9.0/src/hatchling/ouroboros.py
--- old/hatchling-1.8.1/src/hatchling/ouroboros.py 2020-02-02
01:00:00.000000000 +0100
+++ new/hatchling-1.9.0/src/hatchling/ouroboros.py 2020-02-02
01:00:00.000000000 +0100
@@ -36,7 +36,7 @@
'editables>=0.3',
'importlib-metadata; python_version < "3.8"',
'packaging>=21.3',
- 'pathspec>=0.9',
+ 'pathspec>=0.10.1',
'pluggy>=1.0.0',
'tomli>=1.2.2; python_version < "3.11"',
],
@@ -95,8 +95,48 @@
return CONFIG['project']['dependencies']
+def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None):
+ """
+ https://peps.python.org/pep-0517/#prepare-metadata-for-build-wheel
+ """
+ from hatchling.builders.wheel import WheelBuilder
+
+ builder = WheelBuilder(os.getcwd(), config=CONFIG)
+
+ directory = os.path.join(metadata_directory,
f'{builder.artifact_project_id}.dist-info')
+ if not os.path.isdir(directory):
+ os.mkdir(directory)
+
+ with open(os.path.join(directory, 'METADATA'), 'w', encoding='utf-8') as f:
+ f.write(builder.config.core_metadata_constructor(builder.metadata))
+
+ return os.path.basename(directory)
+
+
def get_requires_for_build_editable(config_settings=None):
"""
https://peps.python.org/pep-0660/#get-requires-for-build-editable
"""
return CONFIG['project']['dependencies']
+
+
+def prepare_metadata_for_build_editable(metadata_directory,
config_settings=None):
+ """
+ https://peps.python.org/pep-0660/#prepare-metadata-for-build-editable
+ """
+ from hatchling.builders.wheel import EDITABLES_MINIMUM_VERSION,
WheelBuilder
+
+ builder = WheelBuilder(os.getcwd(), config=CONFIG)
+
+ directory = os.path.join(metadata_directory,
f'{builder.artifact_project_id}.dist-info')
+ if not os.path.isdir(directory):
+ os.mkdir(directory)
+
+ extra_dependencies = []
+ if not builder.config.dev_mode_dirs and builder.config.dev_mode_exact:
+ extra_dependencies.append(f'editables~={EDITABLES_MINIMUM_VERSION}')
+
+ with open(os.path.join(directory, 'METADATA'), 'w', encoding='utf-8') as f:
+ f.write(builder.config.core_metadata_constructor(builder.metadata,
extra_dependencies=extra_dependencies))
+
+ return os.path.basename(directory)