## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 3;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

# Work around a series of circular test dependencies:
#
#    python-snakemake-interface-report-plugins
#    ↓↑   ⬐───╮
# snakemake → python-snakemake-interface-executor-plugins⬎
#    ↑↑ │ ⬑────────────────────python-snakemake-executor-plugin-cluster-generic
#    ││ ↳python-snakemake-interface-storage-plugins────────────────╮
#    ││                                           ↓                │
#    │╰────────────────────────python-snakemake-storage-plugin-http│
#    ╰─────────────────────────python-snakemake-storage-plugin-s3🠔─╯
#
# A good build order is:
#
#   1. BOOTSTRAP: python-snakemake-interface-executor-plugins,
#      python-snakemake-interface-storage-plugins,
#      python-snakemake-interface-report-plugins
#   2. BOOTSTRAP: snakemake
#   3. python-snakemake-executor-plugin-cluster-generic,
#      python-snakemake-storage-plugin-http,
#      python-snakemake-storage-plugin-s3
#   4. snakemake, python-snakemake-interface-executor-plugins,
#      python-snakemake-interface-storage-plugins,
#      python-snakemake-interface-report-plugins
%bcond bootstrap 0
%bcond tests %{without bootstrap}

%global _description %{expand:
The Snakemake workflow management system is a tool to create reproducible and
scalable data analyses. Workflows are described via a human readable, Python
based language. They can be seamlessly scaled to server, cluster, grid and
cloud environments, without the need to modify the workflow definition.
Finally, Snakemake workflows can entail a description of required software,
which will be automatically deployed to any execution environment.}

Name:           snakemake
Version:        8.13.0
Release:        %autorelease 
Summary:        Workflow management system to create reproducible and scalable data analyses

# The entire project is (SPDX) MIT, except:
# - versioneer.py is Unlicense
# - snakemake/_version.py says:
#     This file is released into the public domain.
#   which would be LicenseRef-Fedora-Public-Domain, except that the comments in
#   versioneer.py make it clear that Unlicense is intended for the generated
#   files as well.
License:        MIT AND Unlicense
URL:            https://snakemake.readthedocs.io/en/stable/index.html
Source:         https://github.com/snakemake/snakemake/archive/v%{version}/snakemake-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  python3-devel

BuildRequires:  help2man

BuildRequires:  vim-filesystem
Requires:       vim-filesystem

Provides:       vim-snakemake = %{version}-%{release}
# These extras were removed upstream in Snakemake 8.0.0. Retain the Obsoletes
# until F40 reaches EOL so we have a clean upgrade path.
Obsoletes:      snakemake+azure < 8.1.0-1
Obsoletes:      snakemake+google-cloud < 8.1.0-1
# We no longer build Sphinx-generated PDF documentation. Beginning with 8.2.3,
# this would require patching out sphinxawesome-theme from docs/conf.py. It’s
# possible but tedious.
Obsoletes:      snakemake-doc < 8.2.1-2

%if %{with tests}
# See test-environment.yml for a listing of test dependencies, along with a lot
# of other cruft.
BuildRequires:  %{py3_dist boto3}
BuildRequires:  %{py3_dist pandas}
BuildRequires:  %{py3_dist pytest}
BuildRequires:  %{py3_dist snakemake-executor-plugin-cluster-generic}
BuildRequires:  %{py3_dist snakemake-storage-plugin-s3}
%endif
# For import-testing snakemake.gui
BuildRequires:  %{py3_dist flask}
# For import-testing snakemake.executors.google_lifesciences_helper:
BuildRequires:  %{py3_dist google-cloud-storage}

%description %_description

# No metapackage for “pep” extra because the following are not packaged:
#   - python3-eido
#   - python3-peppy
%pyproject_extras_subpkg -n snakemake reports messaging

%prep
%autosetup -n snakemake-%{version} -p1
%py3_shebang_fix .
# Remove shebangs from non-executable scripts. The Python script is executable
# in the source tree but will be installed without executable permissions.
sed -r -i '1{/^#!/d}' \
    snakemake/executors/jobscript.sh \
    snakemake/executors/google_lifesciences_helper.py
# Fix calls to unversioned Python interpreter
sed -r -i 's@"python"@"%{python3}"@g' tests/test_linting.py
sed -r -i 's@python -m@"%{python3} -m@g' tests/tests.py
# Copy and rename nano and vim extensions readmes for use in the main
# documentation directory.
for editor in nano vim
do
  cp -vp "misc/${editor}/README.md" "README-${editor}.md"
done

%generate_buildrequires
# Generate BR’s for all supported extras to ensure they do not FTI
%pyproject_buildrequires -x reports,messaging,google-cloud,azure

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files -l snakemake

