Blob Blame History Raw
%global date 20170925
%global vdate %(x=%{date}; echo "${x:0:4}-${x:4:2}-${x:6:2}")
%global py_setup st-setup.py


Name:           dxf2gcode
Version:        %{date}
Release:        1%{?dist}
Summary:        2D drawings to CNC machine compatible G-Code converter
License:        GPLv3+ and MIT
Url:            https://sourceforge.net/p/dxf2gcode/wiki/Home/
Source0:        https://sourceforge.net/projects/%{name}/files/%{name}-%{version}.zip

BuildArch:      noarch

BuildRequires:  /usr/bin/git
BuildRequires:  desktop-file-utils
BuildRequires:  libappstream-glib
BuildRequires:  python3-devel
BuildRequires:  python3-qt5
BuildRequires:  qt5-linguist
%if 0%{?fedora} > 25
BuildRequires:  %{py3_dist pyopengl}
%else
BuildRequires:  python3-pyopengl
%endif

Requires:       /usr/bin/pdftops
Requires:       /usr/bin/pstoedit
Requires:       hicolor-icon-theme
Requires:       python3-qt5
%if 0%{?fedora} > 25
Requires:       %{py3_dist pyopengl}
%else
Requires:       python3-pyopengl
%endif


%description
%{name} is a tool for converting 2D (DXF, PDF, PS) drawings to CNC machine
compatible GCode. It has the following features:
    - Integration in EMC2,
    - Fully adjustable Postprocessor,
    - G0 moves reduction by route optimization,
    - Import of DXF and PDF,
    - Improved accuracy for splines import by Line and Arc's,
    - Mill parameter specification by layers,
    - Drag knife and lathe support,
    - Breaks a.k.a Tabs support,
    - AutoCAD Blocks and Inserts,
    - Multiple tools,
    - Multiple language support: English, German, French, Russian,
    - 3D viewer.


%prep
%autosetup -S git


%build
# regenerate *images5_rc.py and *ui5.py files
python3 ./make_py_uic.py 5
# regenerate translation files
lrelease-qt5 i18n/*.ts
%py3_build


%install
%py3_install
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/*.appdata.xml
%find_lang %{name} --with-qt --without-mo


%post
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :


%postun
if [ $1 -eq 0 ] ; then
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi


%posttrans
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


%files -f %{name}.lang
%license COPYING
%doc README.txt
%{_bindir}/%{name}
%{python3_sitelib}/*
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/i18n
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*
%{_datadir}/appdata/*.appdata.xml


%changelog
* Mon Sep 25 2017 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 20170925-1
- Update to the lastest available version.

* Thu Sep 14 2017 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 20170915-1
- Drop upstream patches,
- Use tarball generated by python3 st-setup.py sdist

* Tue Sep 12 2017 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 20170503-2
- Add upstream fixes.

* Wed Sep 06 2017 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 20170503-1
- Initial RPM release.