File easyabc.spec of Package easyabc
#
# spec file for package easyabc
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2022 by Edgar Aichinger
#
# 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/
#
Name: easyabc
Version: 1.3.8.7+git.20240305.670dd54
Release: 0
Summary: an open source ABC editor for Windows, OSX and Linux
License: GPL-2.0-only
Group: Productivity/Publishing/Other
URL: http://www.nilsliberg.se/ksp/easyabc/
Source0: EasyABC-%{version}.tar.xz
Source1: %{name}.desktop
BuildRequires: python3-devel
BuildRequires: dos2unix
BuildRequires: hicolor-icon-theme
BuildRequires: fdupes
Requires: abcMIDI
Requires: abcm2ps
Requires: python3-pygame
Requires: python3-pyparsing
Requires: python3dist(wxpython)
Requires: ghostscript
BuildArch: noarch
%description
EasyABC is an open source ABC editor for Windows, OSX and Linux. It
uses abcm2ps and abc2midi, and it has a rich feature list. Most
notably, it can import MusicXML files and export tunes in SVG format.
%lang_package
%prep
%autosetup -p1 -n EasyABC-%{version}
%build
# nothing to do!
%install
#unneeded
rm requirements.txt
rm -rf not\ used/
# create install dir
mkdir -p %{buildroot}%{_datadir}/%{name}
#locale
rm locale/EasyABC.pot
rm locale/*/*/*.po
mv locale %{buildroot}%{_datadir}/
# copy everyting else to buildroot/install dir
cp -r * %{buildroot}%{_datadir}/%{name}
# unneeded, will be added via %doc from source dir
rm %{buildroot}%{_datadir}/%{name}/CHANGES \
%{buildroot}%{_datadir}/%{name}/readme.txt \
%{buildroot}%{_datadir}/%{name}/using_EasyABC_in_Linux.txt
# convert line endings
dos2unix *.txt CHANGES
dos2unix %{buildroot}%{_datadir}/%{name}/*
chmod +x %{buildroot}%{_datadir}/%{name}/abc2xml.py
chmod +x %{buildroot}%{_datadir}/%{name}/easy_abc.py
chmod +x %{buildroot}%{_datadir}/%{name}/xml2abc.py
chmod +x %{buildroot}%{_datadir}/%{name}/abc_character_encoding.py
chmod +x %{buildroot}%{_datadir}/%{name}/midi2abc.py
chmod +x %{buildroot}%{_datadir}/%{name}/setup.py
# fix shebangs
sed -i "s/#!\/usr\/bin\/env python/#!\/usr\/bin\/python3/g" %{buildroot}%{_datadir}/%{name}/abc2xml.py
sed -i "s/#!\/usr\/bin\/env python/#!\/usr\/bin\/python/g" %{buildroot}%{_datadir}/%{name}/easy_abc.py
sed -i "s/#!\/usr\/bin\/env python/#!\/usr\/bin\/python3/g" %{buildroot}%{_datadir}/%{name}/xml2abc.py
sed -i "s/#!\/usr\/bin\/python/#!\/usr\/bin\/python3/g" %{buildroot}%{_datadir}/%{name}/abc_character_encoding.py
sed -i "s/#!\/usr\/bin\/python/#!\/usr\/bin\/python3/g" %{buildroot}%{_datadir}/%{name}/midi2abc.py
# create executable script
mkdir -p %{buildroot}%{_bindir}
echo "#!/bin/sh" > easyabc
echo "python3 %{_datadir}/%{name}/easy_abc.py" >> easyabc
cp easyabc %{buildroot}%{_bindir}
# desktop file integration
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/16x16/apps
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/32x32/apps
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/64x64/apps
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/256x256/apps
cp img/logo16.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/easyabc.png
cp img/logo32.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/easyabc.png
cp img/logo64.png %{buildroot}%{_datadir}/icons/hicolor/64x64/apps/easyabc.png
cp img/logo256.png %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/easyabc.png
mkdir %{buildroot}%{_datadir}/applications
cp %SOURCE1 %{buildroot}%{_datadir}/applications/
%find_lang %{name} %{name}.lang
%fdupes %{buildroot}/%{_datadir}/%{name}
%files -f %{name}.lang
%license LICENSE
%doc CHANGES readme.txt using_EasyABC_in_Linux.txt
%attr(755,root,root) %{_bindir}/easyabc
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/applications/%{name}.desktop
%changelog