Blob Blame Raw
%global date 20180606
%global commit0 46454c293a9b390c931b52eb6217ca47e13b0231
%global shortcommit0 %(c=%{commit0}; echo ${c:0:12})

%global date_year  %(c=%{date}; printf %d ${c:0:4})
%global date_month %(c=%{date}; printf %d ${c:4:2})
%global date_day   %(c=%{date}; printf %d ${c:6:2})

%global the_owner jpcgt

Name:           flatcam
Version:        8.5
Release:        17.%{date}git%{shortcommit0}%{?dist}
Summary:        2D Computer-Aided PCB Manufacturing
License:        MIT
Url:            http://flatcam.org/
Source0:        https://bitbucket.org/%{the_owner}/%{name}/get/%{commit0}.tar.gz#/%{name}-%{shortcommit0}.tar.gz
# Reported upstream as: https://bitbucket.org/jpcgt/flatcam/pull-requests/74
Patch0:         https://bitbucket.org/dwrobel/%{name}/commits/bf0c59ba2b9c78815270607f6d814e93af410cf8/raw#/%{name}.appdata.xml
# Reported upstream as: https://bitbucket.org/jpcgt/flatcam/pull-requests/125
Patch1:         https://bitbucket.org/dwrobel/flatcam/commits/0d2cb7e53e629a1c8d5ba790752e4a4d605065bc/raw#/%{name}-setup-update.patch
# Disable checks for the latest version of the program
Patch2:         https://bitbucket.org/dwrobel/flatcam/commits/002a69f71632a3bb2d71302b24aae6b4d449557d/raw#/%{name}-disable-checks-for-the-latest-version-of-the-program.patch
BuildArch:      noarch

BuildRequires:  /usr/bin/git
BuildRequires:  python3-devel
BuildRequires:  desktop-file-utils
BuildRequires:  libappstream-glib

Requires:       %{py3_dist simplejson}
Requires:       python3-PyQt4
Requires:       %{py3_dist numpy}
Requires:       %{py3_dist scipy}
Requires:       python3-svg-path
Requires:       %{py3_dist matplotlib}
Requires:       python3-matplotlib-qt4
Requires:       %{py3_dist rtree}
Requires:       %{py3_dist shapely}
Requires:       hicolor-icon-theme


%description
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 -S git -n %{the_owner}-%{name}-%{shortcommit0}
rm -f setup_ubuntu.sh setup_ubuntu.sh upgrade_geos.sh

# Update version string in About menu
sed -i -e "s/\(\"number\":\).*/\1 \"git-%{shortcommit0}\",/g" \
       -e "s/\(\"date\":\).*/\1 \(%{date_year}, %{date_month}, %{date_day}\),/g" \
    FlatCAMVersion.py


%build
%py3_build


%install
%py3_install

# install icon file
install -d %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/
ln -sfr %{buildroot}%{_datadir}/%{name}/%{name}_icon128_inv.png %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/%{name}.png

# install desktop file
install -p -D %{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop

# install and validate appdata
install -p -m 0644 -D %{name}.appdata.xml %{buildroot}/%{_datadir}/appdata/%{name}.appdata.xml
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/*.appdata.xml

%files
%license LICENSE
%doc README.md
%{_bindir}/%{name}
%{python3_sitelib}/*
%dir %{_datadir}/%{name}/
%{_datadir}/%{name}/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*
%{_datadir}/appdata/*.appdata.xml


%changelog
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 8.5-17.20180606git46454c293a9b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 8.5-16.20180606git46454c293a9b
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 8.5-15.20180606git46454c293a9b
- Rebuilt for Python 3.8

* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 8.5-14.20180606git46454c293a9b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 8.5-13.20180606git46454c293a9b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Sun Dec 09 2018 Miro Hrončok <mhroncok@redhat.com> - 8.5-12.20180606git46454c293a9b
- Require python3-PyQt4 instead of (python2-)PyQt4

* Sat Sep 08 2018 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 8.5-11.20180606git46454c293a9b
- Update to the latest version
- Switch to python3

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 8.5-10.20170701gita9a4ec75db12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 8.5-9.20170701gita9a4ec75db12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Jan 11 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 8.5-8.20170701gita9a4ec75db12
- Remove obsolete scriptlets

* Sat Aug 26 2017 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 8.5-7.20170701gita9a4ec75db12
- Use non-versioning Requires: for python-svg-path.

* Thu Aug 24 2017 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 8.5-6.20170701gita9a4ec75db12
- Add direct Requires instead of %%{py2_dist svg-path} macro.

* Thu Aug 24 2017 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 8.5-5.20170701gita9a4ec75db12
- Switch to use python2dist macros,
- Add upstream link to AppData patch.

* Tue Aug 22 2017 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 8.5-4.20170701gita9a4ec75db12
- Drop patches upstream merged,
- Add AppData metadata.

* Wed May 31 2017 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 8.5-3.20170519git58f66ca8664b
- Install .desktop and icons files.

* Sat May 27 2017 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 8.5-2.20170519git58f66ca8664b
- Fix startup script.

* Tue May 23 2017 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 8.4.20151026-1
- Initial RPM release.