Merge lp:~widelands-dev/widelands/bug-1784113-desktop-file-utils into lp:widelands

Proposed by GunChleoc on 2018-07-28
Status: Merged
Merged at revision: 8777
Proposed branch: lp:~widelands-dev/widelands/bug-1784113-desktop-file-utils
Merge into: lp:widelands
Diff against target: 61 lines (+18/-8)
3 files modified
debian/org.widelands.widelands.desktop (+1/-1)
debian/org.widelands.widelands.desktop.stub (+1/-1)
utils/update_appdata.py (+16/-6)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1784113-desktop-file-utils
Reviewer Review Type Date Requested Status
Widelands Developers 2018-07-28 Pending
Review via email: mp+351614@code.launchpad.net

Commit message

Validate .desktop file on translation updates. Removed deprecated category from .desktop file.

To post a comment you must log in.
8773. By GunChleoc on 2018-07-28

Removed superfluous import.

bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3732. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/409261257.
Appveyor build 3532. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1784113_desktop_file_utils-3532.

GunChleoc (gunchleoc) wrote :

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/org.widelands.widelands.desktop'
2--- debian/org.widelands.widelands.desktop 2018-07-06 14:23:53 +0000
3+++ debian/org.widelands.widelands.desktop 2018-07-28 11:31:09 +0000
4@@ -74,4 +74,4 @@
5 Icon=/usr/share/games/widelands/data/images/logos/wl-ico-64.png
6 TryExec=widelands
7 Exec=widelands
8-Categories=Application;Game;StrategyGame;
9+Categories=Game;StrategyGame;
10
11=== modified file 'debian/org.widelands.widelands.desktop.stub'
12--- debian/org.widelands.widelands.desktop.stub 2017-03-10 12:39:34 +0000
13+++ debian/org.widelands.widelands.desktop.stub 2018-07-28 11:31:09 +0000
14@@ -6,4 +6,4 @@
15 Icon=/usr/share/games/widelands/data/images/logos/wl-ico-64.png
16 TryExec=widelands
17 Exec=widelands
18-Categories=Application;Game;StrategyGame;
19+Categories=Game;StrategyGame;
20
21=== modified file 'utils/update_appdata.py'
22--- utils/update_appdata.py 2017-03-10 12:39:34 +0000
23+++ utils/update_appdata.py 2018-07-28 11:31:09 +0000
24@@ -118,8 +118,8 @@
25
26 input_file.close()
27
28-dest_filepath = base_path + '/debian/widelands.appdata.xml'
29-dest_file = codecs.open(dest_filepath, encoding='utf-8', mode='w')
30+appdata_filepath = base_path + '/debian/widelands.appdata.xml'
31+dest_file = codecs.open(appdata_filepath, encoding='utf-8', mode='w')
32 dest_file.write(appdata)
33 dest_file.close()
34
35@@ -135,12 +135,22 @@
36
37 input_file.close()
38
39-dest_filepath = base_path + '/debian/org.widelands.widelands.desktop'
40-dest_file = codecs.open(dest_filepath, encoding='utf-8', mode='w')
41+desktop_filepath = base_path + '/debian/org.widelands.widelands.desktop'
42+dest_file = codecs.open(desktop_filepath, encoding='utf-8', mode='w')
43 dest_file.write(desktop)
44 dest_file.close()
45
46 print('Done!')
47
48-from subprocess import call
49-call(['appstreamcli', 'validate', base_path + '/debian/widelands.appdata.xml'])
50+from subprocess import call, Popen, PIPE
51+
52+# Validata Appdata
53+call(['appstreamcli', 'validate', appdata_filepath])
54+
55+# Validate desktop file. We don't get return codes, so we have to parse it
56+process = Popen(['desktop-file-validate', desktop_filepath], stderr=PIPE, stdout=PIPE, stdin=PIPE)
57+desktop_result = process.communicate()
58+if desktop_result[0] != "":
59+ print(desktop_result[0])
60+ sys.exit(1)
61+