## START: Set by rpmautospec
## (rpmautospec version 0.3.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    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

%global short_name lsp-server
%global forgeurl https://github.com/python-lsp/python-lsp-server

%global _description %{expand:
A python implementation of language server protocol. pylsp provides for 
auto-completion, code linting (via pycodestyle and pyflakes) and other features.

This package provides the python-language-server package maintained by 
spyder-IDE maintainers.
}

Name:           python-%{short_name}
Version:        1.8.2
Release:        %autorelease
Summary:        Python implementation of language server protocol
%forgemeta
License:        MIT
URL:            %{forgeurl}
Source0:        %{forgesource}

BuildArch:      noarch

BuildRequires:  python3-devel, git-core
BuildRequires:  pyproject-rpm-macros

%description %_description

%package -n     python3-%{short_name}
Summary:        %{summary}

Provides:       pylsp = %{version}-%{release}


%description -n python3-%{short_name} %_description


%pyproject_extras_subpkg -n python3-%{short_name} all


%prep
%forgeautosetup -p1 -S git
# Remove version pinning from linters
# Do this inline instead of a patch for automatic updates using Packit
sed -r -i \
-e 's/(flake8)>.*"/\1"/g' \
-e 's/(pycodestyle)>.*"/\1"/g' \
-e 's/(pyflakes)>.*"/\1"/g' \
-e 's/(pylint)>.*"/\1"/g' pyproject.toml
git add pyproject.toml
git commit -m '[Fedora] Remove version pinning from linters'
git tag v%{version}

%generate_buildrequires
%pyproject_buildrequires -x test,all

%build
%pyproject_wheel

%install
%pyproject_install

%pyproject_save_files pylsp

%check
%pytest --no-cov --ignore test/plugins/test_pyflakes_lint.py \
  -k "not (test_pylint or test_syntax_error_pylint)"

%files -n python3-%{short_name} -f %{pyproject_files}
%license LICENSE
%doc README.md
%{_bindir}/pylsp

%changelog
* Thu Oct 12 2023 Packit <hello@packit.dev> - 1.8.2-1
- [packit] 1.8.2 upstream release

* Sun Oct 08 2023 Sandro <devel@penguinpee.nl> - 1.8.1-3
- Add Packit config

* Sun Oct 08 2023 Sandro <devel@penguinpee.nl> - 1.8.1-2
- Drop patch in favor of inline patching

* Sun Oct 08 2023 Sandro <devel@penguinpee.nl> - 1.8.1-1
- Update to 1.8.1 (RHBZ#2242589)

* Tue Sep 26 2023 Sandro <devel@penguinpee.nl> - 1.8.0-6
- Unpin `pylint` (RHBZ#2240745)
- Updated patch (be consistent with unpinning)

* Sun Sep 24 2023 Sandro <devel@penguinpee.nl> - 1.8.0-5
- Use forge macro for setup

* Sun Sep 24 2023 Sandro <devel@penguinpee.nl> - 1.8.0-4
- Clean up obsolete Requires
- Requires are now autogenerated

* Sun Sep 24 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.8.0-3
- Add a metapackage for the “all” extra

* Sat Sep 23 2023 Sandro <devel@penguinpee.nl> - 1.8.0-2
- Fix incorrect version in python3.12dist and python3dist
- Tag git tree so Python build correctly determines version

* Sun Sep 10 2023 Sandro <devel@penguinpee.nl> - 1.8.0-1
- Update to 1.8.0 (RHBZ#2237971)
- Drop patch (no longer applies)
- Remove version pinning from linters

* Sun Sep 03 2023 Sandro <devel@penguinpee.nl> - 1.7.4-1
- Update to 1.7.4
- Migrate to SPDX license (value unchanged)
- Use forge macros (we need the GitHub tarball)
- Apply patch for python3-jedi upper bound
- Close RHBZ#2148622 RHBZ#2171679 RHBZ#2220316

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Mon Jul 04 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.4.1-2
- Rebuild for python3.11

* Thu Mar 31 2022 Mukundan Ragavan <nonamedotc@gmail.com> - 1.4.1-1
- Update to 1.4.1

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Tue Jan 18 2022 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 1.3.3-2
- Add requires on py3-docstyle

* Sat Jan 15 2022 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 1.3.3-1
- Update to 1.3.3
- Add explicit requires (needed for spyder)

* Sun Sep 05 2021 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 1.2.2-1
- Update to 1.2.2

* Sat Aug 14 2021 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 1.2.1-1
- Update to 1.2.1

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

* Wed Jul 07 2021 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 1.0.0-2
- Spec cleanup
- Improve description

* Mon Jul 05 2021 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 1.0.0-1
- Initial package.