From b631bce2b048ea4e9897a559044c8a08e98beef9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Wed, 17 May 2017 00:05:52 +0200 Subject: [PATCH] - fix fonts dir - use patches in favour of sed hacks - all printers work now - rel 4 --- cura.spec | 55 ++++++++++++++++++------------------------------- desktop.patch | 22 ++++++++++++++++++++ locale.patch | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ test.patch | 41 ++++++++++++++++++++++++++++++++++++ 4 files changed, 140 insertions(+), 35 deletions(-) create mode 100644 desktop.patch create mode 100644 locale.patch create mode 100644 test.patch diff --git a/cura.spec b/cura.spec index c2840d4..a0cae38 100644 --- a/cura.spec +++ b/cura.spec @@ -1,10 +1,7 @@ -# -# TODO: find out why all Ultimaker printers later than 2 cannot be added -# Summary: 3D printer control software Name: cura Version: 2.5.0 -Release: 3 +Release: 4 Epoch: 1 Group: Applications/Engineering # Code is AGPLv3 @@ -17,10 +14,12 @@ Source0: https://github.com/Ultimaker/Cura/archive/%{version}/%{name}-%{version} Source1: https://github.com/Ultimaker/fdm_materials/archive/%{version}/fdm_materials-%{version}.tar.gz # Source1-md5: bf8f25394273d7b6333a856b6a1c94ce Patch0: plugins-path.patch +Patch1: desktop.patch +Patch2: locale.patch +Patch3: test.patch URL: https://ultimaker.com/en/products/cura-software BuildRequires: cmake BuildRequires: desktop-file-utils -BuildRequires: dos2unix BuildRequires: gettext BuildRequires: gettext-tools BuildRequires: python3-Uranium = %{version} @@ -55,37 +54,23 @@ for printing. %prep %setup -q -n Cura-%{version} -a1 %patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 -# The setup.py is only useful for py2exe, remove it, so noone is tempted to use it -rm setup.py +# Invalid locale names ptbr and jp +%{__mv} resources/i18n/{ptbr,pt_BR} +%{__mv} resources/i18n/{jp,ja} -# https://github.com/Ultimaker/Cura/issues/1784 -sed -i 's/Version=1/Version=1.1/' cura.desktop.in +# The setup.py is only useful for py2exe, remove it, so noone is tempted to use it +%{__rm} setup.py # Upstream installs to lib/python3/dist-packages -# We want to install to %%{py3_sitescriptdir} -sed -i 's|lib/python${PYTHON_VERSION_MAJOR}/dist-packages|%(echo %{py3_sitescriptdir} | sed -e s@%{_prefix}/@@)|g' CMakeLists.txt - -# Wrong end of line encoding -dos2unix docs/How_to_use_the_flame_graph_profiler.md +# We want to install to %{py3_sitescriptdir} +%{__sed} -i 's|lib/python${PYTHON_VERSION_MAJOR}/dist-packages|%(echo %{py3_sitescriptdir} | sed -e s@%{_prefix}/@@)|g' CMakeLists.txt # Wrong shebang -sed -i '1s=^#!%{_bindir}/\(python\|env python\)3*=#!%{__python3}=' cura_app.py - -# Invalid locale name ptbr -# https://github.com/Ultimaker/Uranium/issues/246 -mv resources/i18n/{ptbr,pt_BR} -sed -i 's/"Language: ptbr\\n"/"Language: pt_BR\\n"/' resources/i18n/pt_BR/*.po - -mv resources/i18n/{jp,ja} -sed -i 's/"Language: jp\\n"/"Language: ja\\n"/' resources/i18n/ja/*.po - -# Failing test, mixes sets and lists :( -# Changed in master, not reporting to upstream -sed -i -e '0,/set()/{s/set()/[]/}' \ - -e 's/{/[/g' \ - -e 's/}/]/g' \ - tests/TestMachineAction.py +%{__sed} -i '1s=^#!%{_bindir}/\(python\|env python\)3*=#!%{__python3}=' cura_app.py %build mkdir build @@ -109,14 +94,14 @@ rm -rf $RPM_BUILD_ROOT %{__make} -C fdm_materials-%{version}/build install DESTDIR=$RPM_BUILD_ROOT # Sanitize the location of locale files -mv $RPM_BUILD_ROOT%{_datadir}/{cura/resources/i18n,locale} +%{__mv} $RPM_BUILD_ROOT%{_datadir}/{cura/resources/i18n,locale} ln -s ../../locale $RPM_BUILD_ROOT%{_datadir}/cura/resources/i18n -rm $RPM_BUILD_ROOT%{_localedir}/*/*.po -rm $RPM_BUILD_ROOT%{_localedir}/*.pot +%{__rm} $RPM_BUILD_ROOT%{_localedir}/*/*.po +%{__rm} $RPM_BUILD_ROOT%{_localedir}/*.pot # Unbundle fonts -rm -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/resources/themes/cura/fonts/ -ln -s %{_datadir}/fonts/open-sans/ $RPM_BUILD_ROOT%{_datadir}/%{name}/resources/themes/cura/fonts +%{__rm} -r $RPM_BUILD_ROOT%{_datadir}/%{name}/resources/themes/cura/fonts/ +ln -s %{_datadir}/fonts/TTF $RPM_BUILD_ROOT%{_datadir}/%{name}/resources/themes/cura/fonts %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir} %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir} diff --git a/desktop.patch b/desktop.patch new file mode 100644 index 0000000..e35ba4f --- /dev/null +++ b/desktop.patch @@ -0,0 +1,22 @@ +From 47e1b2a22a55c381ca1f9ee0f1e8bb69d0ee0b19 Mon Sep 17 00:00:00 2001 +From: awhiemstra +Date: Wed, 3 May 2017 15:55:11 +0200 +Subject: [PATCH] Remove Version field from Desktop file + +Apparently, it is not a required field and we specify an incorrect version. + +See also https://github.com/Ultimaker/Cura/issues/1784 +--- + packaging/cura.desktop | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/cura.desktop.in b/packaging/cura.desktop.in +index f7ca1ed..07de903 100755 +--- a/cura.desktop.in ++++ b/cura.desktop.in +@@ -1,5 +1,4 @@ + [Desktop Entry] +-Version=1 + Name=Cura + Name[de]=Cura + GenericName=3D Printing Software diff --git a/locale.patch b/locale.patch new file mode 100644 index 0000000..942c176 --- /dev/null +++ b/locale.patch @@ -0,0 +1,57 @@ +diff -ur Cura-2.5.0.orig/resources/i18n/jp/cura.po Cura-2.5.0/resources/i18n/jp/cura.po +--- Cura-2.5.0.orig/resources/i18n/jp/cura.po 2017-04-21 13:30:29.000000000 +0200 ++++ Cura-2.5.0/resources/i18n/jp/cura.po 2017-05-16 23:32:17.865805984 +0200 +@@ -11,7 +11,7 @@ + "PO-Revision-Date: 2017-04-03 10:30+1000\n" + "Last-Translator: Ultimaker's Japanese Sales Partner \n" + "Language-Team: Ultimaker's Japanese Sales Partner \n" +-"Language: jp\n" ++"Language: ja\n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=UTF-8\n" + "Content-Transfer-Encoding: 8bit\n" +diff -ur Cura-2.5.0.orig/resources/i18n/ptbr/cura.po Cura-2.5.0/resources/i18n/ptbr/cura.po +--- Cura-2.5.0.orig/resources/i18n/ptbr/cura.po 2017-04-21 13:30:29.000000000 +0200 ++++ Cura-2.5.0/resources/i18n/ptbr/cura.po 2017-05-16 23:32:17.859139149 +0200 +@@ -12,7 +12,7 @@ + "PO-Revision-Date: 2017-04-09 18:00-0300\n" + "Last-Translator: Cláudio Sampaio \n" + "Language-Team: LANGUAGE \n" +-"Language: ptbr\n" ++"Language: pt_BR\n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=UTF-8\n" + "Content-Transfer-Encoding: 8bit\n" +@@ -1138,7 +1138,7 @@ + "PO-Revision-Date: 2017-01-23 13:30-0300\n" + "Last-Translator: Cláudio Sampaio \n" + "Language-Team: LANGUAGE \n" +-"Language: ptbr\n" ++"Language: pt_BR\n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=UTF-8\n" + "Content-Transfer-Encoding: 8bit\n" +diff -ur Cura-2.5.0.orig/resources/i18n/ptbr/fdmextruder.def.json.po Cura-2.5.0/resources/i18n/ptbr/fdmextruder.def.json.po +--- Cura-2.5.0.orig/resources/i18n/ptbr/fdmextruder.def.json.po 2017-04-21 13:30:29.000000000 +0200 ++++ Cura-2.5.0/resources/i18n/ptbr/fdmextruder.def.json.po 2017-05-16 23:32:17.859139149 +0200 +@@ -7,7 +7,7 @@ + "PO-Revision-Date: 2017-04-10 09:05-0300\n" + "Last-Translator: Cláudio Sampaio \n" + "Language-Team: LANGUAGE\n" +-"Language: ptbr\n" ++"Language: pt_BR\n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=UTF-8\n" + "Content-Transfer-Encoding: 8bit\n" +diff -ur Cura-2.5.0.orig/resources/i18n/ptbr/fdmprinter.def.json.po Cura-2.5.0/resources/i18n/ptbr/fdmprinter.def.json.po +--- Cura-2.5.0.orig/resources/i18n/ptbr/fdmprinter.def.json.po 2017-04-21 13:30:29.000000000 +0200 ++++ Cura-2.5.0/resources/i18n/ptbr/fdmprinter.def.json.po 2017-05-16 23:32:17.862472567 +0200 +@@ -6,7 +6,7 @@ + "PO-Revision-Date: 2017-04-10 19:00-0300\n" + "Last-Translator: Cláudio Sampaio \n" + "Language-Team: LANGUAGE\n" +-"Language: ptbr\n" ++"Language: pt_BR\n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=UTF-8\n" + "Content-Transfer-Encoding: 8bit\n" diff --git a/test.patch b/test.patch new file mode 100644 index 0000000..2756847 --- /dev/null +++ b/test.patch @@ -0,0 +1,41 @@ +diff -ur Cura-2.5.0.orig/tests/TestMachineAction.py Cura-2.5.0/tests/TestMachineAction.py +--- Cura-2.5.0.orig/tests/TestMachineAction.py 2017-04-21 13:30:29.000000000 +0200 ++++ Cura-2.5.0/tests/TestMachineAction.py 2017-05-17 00:02:31.273106246 +0200 +@@ -30,19 +30,19 @@ + machine_manager.addMachineAction(test_action) + + # Check that the machine has no supported actions yet. +- assert machine_manager.getSupportedActions(test_machine) == set() ++ assert machine_manager.getSupportedActions(test_machine) == [] + + # Check if adding a supported action works. + machine_manager.addSupportedAction(test_machine, "test_action") +- assert machine_manager.getSupportedActions(test_machine) == {test_action} ++ assert machine_manager.getSupportedActions(test_machine) == [test_action] + + # Check that adding a unknown action doesn't change anything. + machine_manager.addSupportedAction(test_machine, "key_that_doesnt_exist") +- assert machine_manager.getSupportedActions(test_machine) == {test_action} ++ assert machine_manager.getSupportedActions(test_machine) == [test_action] + + # Check if adding multiple supported actions works. + machine_manager.addSupportedAction(test_machine, "test_action_2") +- assert machine_manager.getSupportedActions(test_machine) == {test_action, test_action_2} ++ assert machine_manager.getSupportedActions(test_machine) == [test_action, test_action_2] + + # Check that the machine has no required actions yet. + assert machine_manager.getRequiredActions(test_machine) == set() +@@ -53,11 +53,11 @@ + + ## Check if adding single required action works + machine_manager.addRequiredAction(test_machine, "test_action") +- assert machine_manager.getRequiredActions(test_machine) == {test_action} ++ assert machine_manager.getRequiredActions(test_machine) == [test_action] + + # Check if adding multiple required actions works. + machine_manager.addRequiredAction(test_machine, "test_action_2") +- assert machine_manager.getRequiredActions(test_machine) == {test_action, test_action_2} ++ assert machine_manager.getRequiredActions(test_machine) == [test_action, test_action_2] + + # Ensure that firstStart actions are empty by default. + assert machine_manager.getFirstStartActions(test_machine) == [] -- 2.44.0