Blob Blame History Raw
Name:           cura-lulzbot
Version:        17.10
Release:        1%{?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 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}-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

%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
%patch3 -p1
%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
* 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)