File woeusb-ng.spec of Package woeusb-ng

%global __python  %{__python3}
%global python_sitelib  %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")

%global commit 69a430d7498cf3b2af4f0b86ebb2d108cbc5989a

Name:           woeusb-ng
Summary:        Create a Windows USB stick installer from a real Windows DVD or image
Version:        0.2.10
Release:        1
URL:            https://github.com/WoeUSB/WoeUSB-ng
Source:         https://github.com/WoeUSB/WoeUSB-ng/archive/%{commit}/WoeUSB-ng-%{version}.tar.gz
Patch0:         %{name}-setup.patch
Patch1:         %{name}-policy.patch
License:        GPLv3+
Group:          System/GUI/Other
Requires:       bash
Requires:       dosfstools
Requires:       gawk
Requires:       grep
Requires:       grub2-pc-modules
Requires:       ntfs-3g
Requires:       parted
Requires:       wget
Requires:       wimlib
Requires:       wimlib-utils
Requires:       polkit
Requires:       python3-wxpython4
BuildRequires:  make
BuildRequires:  fdupes
BuildRequires:  polkit
BuildRequires:  python3-setuptools
BuildRequires:  python3-distutils-extra

Recommends:     %{name}-lang
BuildArch:      noarch

%description
A Linux program to create a Windows USB stick installer from a real Windows DVD or image.

This package contains two programs:
- woeusb: A command-line utility that enables you to create your own bootable Windows
          installation USB storage device from an existing Windows Installation disc or
          disk image
- woeusbgui: Graphic version of woeusb

Supported images:
- Windows Vista, Windows 7, Window 8.x, Windows 10.
- All languages and any version (home, pro...) and Windows PE are supported.

Supported bootmodes:
- Legacy/MBR-style/IBM PC compatible bootmode
- Native UEFI booting is supported for Windows 7 and later images (limited to the
  FAT filesystem as the target)
- This project rewrite of original WoeUSB

%lang_package

%prep
%autosetup -n WoeUSB-ng-%{commit} -p1
sed -i -e 's|/usr/bin/env python|/usr/bin/python|g' WoeUSB/{core.py,gui.py,list_devices.py,woeusb,woeusbgui}
sed -i -e 's|Icon=.*|Icon=%{name}|g' miscellaneous/WoeUSB-ng.desktop

%build
%{__python} setup.py build

%install
%{__python} setup.py install --prefix=%{_prefix} --root=%{buildroot} --optimize=2

rm -rf %{buildroot}%{_datadir}/icons/WoeUSB-ng %{buildroot}%{_datadir}/applications/WoeUSB-ng.desktop
chmod 755 %{buildroot}%{python_sitelib}/WoeUSB/{core.py,gui.py,list_devices.py}
install -D -m644 WoeUSB/data/woeusb-logo.png %{buildroot}%{_datadir}/pixmaps/%{name}.png
install -D -m644 miscellaneous/WoeUSB-ng.desktop %{buildroot}%{_datadir}/applications/WoeUSB-ng.desktop
install -D -m644 miscellaneous/com.github.woeusb.%{name}.policy \
                 %{buildroot}%{_datadir}/polkit-1/actions/com.github.woeusb.%{name}.policy
%fdupes %{buildroot}%{python_sitelib}

%find_lang woeusb %{name}.lang

%files -f %{name}.lang
%doc README.md
%license COPYING
%{_bindir}/woeusb
%{_bindir}/woeusbgui
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/applications/*.desktop
%{_datadir}/polkit-1/actions/com.github.woeusb.%{name}.policy
%{python_sitelib}/*

%changelog
* Mon Nov 15 2021 Muhammad Shaban <muhammad.shaban.dev@gmail.com> - 0.2.10-1
- Initial release
openSUSE Build Service is sponsored by