Sync from SUSE:SLFO:Main python-hatch revision 1192a06618af1727d0dfa57ce235900e

This commit is contained in:
Adrian Schröter 2024-09-13 16:19:51 +02:00
parent aac44d7dcf
commit 790bfb7e7c
8 changed files with 295 additions and 203 deletions

View File

@ -1,30 +0,0 @@
From 4ddbf0a9a720caed18d19c083ff88427c9d2a993 Mon Sep 17 00:00:00 2001
From: Maximilian Hils <github@maximilianhils.com>
Date: Thu, 24 Aug 2023 05:30:00 +0200
Subject: [PATCH] Fix CI (#940)
fix unrelated ci issue
---
tests/cli/config/test_set.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/tests/cli/config/test_set.py b/tests/cli/config/test_set.py
index 73bb9bc03..cd576feb4 100644
--- a/tests/cli/config/test_set.py
+++ b/tests/cli/config/test_set.py
@@ -184,7 +184,6 @@ def test_project_location_basic_set_first_project(hatch, config_file, helpers, t
f"""
New setting:
project = "foo"
-
[projects]
foo = "{path}"
"""
@@ -206,7 +205,6 @@ def test_project_location_complex_set_first_project(hatch, config_file, helpers,
f"""
New setting:
project = "foo"
-
[projects.foo]
location = "{path}"
"""

View File

@ -1,40 +0,0 @@
Index: hatch-hatch-v1.7.0/backend/src/hatchling/builders/sdist.py
===================================================================
--- hatch-hatch-v1.7.0.orig/backend/src/hatchling/builders/sdist.py
+++ hatch-hatch-v1.7.0/backend/src/hatchling/builders/sdist.py
@@ -161,7 +161,7 @@ class SdistBuilder(BuilderInterface):
def build_standard(self, directory: str, **build_data: Any) -> str:
found_packages = set()
- with SdistArchive(self.project_id, reproducible=self.config.reproducible) as archive:
+ with SdistArchive(self.artifact_project_id, reproducible=self.config.reproducible) as archive:
for included_file in self.recurse_included_files():
if self.config.support_legacy:
possible_package, file_name = os.path.split(included_file.relative_path)
@@ -170,7 +170,9 @@ class SdistBuilder(BuilderInterface):
tar_info = archive.gettarinfo(
included_file.path,
- arcname=normalize_archive_path(os.path.join(self.project_id, included_file.distribution_path)),
+ arcname=normalize_archive_path(
+ os.path.join(self.artifact_project_id, included_file.distribution_path)
+ ),
)
if tar_info.isfile():
Index: hatch-hatch-v1.7.0/tests/backend/builders/test_sdist.py
===================================================================
--- hatch-hatch-v1.7.0.orig/tests/backend/builders/test_sdist.py
+++ hatch-hatch-v1.7.0/tests/backend/builders/test_sdist.py
@@ -1516,9 +1516,9 @@ class TestBuildStandard:
tar_archive.extractall(str(extraction_directory))
expected_files = helpers.get_template_files(
- 'sdist.standard_default', project_name, relative_root=builder.project_id
+ 'sdist.standard_default', project_name, relative_root=builder.artifact_project_id
)
helpers.assert_files(extraction_directory, expected_files)
- stat = os.stat(str(extraction_directory / builder.project_id / 'PKG-INFO'))
+ stat = os.stat(str(extraction_directory / builder.artifact_project_id / 'PKG-INFO'))
assert stat.st_mtime == get_reproducible_timestamp()

18
fix-tests.patch Normal file
View File

@ -0,0 +1,18 @@
Index: hatch-hatch-v1.12.0/tests/conftest.py
===================================================================
--- hatch-hatch-v1.12.0.orig/tests/conftest.py
+++ hatch-hatch-v1.12.0/tests/conftest.py
@@ -95,11 +95,12 @@ def isolation(uv_on_path) -> Generator[P
'GIT_AUTHOR_EMAIL': 'foo@bar.baz',
'COLUMNS': '80',
'LINES': '24',
+ 'HATCH_ENV_TYPE_VIRTUAL_UV_PATH': '',
}
if PLATFORM.windows:
default_env_vars['COMSPEC'] = 'cmd.exe'
else:
- default_env_vars['SHELL'] = 'sh'
+ default_env_vars['SHELL'] = 'bash'
with d.as_cwd(default_env_vars):
os.environ.pop(AppEnvVars.ENV_ACTIVE, None)

View File

@ -1,111 +0,0 @@
From d07463ea6afcecd83fd55bdac975516de6f3bc10 Mon Sep 17 00:00:00 2001
From: Ryan Morshead <ryan.morshead@gmail.com>
Date: Mon, 17 Apr 2023 22:02:59 -0700
Subject: [PATCH 1/3] Name .pth file so it loads first
Users adding their own .pth files likely need to be loaded after the one inserted by hatchling. The only way to do this is by naming it so the hatchling .pth file comes first alphabetically.
---
backend/src/hatchling/builders/wheel.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: hatch-hatch-v1.7.0/backend/src/hatchling/builders/wheel.py
===================================================================
--- hatch-hatch-v1.7.0.orig/backend/src/hatchling/builders/wheel.py
+++ hatch-hatch-v1.7.0/backend/src/hatchling/builders/wheel.py
@@ -438,6 +438,9 @@ class WheelBuilder(BuilderInterface):
editable_project.add_to_path(os.path.dirname(relative_path))
for filename, content in sorted(editable_project.files()):
+ if filename.endswith('.pth') and not filename.startswith('_'):
+ filename = f'_{filename}'
+
record = archive.write_file(filename, content)
records.write(record)
@@ -475,7 +478,7 @@ class WheelBuilder(BuilderInterface):
for relative_directory in self.config.dev_mode_dirs
)
- record = archive.write_file(f"{self.metadata.core.name.replace('-', '_')}.pth", '\n'.join(directories))
+ record = archive.write_file(f"_{self.metadata.core.name.replace('-', '_')}.pth", '\n'.join(directories))
records.write(record)
for included_file in self.recurse_forced_files(self.get_forced_inclusion_map(build_data)):
Index: hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_exact.py
===================================================================
--- hatch-hatch-v1.7.0.orig/tests/helpers/templates/wheel/standard_editable_exact.py
+++ hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_exact.py
@@ -16,7 +16,7 @@ def get_files(**kwargs):
if str(f.path) == 'LICENSE.txt':
files.append(File(Path(metadata_directory, 'licenses', f.path), f.contents))
- pth_file_name = f"{kwargs['package_name']}.pth"
+ pth_file_name = f"_{kwargs['package_name']}.pth"
loader_file_name = f"_editable_impl_{kwargs['package_name']}.py"
files.append(File(Path(pth_file_name), f"import _editable_impl_{kwargs['package_name']}"))
files.append(
Index: hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_exact_extra_dependencies.py
===================================================================
--- hatch-hatch-v1.7.0.orig/tests/helpers/templates/wheel/standard_editable_exact_extra_dependencies.py
+++ hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_exact_extra_dependencies.py
@@ -16,7 +16,7 @@ def get_files(**kwargs):
if str(f.path) == 'LICENSE.txt':
files.append(File(Path(metadata_directory, 'licenses', f.path), f.contents))
- pth_file_name = f"{kwargs['package_name']}.pth"
+ pth_file_name = f"_{kwargs['package_name']}.pth"
loader_file_name = f"_editable_impl_{kwargs['package_name']}.py"
files.append(File(Path(pth_file_name), f"import _editable_impl_{kwargs['package_name']}"))
files.append(
Index: hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_exact_force_include.py
===================================================================
--- hatch-hatch-v1.7.0.orig/tests/helpers/templates/wheel/standard_editable_exact_force_include.py
+++ hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_exact_force_include.py
@@ -18,7 +18,7 @@ def get_files(**kwargs):
elif f.path.parts[-1] == '__about__.py':
files.append(File(Path('zfoo.py'), f.contents))
- pth_file_name = f"{kwargs['package_name']}.pth"
+ pth_file_name = f"_{kwargs['package_name']}.pth"
loader_file_name = f"_editable_impl_{kwargs['package_name']}.py"
files.append(File(Path(pth_file_name), f"import _editable_impl_{kwargs['package_name']}"))
files.append(
Index: hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_pth.py
===================================================================
--- hatch-hatch-v1.7.0.orig/tests/helpers/templates/wheel/standard_editable_pth.py
+++ hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_pth.py
@@ -16,7 +16,7 @@ def get_files(**kwargs):
if str(f.path) == 'LICENSE.txt':
files.append(File(Path(metadata_directory, 'licenses', f.path), f.contents))
- pth_file_name = f"{kwargs['package_name']}.pth"
+ pth_file_name = f"_{kwargs['package_name']}.pth"
files.append(File(Path(pth_file_name), '\n'.join(package_paths)))
files.append(
File(
Index: hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_pth_extra_dependencies.py
===================================================================
--- hatch-hatch-v1.7.0.orig/tests/helpers/templates/wheel/standard_editable_pth_extra_dependencies.py
+++ hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_pth_extra_dependencies.py
@@ -16,7 +16,7 @@ def get_files(**kwargs):
if str(f.path) == 'LICENSE.txt':
files.append(File(Path(metadata_directory, 'licenses', f.path), f.contents))
- pth_file_name = f"{kwargs['package_name']}.pth"
+ pth_file_name = f"_{kwargs['package_name']}.pth"
files.append(File(Path(pth_file_name), '\n'.join(package_paths)))
files.append(
File(
Index: hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_pth_force_include.py
===================================================================
--- hatch-hatch-v1.7.0.orig/tests/helpers/templates/wheel/standard_editable_pth_force_include.py
+++ hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_pth_force_include.py
@@ -18,7 +18,7 @@ def get_files(**kwargs):
elif f.path.parts[-1] == '__about__.py':
files.append(File(Path('zfoo.py'), f.contents))
- pth_file_name = f"{kwargs['package_name']}.pth"
+ pth_file_name = f"_{kwargs['package_name']}.pth"
files.append(File(Path(pth_file_name), '\n'.join(package_paths)))
files.append(
File(

BIN
hatch-v1.12.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

BIN
hatch-v1.7.0.tar.gz (Stored with Git LFS)

Binary file not shown.

View File

@ -1,3 +1,223 @@
-------------------------------------------------------------------
Thu Aug 8 11:20:24 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>
- Add new patch to fix tests: fix-tests.patch
- Remove upstreamed patch: support-hatchling-1.22.patch
- update to 1.12.0:
- The run/env run and test commands now treat inclusion variable
options as an intersection rather than a union to allow for
specific targeting of environments
- Add ability to control the source of Python distributions
- Upgrade Ruff to 0.4.5
- Upgrade PyApp to 0.22.0 for binary builds
- The fmt command no longer hides the commands that are being
executed
- Add default timeout for network requests, useful when installing
Python distributions
- Fix syntax highlighting contrast for the config show command
- 1.11.1:
- Add official GitHub Action for installing Hatch
- Fix terminal.styles.spinner configuration
- Fix entry points in the pre-built distributions that binaries use
- 1.11.0:
- Upgrade PyApp to 0.21.1 for binary builds
- On Linux, install the highest compatible Python distribution
variant based on CPU architecture rather than assuming recent
hardware
- 1.10.0:
- The run/env run, fmt and shell commands now only change the
current working directory to the project root if not already
inside the project
- The shell command now accepts a single argument to specify the
environment to enter which overrides the standard choice
mechanisms. The arguments determining shell options have been
converted to flags.
- Add test command
- The run command can now execute scripts that define inline
metadata for dependencies and Python version constraints
- The virtual environment type now supports the ability to use UV in
place of pip & virtualenv
- Add self report command for submitting pre-populated bug reports
to GitHub
- The reserved environment used for static analysis is now
completely configurable
- Add the following methods to the environment interface for
complete control over output during life cycle management:
app_status_creation, app_status_pre_installation,
app_status_post_installation, app_status_project_installation,
app_status_dependency_state_check,
app_status_dependency_installation_check,
app_status_dependency_synchronization
- Add binaries for 32-bit versions of Windows
- Read configuration from any ~/.pypirc file for the index publisher
- Use the Git user as the default username for new project URL
metadata
- Add HATCH_DEBUG environment variable that when enabled will show
local variables in the case of unhandled tracebacks
- The env show command now outputs data about all internal
environments when using the --json flag
- Upgrade default CPython distributions to 20240415
- Upgrade default PyPy distributions to 7.3.15
- Upgrade Ruff to 0.4.2
- Upgrade PyApp to 0.19.0 for binary builds
- Bump the minimum supported version of Hatchling to 1.24.2
- Bump the minimum supported version of virtualenv to 20.26.1
- Maintain consistent data paths for case insensitive file systems
- When projects derive dependencies from metadata hooks, there is
now by default a status indicator for when the hooks are executed
for better responsiveness
- Properly support projects with a pyproject.toml file but no
project table e.g. applications
- Fix the fmt command when automatically installing plugin
dependencies
- Fix dependency inheritance for the template of the types
environment for new projects
- Fix warnings related to tar file extraction on Python 3.12+ when
unpacking Python distributions for installation
- De-select Ruff rule E501 for the fmt command by default since it
conflicts with the formatter
- Fix colored output from build targets on the first run (build
environment creation status indicator issue)
- Set the packaging dependency version as >=23.2 to avoid its URL
validation which can conflict with context formatting
- Fix the exit code when there happens to be an unhandled exception
- No longer capture both stdout and stderr streams when parsing
metadata payloads from build environments
- Fix the README.md file template for new projects to avoid Markdown
linting issues
- 1.9.7:
- Limit the maximum version of virtualenv due to a backward
incompatible change
- Upgrade PyApp to 0.12.0 for binary builds
-------------------------------------------------------------------
Wed Mar 27 02:59:47 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-hatchling-1.22.patch:
* Support updates for the new Hatchling.
- Add missing BuildRequires on editables, required for tests.
-------------------------------------------------------------------
Sun Mar 24 13:24:46 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 1.9.4:
* Limit the maximum version of Hatchling in anticipation of
backward incompatible changes
- update to 1.9.3:
* Fix loading of local plugins to account for newly released
versions of a dependency
- update to 1.9.2:
* Fix the default token variable name for publishing to PyPI
-------------------------------------------------------------------
Mon Dec 25 09:52:54 UTC 2023 - Ben Greiner <code@bnavigator.de>
- Update to 1.9.1
* Ensure that the dependency_hash method of the environment
interface is called after sync_dependencies for cases where the
hash is only known at that point, such as for dependency
lockers
* Only acknowledge the HATCH_PYTHON_VARIANT_* environment
variables for Python resolution for supported platforms and
architectures
* Fix Python resolution when there are metadata hooks with
unsatisfied dependencies
- Unskip default platform tests gh#pypa/hatch#1145, but skip
error checker
-------------------------------------------------------------------
Sun Dec 24 15:05:54 UTC 2023 - Ben Greiner <code@bnavigator.de>
- Update to 1.9.0
## Changed:
* Environments prefixed by hatch- are now considered internal and
used for special purposes such as configuration for static
analysis
## Added:
* Enable docstring formatting by default for static analysis
* Allow for overriding config of internal environments
* Concretely state the expected API contract for the environment
interface methods find and check_compatibility
* Upgrade Ruff to 0.1.8
* Bump the minimum supported version of Hatchling to 1.21.0
## Fixed:
* Ignore a project's Python requirement for environments where
the project is not installed
* When not persisting config for static analysis, properly manage
internal settings when Ruff's top level table already exists
* Ignore compatibility checks when environments have already been
created, significantly improving performance of environment
usage
* Properly allow overriding of the path option for the virtual
environment type
* Fix nushell activation on non-Windows systems
- Skip default platform tests on non x86_64
- Stop using %{?python_enable_dependency_generator}: 15.x does
not generate the requirements and gloriously fails when testing
-------------------------------------------------------------------
Mon Dec 18 20:27:19 UTC 2023 - Ben Greiner <code@bnavigator.de>
- Update to 1.8.1
## Fixed:
* Fix regression in calling subprocesses with updated PATH
* Fix automatic installation of environment plugins when running
as a standalone binary
* Change default location of Python installations
- Release 1.8.0
## Changed:
* Drop support for Python 3.7
* The get_build_process method of the environment interface has
been removed; plugins should use the new run_builder method
instead
* Remove pyperclip dependency and the --copy flag of the config
find command
* When running the build command all output from builders is now
displayed as-is in real time without the stripping of ANSI
codes
* Version information (for Hatch itself) is now derived from Git
## Added:
* Support Python 3.12
* Add installers and standalone binaries
* Add the ability to manage Python installations
* Add fmt command
* The virtual environment type can now automatically download
requested versions of Python that are not installed
* Add dependency_hash method to the environment interface
* The state of installed dependencies for environments is saved
as metadata so if dependency definitions have not changed then
no checking is performed, which can be computationally
expensive
* The build command now supports backends other than Hatchling
* Allow the use of features for environments when skip-install is
enabled
* The default is now __TOKEN__ when prompting for a username for
the publish command
* Add a new run_builder method to the environment interface
* Bump the minimum supported version of Hatchling to 1.19.0
* Bump the minimum supported version of click to 8.0.6
## Fixed:
* Fix nushell activation
* Better handling of flat storage directory hierarchies for the
virtual environment type
* Display useful information when running the version command
outside of a project rather than erroring
* Fix the project metadata command by only capturing stdout from
the backend
* Properly support Google Artifact Registry
* Fix parsing dependencies for environments when warnings are
emitted
- Drop patches
* CI.patch
* fix-sdist-target.patch
* hatch-pr828-pth-tests.patch
* packaging232.patch
-------------------------------------------------------------------
Thu Nov 23 10:22:50 UTC 2023 - Markéta Machová <mmachova@suse.com>
- Add packaging232.patch to fix tests with recent packaging
-------------------------------------------------------------------
Sat Oct 7 11:16:12 UTC 2023 - Matej Cepl <mcepl@cepl.eu>

View File

@ -1,7 +1,7 @@
#
# spec file
# spec file for package python-hatch
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -26,40 +26,54 @@
%endif
%{?sle15_python_module_pythons}
Name: python-hatch%{psuffix}
Version: 1.7.0
Version: 1.12.0
Release: 0
Summary: Modern, extensible Python project management
License: MIT
URL: https://hatch.pypa.io/latest/
# SourceRepository: https://github.com/pypa/hatch
Source: https://github.com/pypa/hatch/archive/refs/tags/hatch-v%{version}.tar.gz
# PATCH-FIX-UPSTREAM fix-sdist-target.patch -- gh#pypa/hatch@1b10663e645e
Patch0: fix-sdist-target.patch
# PATCH-FIX-UPSTREAM hatch-pr828-pth-tests.patch, gh#pypa/hatch#828
Patch1: hatch-pr828-pth-tests.patch
# PATCH-FIX-UPSTREAM CI.patch, gh#pypa/hatch#940
Patch2: CI.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module hatchling >= 1.14}
# PATCH-FIX-OPENSUSE fix-tests.patch
Patch0: fix-tests.patch
BuildRequires: %{python_module base >= 3.8}
BuildRequires: %{python_module hatch-vcs >= 0.3}
BuildRequires: %{python_module hatchling >= 1.19}
BuildRequires: %{python_module pip}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
Requires(post): update-alternatives
Requires(postun):update-alternatives
Requires(postun): update-alternatives
Requires: git-core
%{?python_enable_dependency_generator}
Requires: python-click >= 8.0.6
Requires: python-hatchling >= 1.21.0
Requires: python-httpx >= 0.22.0
Requires: python-hyperlink >= 21.0.0
Requires: python-keyring >= 23.5.0
Requires: python-packaging >= 21.3
Requires: python-platformdirs >= 2.5.0
Requires: python-rich >= 11.2.0
Requires: python-shellingham >= 1.4.0
Requires: python-tomli-w >= 1.0
Requires: python-tomlkit >= 0.11.1
Requires: python-virtualenv >= 20.16.2
Requires: python-zstandard < 1
Requires: uv
Requires: (python-pexpect >= 4.8 with python-pexpect < 5)
Requires: (python-userpath >= 1.7 with python-userpath < 2)
%if %{with test}
BuildRequires: %{python_module editables}
BuildRequires: %{python_module filelock >= 3.7.1}
BuildRequires: %{python_module hatch = %{version}}
# Due to Patch1, gh#pypa/hatch#828
BuildRequires: %{python_module hatchling >= 1.17.1}
BuildRequires: %{python_module pyfakefs}
BuildRequires: %{python_module pytest-mock}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module trustme}
BuildRequires: cargo
BuildRequires: uv
%else
BuildArch: noarch
%endif
%python_subpackages
%description
@ -76,11 +90,13 @@ Features
%prep
%autosetup -p1 -n hatch-hatch-v%{version}
%if !%{with test}
%build
%if !%{with test}
%pyproject_wheel
%endif
%install
%if !%{with test}
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/hatch
%python_expand %fdupes %{buildroot}%{$python_sitelib}
@ -92,7 +108,26 @@ export LANG=en_US.UTF-8
# tests expect this to be unset and use their own reproducible value. Nothing installed from here.
# https://hatch.pypa.io/latest/config/build/#reproducible-builds
unset SOURCE_DATE_EPOCH
%pytest
# finds bash instead of expected sh as default shell inside obs
donttest="(test_install and test_already_installed_update_prompt)"
donttest="$donttest or (test_install and test_already_installed_update_flag)"
donttest="$donttest or (test_install and test_all)"
# platform distribution selection errors: https://github.com/pypa/hatch/issues/1145
%ifnarch x86_64
donttest="$donttest or (test_resolve and test_resolution_error)"
donttest+=" or test_custom_source or test_pypy_custom"
%endif
%ifarch s390x
# Console width different
donttest="$donttest or test_context_formatting"
%endif
# Requires network
donttest+=" or test_uv_env"
# Fails with python 3.12
donttest+=" or test_pyenv or test_no_open or test_open"
%pytest -v -k "not ($donttest)"
%endif
%post