File python3-check-manifest.spec of Package python3-check-manifest

#
# spec file for package python-check-manifest
#
# 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
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without test
Name:           python3-check-manifest
Version:        0.37
Release:        0
Summary:        Check MANIFEST in a Python source package for completeness
License:        MIT
Group:          Development/Languages/Python
URL:            https://github.com/mgedmin/check-manifest
Source:         https://files.pythonhosted.org/packages/source/c/check-manifest/check-manifest-%{version}.tar.gz
# PATCH-FIX-UPSTREAM executable.patch gh#mgedmin/check-manifest#57 mcepl@suse.com
# Don't assume 'python' executable exists, check for it.
Patch0:         executable.patch
# PATCH-FIX-UPSTREAM fix-git-transport-file-not-allowed.patch alarrosa@suse.com
Patch1:         fix-git-transport-file-not-allowed.patch
BuildRequires:  %{python_module setuptools}
BuildRequires:  python-rpm-macros
BuildArch:      noarch
%if %{with test}
BuildRequires:  %{python_module mock}
BuildRequires:  git
%endif
Requires(post): update-alternatives
Requires(postun):update-alternatives
%python_subpackages

%description
check-manifest is a tool for python developers to check for broken packages
and missing files in MANIFEST.

%prep
%autosetup -p1 -n check-manifest-%{version}

#sed -ie "s,#!/usr/bin/env python,##!/usr/bin/python3," check_manifest.py
sed -i '1{\,^#!%{_bindir}/env python,d}' check_manifest.py

%build
%python_build

%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/check-manifest
chmod -x %{buildroot}%{python_sitelib}/check_manifest.py

%if %{with test}
%check
export LANG=en_US.UTF-8
%python_exec setup.py test
%endif

%post
%python_install_alternative check-manifest

%postun
%python_uninstall_alternative check-manifest

%files %{python_files}
%doc CHANGES.rst README.rst
%license LICENSE.rst
%python_alternative %{_bindir}/check-manifest
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by