File bCNC.spec of Package bCNC
#
# spec file for package bCNC
#
# Copyright (c) 2025 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: bCNC
Version: 0.9.15~git20250515
Release: 0
Summary: CNC G-Code sender
License: GPL-2.0-only AND BSD-3-Clause AND MIT
URL: https://github.com/vlachoudis/bCNC
Source0: bCNC-%{version}.tar.xz
Source1: bCNC.svg
# PATCH-FIX-OPENSUSE
Patch0: 0001-Make-SHX-font-support-optional.patch
BuildRequires: fdupes
BuildRequires: hicolor-icon-theme
BuildRequires: python-rpm-macros
Requires: python3-Pillow-tk
Requires: python3-tk
Requires: %{python3_dist pyserial}
Requires: %{python3_dist svgelements}
Requires: %{python3_dist numpy}
# Faster processing
Recommends: %{python3_dist scipy}
# Webcam support
Recommends: python3-opencv
# SHX fonts
Recommends: python3-shxparser
BuildArch: noarch
%description
GRBL CNC command sender, autoleveler, g-code editor, digitizer, CAM and
swiss army knife for all your CNC needs.
%prep
%autosetup -p1
sed -i -e '1 {/^#!.*/ d}' bCNC/plugins/*py bCNC/lib/*py bCNC/*py
%build
# nothing to do
%install
# Cleanup
rm bCNC/bCNC{,.ico,.bat,.xbm} bCNC/make-exe.bat
# Wrapper
install -d -m 755 %{buildroot}%{_bindir}
cat <<EOF > %{buildroot}%{_bindir}/bCNC
#! /usr/bin/python3
import runpy
runpy.run_module('bCNC', run_name='__main__')
EOF
chmod 755 %{buildroot}%{_bindir}/bCNC
install -D -m 644 %{S:1} %{buildroot}/%{_datadir}/icons/hicolor/scalable/apps/bCNC.svg
install -d -m 755 %{buildroot}%{_datadir}/applications/
sed -i -e 's/Icon=.*/Icon=bCNC/; s/Terminal=.*/Terminal=false/' bCNC/bCNC.desktop
mv bCNC/bCNC.desktop %{buildroot}/%{_datadir}/applications/bCNC.desktop
chmod 644 %{buildroot}/%{_datadir}/applications/bCNC.desktop
install -d -m 755 %{buildroot}%{python3_sitelib}/
cp -R bCNC %{buildroot}/%{python3_sitelib}/
%python3_compile
%fdupes %{buildroot}/%{python3_sitelib}/
%files
%license LICENSE.*
%doc CHANGELOG.md README.md
%{_bindir}/*
%{python3_sitelib}/bCNC
%{_datadir}/applications/bCNC.desktop
%{_datadir}/icons/hicolor/*/*
%changelog