Blob Blame History Raw
%bcond tests 1

# Use this to package a pre-release
#global commit xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#global snapdate yyyymmdd

Name:           hatch
Version:        1.7.0%{?commit:^%{snapdate}git%(c='%{commit}'; echo "${c:0:7}")}
Release:        %autorelease
Summary:        A modern project, package, and virtual env manager

%global tag hatch-v%{version}
%global ref %{?commit:%{commit}}%{?!commit:%{tag}}
%global archivename hatch-%{ref}

# The entire source is (SPDX) MIT. Apache-2.0 license text in the tests is used
# as a sample license text, not as a license for the source.
License:        MIT
Source0:        %{url}/archive/%{ref}/%{archivename}.tar.gz
# For now, we need a helper script to access environments defined with
# hatch/hatchling (
Source1:        extract-hatchling-environments

# Written for Fedora in groff_man(7) format based on --help output
Source100:      hatch.1
Source200:      hatch-build.1
Source300:      hatch-clean.1
Source400:      hatch-config.1
Source410:      hatch-config-explore.1
Source420:      hatch-config-find.1
Source430:      hatch-config-restore.1
Source440:      hatch-config-set.1
Source450:      hatch-config-show.1
Source460:      hatch-config-update.1
Source500:      hatch-dep.1
Source510:      hatch-dep-hash.1
Source520:      hatch-dep-show.1
Source521:      hatch-dep-show-requirements.1
Source522:      hatch-dep-show-table.1
Source600:      hatch-env.1
Source610:      hatch-env-create.1
Source620:      hatch-env-find.1
Source630:      hatch-env-prune.1
Source640:      hatch-env-remove.1
Source650:      hatch-env-run.1
Source660:      hatch-env-show.1
Source700:      hatch-new.1
Source800:      hatch-project.1
Source810:      hatch-project-metadata.1
Source900:      hatch-publish.1
Source1000:     hatch-run.1
Source1100:     hatch-shell.1
Source1200:     hatch-status.1
Source1300:     hatch-version.1

# Fix the sdist target when strict-naming is disabled (#834)
# Backporting this commit makes tests/backend/builders/ compatible
# with hatchling 1.14.1.
Patch:          %{url}/commit/1b10663e645efd6f37d616c5de34451dc2e015c0.patch

# Fix CI (#940)
# fix unrelated ci issue
# This patch adjusts the expected whitespace in two tests to match recent
# versions of tomlkit; the change in tomlkit was introduced no later than
# 0.12.1 and no earlier than 0.11.5.
Patch:          %{url}/commit/4ddbf0a9a720caed18d19c083ff88427c9d2a993.patch

BuildArch:      noarch

BuildRequires:  python3-devel

BuildRequires:  git-core
Requires:       git-core

Hatch is a modern, extensible Python project manager.


  • Standardized build system with reproducible builds by default
  • Robust environment management with support for custom scripts
  • Easy publishing to PyPI or other sources
  • Version management
  • Configurable project generation with sane defaults
  • Responsive CLI, ~2-3x faster than equivalent tools

%autosetup -n %{archivename} -p1

'%{SOURCE1}' -v
%pyproject_buildrequires %{?with_tests:_req/env.test.txt}


# The Markdown documentation is meant to be built with mkdocs. The HTML result
# is unsuitable for packaging due to various bundled and pre-minified
# JavaScript and CSS. See
# for discussion of similar problems with Sphinx and Doxygen. We therefore do
# not build or install the documentation.

%pyproject_save_files hatch

install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 \
    '%{SOURCE100}' \
    '%{SOURCE200}' \
    '%{SOURCE300}' \
    '%{SOURCE400}' '%{SOURCE410}' '%{SOURCE420}' '%{SOURCE430}' \
      '%{SOURCE440}' '%{SOURCE450}' '%{SOURCE460}' \
    '%{SOURCE500}' '%{SOURCE510}' '%{SOURCE520}' '%{SOURCE521}' \
      '%{SOURCE522}' \
    '%{SOURCE600}' '%{SOURCE610}' '%{SOURCE620}' '%{SOURCE630}' \
      '%{SOURCE640}' '%{SOURCE650}' '%{SOURCE660}' \
    '%{SOURCE700}' \
    '%{SOURCE800}' '%{SOURCE810}' \
    '%{SOURCE900}' \
    '%{SOURCE1000}' \
    '%{SOURCE1100}' \
    '%{SOURCE1200}' \

%if %{with tests}
# There is no need to deselect mark “requires_internet” manually because it
# happens automagically via a runtime connectivity check.

# TODO: What is  happening here?
# >           assert zip_info.date_time == (2020, 2, 2, 0, 0, 0)
# E           assert (2022, 5, 18, 0, 0, 0) == (2020, 2, 2, 0, 0, 0)
# E             At index 0 diff: 2022 != 2020
# E             Full diff:
# E             - (2020, 2, 2, 0, 0, 0)
# E             + (2022, 5, 18, 0, 0, 0)
k="${k-}${k+ and }not (TestBuildStandard and test_editable_pth)"
k="${k-}${k+ and }not (TestBuildStandard and test_editable_exact)"
k="${k-}${k+ and }not (TestBuildStandard and test_editable_default)"
k="${k-}${k+ and }not (TestBuildStandard and test_default_auto_detection)"
k="${k-}${k+ and }not test_explicit_path"
k="${k-}${k+ and }not test_default"

%pytest -k "${k-}" -vv

%files -f %{pyproject_files}