File awlsim.spec of Package awlsim

#
# spec file for package awlsim
#
# Copyright (c) 2022 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/
#


# See also http://en.opensuse.org/openSUSE:Packaging_Python
Name:           awlsim
Version:        0.77.1
Release:        0
Summary:        Free Step 7 AWL/STL/PLC simulator
License:        GPL-2.0-only
Group:          Development/Languages/Python
URL:            https://bues.ch/cms/hacking/awlsim.html
Source0:        http://bues.ch/awlsim/%{name}-%{version}.tar.xz
Source1:        %{name}.desktop
Source100:      %{name}-rpmlintrc
BuildRequires:  desktop-file-utils
BuildRequires:  dos2unix
BuildRequires:  unzip
BuildRequires:  update-desktop-files
BuildRequires:  python3-Cython
BuildRequires:  python3-devel >= 3.4
BuildRequires:  python3-setuptools
BuildRequires:  python3-xml
Requires:       python3-pyside2

%description
Awlsim is a free Step 7 AWL/STL/PLC simulator written in Python.
Depending on the host machine and the Python interpreter used,
it achieves good performance of several thousand to millions of AWL/STL instructions per second.
German and english AWL/STL mnemonics are supported.
The current focus is the S7-3xx and S7-4xx family of PLC CPUs (2 and 4 accu).

%prep
%setup -q
dos2unix COPYING.txt

%build
%if 0%{?suse_version} >= 1600
echo "Building without cython."
export AWLSIM_CYTHON_BUILD=0
%else
echo "Building with cython."
export AWLSIM_CYTHON_BUILD=1
%endif
# Remove CFLAGS=... for noarch packages (unneeded)
CFLAGS="%{optflags}" python3 setup.py build

%install
python3 setup.py install --prefix=%{_prefix} --root %{buildroot}
#Install desktop file
mkdir -p %{buildroot}%{_datadir}/applications/
cp %{SOURCE1} %{buildroot}%{_datadir}/applications/
%if 0%{?suse_version} <= 1600
  %suse_update_desktop_file %{name}
%else
  desktop-file-install --add-category="Emulator" --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}
%endif
%python3_fix_shebang

%files
%doc COMPATIBILITY.html COMPATIBILITY.md README.html README.md TODO.html TODO.md QUICK-START.html QUICK-START.md
%license COPYING.txt
%{python3_sitearch}/*
%{_bindir}/awlsim*
%{_datadir}/applications/%{name}.desktop

%changelog
openSUSE Build Service is sponsored by