File quisk.spec of Package quisk

#
# spec file for package quisk
#
# Copyright (c) 2019-2023 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/
#

%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150400
%define use_python3 1
%else
%define use_python3 0
%endif

Name:           quisk
Summary:        Software for SDR transceivers
Version:        4.2.25
Release:        1
License:        GPL-2.0
Group:          Productivity/Hamradio/Other
Source:         https://files.pythonhosted.org/packages/source/q/%{name}/%{name}-%{version}.tar.gz
Url:            http://james.ahlstrom.name/%{name}/index.html
BuildRequires:  portaudio-devel
BuildRequires:  fftw3-devel
BuildRequires:  soapy-sdr-devel
BuildRequires:  alsa-devel
%if 0%{use_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-usb
BuildRequires:  python3-setuptools
BuildRequires:  python3-wxWidgets
%else
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python-usb
BuildRequires:  python-wxWidgets
%endif
BuildRequires:  libpulse-devel
BuildRequires:  dos2unix
BuildRequires:  fdupes
BuildRequires:  update-desktop-files
BuildRequires:  hicolor-icon-theme
Requires:       hicolor-icon-theme
%if 0%{use_python3}
Requires:       python3-pip
Requires:       python3-usb
Requires:       python3-wxPython
%else
Requires:       python2-pip
Requires:       python-usb
Requires:       wxPython
%endif

%description
This is Quisk, a Software Defined Radio (SDR). You supply an antenna, a complex
(I/Q) mixer to convert radio spectrum to a low IF, and send that IF to the left
and right inputs of the sound card in your computer. The Quisk software will
read the sound card data, tune it, filter it, demodulate it, and send the audio
to headphones or speakers. Quisk has a microphone input and a key input so it
can operate as a complete transceiver. Quisk works with this hardware:
* SoftRock connected to the sound card
* Many other SDR's connected to the sound card
* SDR-IQ connected by USB
* N2ADR hardware connected by Ethernet and IP
* HiQSDR hardware connected by Ethernet and IP
Quisk can be used as a pan adapter, and can control some radios.
Quisk is small and simple, and has been designed so that it is easy to change
Quisk to suit your own hardware. Quisk rhymes with "brisk", and is QSK plus a
few letters to make it easier to pronounce. QSK is a Q signal meaning full
breakin CW operation, and Quisk has been designed for low latency. Quisk
includes an input keying signal that can mute the audio and substitute a sidetone.


%prep
%setup -q

# with 4.0.0 all files got executable bit set
chmod a-x *.html
chmod a-x *.txt
chmod a-x */*.txt
chmod a-x PKG-INFO
chmod a-x quisk.egg-info/PKG-INFO
dos2unix afedrinet/sdr_control.py

#remove prebuilt binaries
rm -rf soapypkg/build


%build
%if 0%{use_python3}
%python3_build
%else
%python2_build
%endif


%install
%if 0%{use_python3}
%python3_install
%fdupes %{buildroot}%{python3_sitearch}/%{name}
%else
%python2_install
%fdupes %{buildroot}%{python_sitearch}/%{name}
%endif

find %{buildroot}%{_libdir}/python*/site-packages/ -name '*.pyo' -exec rm {} \;
rm -rf %{buildroot}%{_datadir}/doc/%{name}

#create desktop file
cat << EOF > %{name}.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Quisk
GenericName=Quisk
Type=Application
Comment=Software Defined Radio
Exec=quisk
StartupNotify=false
Icon=
Categories=HamRadio;
EOF

mkdir -p %{buildroot}%{_datadir}/applications
cp %{name}.desktop %{buildroot}%{_datadir}/applications
%suse_update_desktop_file %{name} Network

# remove unnedeed files
%if 0%{use_python3}
rm %{buildroot}%{python3_sitearch}/%{name}/*.txt
rm %{buildroot}%{python3_sitearch}/%{name}/*.dll
rm %{buildroot}%{python3_sitearch}/%{name}/freedvpkg/*.dll
rm %{buildroot}%{python3_sitearch}/%{name}/freedvpkg/*.so
%else
rm %{buildroot}%{python_sitearch}/%{name}/*.txt
rm %{buildroot}%{python_sitearch}/%{name}/*.dll
rm %{buildroot}%{python_sitearch}/%{name}/freedvpkg/*.dll
rm %{buildroot}%{python_sitearch}/%{name}/freedvpkg/*.so
%endif


%files
%{_bindir}/%{name}
%{_bindir}/%{name}_vna
%doc CHANGELOG.txt libusb.txt PKG-INFO
%if 0%{?suse_version} >= 1330
%license license.txt
%else
%doc license.txt
%endif
%{_datadir}/applications/%{name}.desktop
%if 0%{use_python3}
%{python3_sitearch}/*.egg-info
%{python3_sitearch}/%{name}
%else
%{python_sitearch}/*.egg-info
%{python_sitearch}/%{name}
%endif


%changelog
openSUSE Build Service is sponsored by