File LaZagne.spec of Package LaZagne

#
# spec file for package LaZagne
#
# Copyright (c) 2021 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 http://bugs.opensuse.org/
#

Name:           LaZagne
Version:        2.4.4
Release:        0
Summary:        Python tool to decode locally stored passwords
License:        LGPL-3.0-only
Group:          Development/Languages/Python
URL:            https://github.com/AlessandroZ/LaZagne
Source0:        https://github.com/AlessandroZ/LaZagne/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires:  fdupes
BuildRequires:  python3-devel
Requires:       dbus-1-python3
Requires:       python3-SecretStorage
Requires:       python3-psutil
Requires:       python3-pyasn1
BuildArch:      noarch

%description
LaZagne is an open source tool to retrieve and decode
credentials stored on your computer.

%prep
%setup -q
find Linux/lazagne -name *.py|xargs sed -i '/^#!/d'
find Linux/lazagne -name *.py|xargs chmod -x
mv Linux/laZagne.py Linux/%{name}.py
sed -i 's|^#!/usr/bin/env python|#!%__python3|' Linux/%{name}.py
chmod -x CHANGELOG LICENSE README.md

%build

%install
pushd Linux
mkdir -p %{buildroot}%{python3_sitelib}/%{name}
cp %{name}.py %{buildroot}%{python3_sitelib}/%{name}
cp -a lazagne %{buildroot}%{python3_sitelib}/%{name}
popd

pushd %{buildroot}%{python3_sitelib}/%{name}/
find . -name '*.pyc' -exec rm -f {} \;
python3 -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" .
popd

mkdir -p %{buildroot}%{_bindir}
pushd %{buildroot}%{_bindir}
ln -s %{python3_sitelib}/%{name}/%{name}.py %{name}
chmod +x %{buildroot}%{python3_sitelib}/%{name}/%{name}.py
popd

%fdupes -s %{buildroot}

%files
%doc CHANGELOG README.md
%license LICENSE
%{_bindir}/%{name}
%{python3_sitelib}/%{name}

%changelog
openSUSE Build Service is sponsored by