Blob Blame History Raw
Name:           cura-lulzbot
Version:        21.00
Release:        2%{?dist}
Summary:        Cura LulzBot Edition, 3D printer control software
# Code is AGPLv3
# Example models are CC-BY-SA
License:        AGPLv3 and CC-BY-SA
URL:            https://www.lulzbot.com/cura
# This is no longer hosted on Github :(
# So I did:
#  git clone https://code.alephobjects.com/diffusion/CURA/cura.git
#  cd cura
#  git checkout lulzbot-%{version}
#  git archive --format=tar.gz --prefix=cura-lulzbot-%{version}/ lulzbot-%{version} > ../cura-lulzbot-%{version}.tar.gz
Source0:        %{name}-%{version}.tar.gz
Source1:        %{name}
Source2:        %{name}.desktop

# Use system paths and make it parallel installable with cura
Patch1:         %{name}-system-paths.patch

# Rework the logic of determining the version (didn't work)
Patch2:         %{name}-version.patch

# Disable installation of firmwares Fedora doesn't ship
Patch3:         %{name}-20.01-no-firmware.patch

# Open directories with xdg-open
# https://bugzilla.redhat.com/show_bug.cgi?id=1217961
Patch4:         %{name}-xdg-open.patch

BuildArch:      noarch
BuildRequires:  python2-devel
BuildRequires:  dos2unix
BuildRequires:  desktop-file-utils
BuildRequires:  gettext
Requires:       PyOpenGL
Requires:       wxPython
Requires:       pyserial
Requires:       numpy
Requires:       python-power
Requires:       CuraEngine >= 15.04
# So that it just works
Requires:	3dprinter-udev-rules
# Pull in firmware built from source
Requires:	lulzbot-marlin-firmware >= 20.03

%description
The default software for the LulzBot Mini 3D printer is called Cura LulzBot
Edition. Cura is a Free Software program that both prepares your files for
printing (by converting your model into GCODE), and also allows you to control
the operation of your LulzBot 3D printer.


%prep
%setup -q
%patch1 -p1
%patch2 -p1
# should not need this anymore
# %patch3 -p1 -b .nofw
%patch4 -p1

# invalid locale not able to compile
rm resources/locale/zh -rf

dos2unix resources/example/Attribution.txt

sed -i 's/REPLACE_THIS_IN_SPEC/%{version}/' Cura/util/version.py

# remove shebang
sed -i '1d' Cura/cura.py
sed -i '1d' Cura/util/pymclevel/mce.py