# We wait until %%install to generate the man page so that we can use the
# proper script entry point. The generated man page is not perfect, but it is
# good enough to be useful.
install -d %{buildroot}%{_mandir}/man1
PATH="${PATH-}:%{buildroot}%{_bindir}" \
    PYTHONPATH='%{buildroot}%{python3_sitelib}' \
    help2man --no-info --name='%{summary}' snakemake \
    > %{buildroot}%{_mandir}/man1/snakemake.1

# Install nano syntax highlighting
install -t '%{buildroot}%{_datadir}/nano' -D -m 0644 -p \
    misc/nano/syntax/snakemake.nanorc

# Install vim syntax highlighting
install -d '%{buildroot}%{_datadir}/vim/vimfiles'
cp -vrp misc/vim/* '%{buildroot}%{_datadir}/vim/vimfiles'
find '%{buildroot}%{_datadir}/vim/vimfiles' \
    -type f -name 'README.*' -print -delete

%check
# Even if we are running the tests, this is useful; it could turn up import
# errors that would only be revealed by tests we had to disable (e.g. due to
# network access).
#
# ImportError from snakemake.executors.flux (no 'sleep' in
# snakemake_interface_executor_plugins.utils)
# https://github.com/snakemake/snakemake/issues/2598
# “The flux module is actually supposed to be moved into a plugin and has no
# connection to the rest of the code anymore.”
%pyproject_check_import -e '*.tests*' -e 'snakemake.executors.flux'

%if %{with tests}
# Needs a network connection:
ignore="${ignore-} --ignore-glob=tests/test_google_lifesciences/*"

# Needs a network connection (plus, there are some unresolved
# unversioned-python-command issues which we hope are confined to the test
# code):
k="${k-}${k+ and }not test_deploy_sources"

# ______ ERROR collecting tests/test_conda_python_script/test_script.py ______
# import file mismatch:
# imported module 'test_script' has this __file__ attribute:
#   /builddir/build/BUILD/snakemake-7.31.1/tests/test_conda_python_3_7_script/test_script.py
# which is not the same as the test file we want to collect:
#   /builddir/build/BUILD/snakemake-7.31.1/tests/test_conda_python_script/test_script.py
# HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
#
# Plus, this would add an unwanted BuildRequires on %%{py3_dist Pillow}.
ignore="${ignore-} --ignore-glob=tests/test_conda_python_3_7_script/*"

%pytest -v -k "${k-}" ${ignore-}
%endif

%files -f %{pyproject_files}
%doc CHANGELOG.md
%doc README.md
%doc README-nano.md
%doc README-vim.md

%{_bindir}/snakemake
%{_mandir}/man1/snakemake.1*

# This is not owned by the filesystem package, and there is no nano-filesystem
# subpackage, so we co-own the directory to avoid depending on nano.
%dir %{_datadir}/nano/
%{_datadir}/nano/snakemake.nanorc

%{_datadir}/vim/vimfiles/ftdetect/snakemake.vim
%{_datadir}/vim/vimfiles/ftplugin/snakemake/
%{_datadir}/vim/vimfiles/syntax/snakemake.vim

%changelog
## START: Generated by rpmautospec
* Sun Jun 09 2024 Python Maint <python-maint@redhat.com> - 8.13.0-3
- Rebuilt for Python 3.13

* Sun Jun 09 2024 Python Maint <python-maint@redhat.com> - 8.13.0-2
- Bootstrap for Python 3.13

* Thu Jun 06 2024 Packit <hello@packit.dev> - 8.13.0-1
- Update to 8.13.0 upstream release
- Resolves: rhbz#2290700

* Mon May 27 2024 Packit <hello@packit.dev> - 8.12.0-1
- Update to 8.12.0 upstream release
- Resolves: rhbz#2283549

* Fri May 17 2024 Packit <hello@packit.dev> - 8.11.6-1
- Update to 8.11.6 upstream release
- Resolves: rhbz#2280990

* Sat May 04 2024 Packit <hello@packit.dev> - 8.11.3-1
- Update to 8.11.3 upstream release
- Resolves: rhbz#2278739

* Wed May 01 2024 Packit <hello@packit.dev> - 8.11.1-1
- Update to 8.11.1 upstream release
- Resolves: rhbz#2278140

* Thu Apr 25 2024 Packit <hello@packit.dev> - 8.11.0-1
- Update to 8.11.0 upstream release
- Resolves: rhbz#2276195

* Sat Apr 20 2024 Packit <hello@packit.dev> - 8.10.8-1
- Update to 8.10.8 upstream release
- Resolves: rhbz#2276195

* Sat Apr 13 2024 Packit <hello@packit.dev> - 8.10.7-1
- Update to 8.10.7 upstream release
- Resolves: rhbz#2274843

* Thu Apr 04 2024 Packit <hello@packit.dev> - 8.10.6-1
- Update to 8.10.6 upstream release
- Resolves: rhbz#2273536

* Thu Mar 28 2024 Packit <hello@packit.dev> - 8.10.4-1
- [packit] 8.10.4 upstream release
- Resolves: rhbz#2271076

* Wed Mar 20 2024 Packit <hello@packit.dev> - 8.9.0-1
- [packit] 8.9.0 upstream release
- Resolves rhbz#2270394

* Fri Mar 15 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 8.8.0-1
- Update to 8.8.0

* Thu Mar 14 2024 Packit <hello@packit.dev> - 8.7.0-1
- [packit] 8.7.0 upstream release
- Resolves rhbz#2269498

* Tue Mar 12 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 8.6.0-2
- Non-bootstrap build of snakemake 8.6.0

* Tue Mar 12 2024 Packit <hello@packit.dev> - 8.6.0-1
- [packit] 8.6.0 upstream release (bootstrap)
- Resolves rhbz#2269081

* Mon Mar 11 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 8.5.5-2
- Patch to allow smart_open 7.x

* Fri Mar 08 2024 Packit <hello@packit.dev> - 8.5.5-1
- [packit] 8.5.5 upstream release
- Resolves rhbz#2268576

* Thu Mar 07 2024 Packit <hello@packit.dev> - 8.5.4-1
- [packit] 8.5.4 upstream release
- Resolves rhbz#2268374

* Mon Feb 26 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 8.5.3-1
- Update to 8.5.3

* Sun Feb 25 2024 Packit <hello@packit.dev> - 8.5.2-1
- [packit] 8.5.2 upstream release
- Resolves rhbz#2265871

* Wed Feb 21 2024 Packit <hello@packit.dev> - 8.4.12-1
- [packit] 8.4.12 upstream release
- Resolves rhbz#2265048

* Sun Feb 18 2024 Packit <hello@packit.dev> - 8.4.9-1
- [packit] 8.4.9 upstream release
- Resolves rhbz#2263559

* Fri Feb 09 2024 Packit <hello@packit.dev> - 8.4.8-1
- [packit] 8.4.8 upstream release
- Resolves rhbz#2263559

* Thu Feb 08 2024 Packit <hello@packit.dev> - 8.4.7-1
- [packit] 8.4.7 upstream release
- Resolves rhbz#2263390

* Wed Feb 07 2024 Packit <hello@packit.dev> - 8.4.6-1
- [packit] 8.4.6 upstream release
- Resolves rhbz#2263115

* Mon Feb 05 2024 Packit <hello@packit.dev> - 8.4.4-1
- [packit] 8.4.4 upstream release
- Resolves rhbz#2262847

* Sat Feb 03 2024 Packit <hello@packit.dev> - 8.4.3-1
- [packit] 8.4.3 upstream release
- Resolves rhbz#2259983

* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 8.2.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sun Jan 21 2024 Packit <hello@packit.dev> - 8.2.3-1
- [packit] 8.2.3 upstream release
- Resolves rhbz#2259386

* Sun Jan 21 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 8.2.1-2
- Don’t build PDF documentation
- Drop and Obsolete the -doc subpackage

* Fri Jan 19 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 8.2.1-1
- [packit] 8.2.1 upstream release

* Fri Jan 19 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 8.1.2-2
- Non-bootstrap build

* Sun Jan 14 2024 Packit <hello@packit.dev> - 8.1.2-1
- [packit] 8.1.2 upstream release
- Resolves rhbz#2255578

* Fri Jan 05 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 7.32.4-3
- Assert that the .dist-info directory contains a license file

* Fri Dec 22 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.32.4-2
- Fix mis-named “chanegelog” in repo

* Mon Sep 18 2023 Packit <hello@packit.dev> - 7.32.4-1
- [packit] 7.32.4 upstream release

* Thu Aug 10 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.32.3-1
- Update to 7.32.3

* Thu Aug 10 2023 Packit <hello@packit.dev> - 7.32.2-1
- [packit] 7.32.2 upstream release

* Thu Aug 10 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 7.32.0-8
- chore(packit): re-add upstream_tag_template

* Thu Aug 10 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 7.32.0-7
- chore(packit): add koji job

* Thu Aug 10 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 7.32.0-6
- chore(packit): limit PRs to rawhide

* Wed Aug 09 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 7.32.0-5
- Revert "chore(packit): define upstream tag template"

* Wed Aug 09 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 7.32.0-4
- chore(packit): define upstream tag template

* Sat Aug 05 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.32.0-3
- Don’t allow packit to report issues upstream

* Fri Aug 04 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 7.32.0-2
- chore: add packit conf

* Fri Aug 04 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.32.0-1
- Update to 7.32.0 (close RHBZ#2229001)

* Wed Aug 02 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.31.1-1
- Update to 7.31.1 (close RHBZ#2224675)

* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 7.30.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Mon Jul 17 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.30.1-3
- Fix FTBFS due to SyntaxWarnings in Python 3.12 (fix RHBZ#2220595)

* Thu Jul 13 2023 Python Maint <python-maint@redhat.com> - 7.30.1-2
- Rebuilt for Python 3.12

* Thu Jun 29 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.30.1-1
- Update to 7.30.1 (close RHBZ#2214110)
- Adds a metapackage for the new “azure” extra

* Thu Jun 29 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.26.0-6
- Use new (rpm 4.17.1+) bcond style

* Mon May 22 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.26.0-5
- Install nano syntax highlighting support

* Mon May 22 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.26.0-4
- Install vim syntax highlighting support

* Mon May 22 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.26.0-3
- Install bash completions

* Mon May 22 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.26.0-2
- Add a generated man page

* Mon May 22 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.26.0-1
- Update to 7.26.0 (close RHBZ#2203471)

* Sat May 06 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.25.3-1
- Update to 7.25.3 (close RHBZ#2193279J)

* Sat Apr 29 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.25.2-1
- Update to 7.25.2 (close RHBZ#2178275)

* Sat Mar 11 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.24.1-1
- Update to 7.24.1 (close RHBZ#2171148)

* Mon Feb 13 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.22.0-1
- Update to 7.22.0 (close RHBZ#2169240)

* Wed Feb 08 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.21.0-1
- Update to 7.21.0 (close RHBZ#2166983)

* Sun Jan 22 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.20.0-1
- Update to 7.20.0 (close RHBZ#2162603)

* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 7.19.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Wed Jan 04 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 7.19.1-1
- Update to 7.19.1 (close RHBZ#2153168)

* Fri Dec 09 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 7.18.2-1
- Update to 7.8.12 (close RHBZ#2139921)

* Thu Dec 08 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 7.18.1-1
- Update to 7.18.1

* Tue Nov 01 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 7.18.0-1
- Update to 7.18.0 (close RHBZ#2138985)

* Tue Nov 01 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 7.17.2-4
- Remove an obsolete spec file comment

* Tue Nov 01 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 7.17.2-3
- Confirm the License is SPDX MIT

* Tue Nov 01 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 7.17.2-2
- Simplify references to the -doc subpackage

* Sun Oct 30 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 7.17.2-1
- Update to 7.17.2 (close RHBZ#2130414)

* Fri Aug 26 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 7.13.0-1
- Update to 7.13.0 (close RHBZ#2121550)

* Mon Aug 22 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 7.12.1-2
- Use rsvg-convert instead of inkscape

* Thu Aug 11 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 7.12.1-1
- Update to 7.12.1 (close RHBZ#2117565)

* Sun Jul 31 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 7.12.0-1
- Update to 7.12.0

* Wed Jul 27 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 7.11.0-1
- Update to 7.11.0

* Sun Jul 24 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 7.9.0-2
- Build documentation as PDF instead of HTML

* Sun Jul 24 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 7.9.0-1
- Update to 7.9.0 (close RHBZ#2039280, fix RHBZ#2099173)
- Add “extras” metapackages
- Generate BuildRequires for documentation

* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 6.13.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Thu Jun 16 2022 Python Maint <python-maint@redhat.com> - 6.13.1-4
- Rebuilt for Python 3.11

* Mon Jan 24 2022 Vanessa_kris <vanessaigwe1@gmail.com> - 6.13.1-3
- added autochanelog

* Mon Jan 24 2022 Vanessa Christopher <vanessaigwe1@gmail.com> - 6.13.1-2
- autorelease

* Sun Jan 23 2022 Vanessa Christopher <vanessaigwe1@gmail.com> - 6.13.1-1
- Version update to v6.13.1

* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 6.12.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Sat Dec 18 2021 Aniket Pradhan <major AT fedoraproject DOT org> - 6.12.3-1
- Version update to v6.12.3
- Use pyproject macros

* Thu Sep 09 2021 Aniket Pradhan <major AT fedoraproject DOT org> - 6.8.0-1
- Version update to v6.8.0

* Tue Aug 17 2021 Aniket Pradhan <major AT fedoraproject DOT org> - 6.7.0-1
- Version update to v6.7.0

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 6.6.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Sat Jul 17 2021 Aniket Pradhan <major AT fedoraproject DOT org> - 6.6.0-1
- Version update to v6.6.0
- Remove patches for documentation as they are no longer needed

* Mon Jul 05 2021 Aniket Pradhan <major AT fedoraproject DOT org> - 6.5.2-2
- Correct the import path of napoleon extension
- Use pytest macro

* Sat Jul 03 2021 Aniket Pradhan <major AT fedoraproject DOT org> - 6.5.2-1
- Initial build

## END: Generated by rpmautospec