File flatcam.spec of Package flatcam

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


Name:           flatcam
Version:        8.995+git20240709.f86fd937
Release:        0
Summary:        CAM preprocessor for PCB milling
License:        MIT
URL:            http://flatcam.org
Source:         flatcam-%{version}.tar.gz
Patch0:         0001-Make-darkdetect-optional.patch
Patch1:         width_changed_vbox_database_settings.diff
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  python3-numpy
BuildRequires:  python3-PyQt6
BuildRequires:  update-desktop-files
BuildRequires:  libopenjp2-7
BuildRequires:  dbus-1
Requires:       python3-PyQt6
Requires:       python3-Shapely
Requires:       python3-dill
Requires:       python3-ezdxf
Requires:       python3-numpy
Requires:       python3-opengl
Requires:       python3-protobuf
Requires:       python3-pyserial
Requires:       python3-qrcode
Requires:       python3-rasterio
Requires:       python3-rtree
Requires:       python3-simplejson
Requires:       python3-svglib
Requires:       python3-svgpathtools
Requires:       python3-tk
Requires:       python3-vispy
Requires:       hicolor-icon-theme
BuildArch:      noarch

%description
FlatCAM is a program for preparing CNC jobs for making PCBs on a CNC router.
Among other things, it can take a Gerber file generated by your favorite PCB
CAD program, and create G-Code for Isolation routing.


%prep
%autosetup -p1 0 1

find -iname \*.whl -print -delete
find -iname \*.ico -print -delete
rm assets/resources/dark_resources/Makefile

find . -iname \*ParseSVG.py -exec sed -i -e '/import/ s@svg.path@svgpathtools@' '{}' \;

sed -i -e '1 i#!/usr/bin/python3\n' flatcam.py

%build
%nil

%install
mkdir -p %{buildroot}%{_bindir}
ln -s %{python_sitelib}/flatcam/flatcam.py %{buildroot}%{_bindir}/flatcam

mkdir -p %{buildroot}%{python_sitelib}/flatcam/
cp -R app* Bookmark.py camlib.py defaults.py descartes %{buildroot}%{python_sitelib}/flatcam/
cp -R libs %{buildroot}%{python_sitelib}/flatcam/
cp -R locale %{buildroot}%{python_sitelib}/flatcam/
cp -R preprocessors %{buildroot}%{python_sitelib}/flatcam/
cp -R tclCommands %{buildroot}%{python_sitelib}/flatcam/
install -m 755 flatcam.py %{buildroot}%{python_sitelib}/flatcam/

mkdir -p %{buildroot}%{python_sitelib}/flatcam/assets
cp -R assets/resources %{buildroot}%{python_sitelib}/flatcam/assets
cp -R assets/examples %{buildroot}%{python_sitelib}/flatcam/assets

mkdir -p %{buildroot}%{_datadir}/icons/hicolor/
for s in 16 24 32 48 128 256 ; do
    mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps
    ln -s %{python_sitelib}/flatcam/assets/resources/flatcam_icon${s}.png \
        %{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps/flatcam.png
done

%suse_update_desktop_file -c flatcam FlatCAM "PCB CNC Routing" flatcam flatcam Science Engineering
echo "MimeType=application/x-gerber;application/x-excellon;application/x-gerber-job" >> %{buildroot}/%{_datadir}/applications/flatcam.desktop

%fdupes %{buildroot}%{python_sitelib}/flatcam/

%files
%license LICENSE
%{_bindir}/flatcam
%{_datadir}/icons/hicolor/*/apps/*.png
%{_datadir}/applications/flatcam.desktop
%{python_sitelib}/flatcam

%changelog
openSUSE Build Service is sponsored by