# Remove firmware
rm resources/firmware/*

# Rename icon
mv resources/cura{,-lulzbot}.ico

# Relocate imports - don't write patch for this, as this sed needs no rebasing ;)
find -name \*.py -exec sed -i \
  -e 's/from Cura import/from CuraLulzbot import/g' \
  -e 's/from Cura\./from CuraLulzbot./g' \
  -e 's/Cura.serialCommunication/CuraLulzbot.serialCommunication/g' \
  -e 's/import Cura/import CuraLulzbot/g' {} \;

%build
# rebuild locales
cd resources/locale
mv po pl # polish code was wrong
rm *.in *.pot
for FILE in *; do
  rm $FILE/LC_MESSAGES/Cura.mo
  msgfmt $FILE/LC_MESSAGES/Cura.po -o $FILE/LC_MESSAGES/CuraLulzbot.mo
  rm $FILE/LC_MESSAGES/Cura.po
done
cd -

%install
mkdir -p %{buildroot}%{python_sitelib}/CuraLulzbot
mkdir -p %{buildroot}%{_datadir}/%{name}
mkdir -p %{buildroot}%{_datadir}/pixmaps
mkdir -p %{buildroot}%{_datadir}/locale
mkdir -p %{buildroot}%{_bindir}

cp -apr Cura/* %{buildroot}%{python_sitelib}/CuraLulzbot
rm -rf %{buildroot}%{python_sitelib}/CuraLulzbot/LICENSE
cp -apr resources/* %{buildroot}%{_datadir}/%{name}
cp -apr plugins %{buildroot}%{_datadir}/%{name}
cp -ap %{SOURCE1} %{buildroot}%{_bindir}
ln -s %{_datadir}/%{name} %{buildroot}%{python_sitelib}/CuraLulzbot/resources
ln -s %{_datadir}/%{name}/%{name}.ico %{buildroot}%{_datadir}/pixmaps

# locales
cp -ar %{buildroot}%{_datadir}/%{name}/locale/* %{buildroot}%{_datadir}/locale
rm -rf %{buildroot}%{_datadir}/%{name}/locale
ln -s -f %{_datadir}/locale/ %{buildroot}%{_datadir}/%{name}/ # the app expects the locale folder in here

desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE2}

%{find_lang} CuraLulzbot

%files -f CuraLulzbot.lang
%license Cura/LICENSE resources/example/Attribution.txt
%{python_sitelib}/CuraLulzbot
%{_datadir}/%{name}
%{_datadir}/pixmaps/%{name}.ico
%{_datadir}/applications/%{name}.desktop
%{_bindir}/%{name}

%changelog
* Thu Nov 03 2016 Miro Hrončok <mhroncok@redhat.com> - 21.00-2
- Explicitly run cura on X11 GDK backend (#1388953)

* Fri Sep 30 2016 Tom Callaway <spot@fedoraproject.org> - 21.00-1
- update to 21.00

* Wed Aug 31 2016 Tom Callaway <spot@fedoraproject.org> - 20.03-2
- fix mini firmware version

* Wed Aug 31 2016 Tom Callaway <spot@fedoraproject.org> - 20.03-1
- update to 20.03

* Thu Jul 28 2016 Tom Callaway <spot@fedoraproject.org> - 20.01-1
- update to 20.01

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 19.12-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Sun May 01 2016 Miro Hrončok <mhroncok@redhat.com> - 19.12-1
- update to 19.12

* Tue Apr 12 2016 Miro Hrončok <mhroncok@redhat.com> - 19.08-1
- update to 19.08

* Fri Mar 18 2016 Tom Callaway <spot@fedoraproject.org> - 19.05-1
- update to 19.05

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 19.01-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Fri Jan 08 2016 Tom Callaway <spot@fedoraproject.org> - 19.01-1
- update to 19.01

* Sun Oct 04 2015 Miro Hrončok <mhroncok@redhat.com> - 17.10-1
- Update to 17.10 (different version scheme, but forwarding, no need for epoch)
- No longer hosted on Github
- Remove merged patches

* Wed Jul 08 2015 Miro Hrončok <mhroncok@redhat.com> - 15.02.1.1.03-3
- No longer depend on pypy
- Simplify the launcher

* Wed Jul 08 2015 Miro Hrončok <mhroncok@redhat.com> - 15.02.1.1.03-2
- Fix endless loop of wizards (#1231624)
- Fix version string in version.py

* Mon Jul 06 2015 Miro Hrončok <mhroncok@redhat.com> - 15.02.1.1.03-1
- Update to 15.02.1-1.03

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 14.12-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Fri May 29 2015 Miro Hrončok <mhroncok@redhat.com> - 14.12-5
- Patch: Open directories with xdg-open (#1217961)

* Mon Apr 20 2015 Miro Hrončok <mhroncok@redhat.com> - 14.12-4
- Handle files from the command line (#1213220)

* Wed Apr 01 2015 Miro Hrončok <mhroncok@redhat.com> - 14.12-3
- Update the no firmware patch according to communication with Cura upstream

* Wed Mar 25 2015 Tom Callaway <spot@fedoraproject.org> - 14.12-2
- fix one missing CuraLulzbot invoke

* Wed Feb 04 2015 Miro Hrončok <mhroncok@redhat.com> - 14.12-1
- Initial package (started as cura.spec fork)