File python-aiosmb.spec of Package python-aiosmb

#
# spec file for package python-aiosmb
#
# Copyright (c) 2024-2025, Martin Hauke <mardnh@gmx.de>
#
# 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/
#

%define binaries asmbclient asmbshareenum asmbgetfile asmbcertreq asmbscanner
Name:           python-aiosmb
Version:        0.4.14
Release:        0
Summary:        Asynchronous SMB protocol implementation
License:        Apache-1.1
URL:            https://github.com/skelsec/aiosmb
Source:         https://files.pythonhosted.org/packages/source/a/aiosmb/aiosmb-%{version}.tar.gz
Source1:        https://raw.githubusercontent.com/skelsec/aiosmb/main/LICENSE.md
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools >= 61.0.0}
BuildRequires:  %{python_module wheel}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires:       python-asn1crypto
Requires:       python-asyauth >= 0.0.16
Requires:       python-asysocks >= 0.2.9
Requires:       python-colorama
Requires:       python-cryptography
Requires:       python-prompt_toolkit >= 3.0.2
Requires:       python-six
Requires:       python-tqdm
Requires:       python-unicrypto >= 0.0.10
Requires:       python-wcwidth
Requires:       python-winacl >= 0.1.8
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch:      noarch
%python_subpackages

%description
Asynchronous SMB protocol implementation.

%prep
%autosetup -p1 -n aiosmb-%{version}
cp %{SOURCE1} .
sed -e '/^#!\//, 1d' -i \
  aiosmb/commons/connection/target.py \
  aiosmb/external/asciitree/asciitree/__init__.py \
  aiosmb/external/asciitree/setup.py

%build
%pyproject_wheel

%install
%pyproject_install
%python_expand cd %{buildroot}%{_bindir} && find . -name "*.py" -exec sh -c 'mv $0 impacket-`basename "$0" .py`' '{}' \;
for b in %{binaries}; do
  %python_clone -a %{buildroot}%{_bindir}/$b
done
#
%python_expand %fdupes %{buildroot}%{$python_sitelib}
#
%python_expand rm %{buildroot}%{_bindir}/_current_flavor

%post
%{lua:for b in rpm.expand("%{binaries}"):gmatch("%S+") do
  print(rpm.expand("%python_install_alternative " .. b .. "\n"))
end}

%postun
%{lua:for b in rpm.expand("%{binaries}"):gmatch("%S+") do
  print(rpm.expand("%python_uninstall_alternative " .. b .. "\n"))
end}

%check
# no tests exist

%files %{python_files}
%license LICENSE.md
%doc README.md
%{lua:for b in rpm.expand("%{binaries}"):gmatch("%S+") do
print(rpm.expand("%python_alternative %{_bindir}/" .. b .. "\n"))
end}
%{python_sitelib}/aiosmb
%{python_sitelib}/aiosmb-%{version}.dist-info

%changelog
openSUSE Build Service is sponsored by