Merge lp:~dpm/gui-ufw/improve-i18n into lp:gui-ufw/gufw-10.10

Proposed by costales
Status: Merged
Approved by: costales
Approved revision: 36
Merged at revision: 36
Proposed branch: lp:~dpm/gui-ufw/improve-i18n
Merge into: lp:gui-ufw/gufw-10.10
Diff against target: 586 lines (+275/-134) (has conflicts)
11 files modified
bin/gufw (+2/-2)
data/ui/gufw.glade (+8/-7)
gufw.desktop.in (+4/-53)
gufw/__init__.py (+1/-0)
gufw/gufwconfig.py (+58/-0)
gufw/model/__init__.py (+1/-0)
gufw/view/__init__.py (+1/-0)
gufw/view/guiGufw.py (+16/-13)
man/gufw.8 (+96/-0)
po/POTFILES.in (+3/-0)
setup.py (+85/-59)
Conflict: can't delete locale-langpack because it is not empty.  Not deleting.
Conflict because locale-langpack is not versioned, but has versioned children.  Versioned directory.
To merge this branch: bzr merge lp:~dpm/gui-ufw/improve-i18n
Reviewer Review Type Date Requested Status
costales Approve
Review via email: mp+37511@code.launchpad.net

This proposal supersedes a proposal from 2010-08-21.

Description of the change

= Improve i18n handling and use a more standard build system layout =

This branch provides some improvements to the build system and to the handling of translations. Here are some of them:

* Use more standard locations for data and code. Using python-distutils-extra helps simplifying the setup.py file
* Instead of using the binary mo files, translations should be built from the PO files before each release. Now there is a command to build and test translations: 'python setup.py build_i18n' will build the PO file translations into MO binary files inside the build/ directory. 'python setup.py sdist' will properly include the translations when preparing a tarball for release. Finally, the debian package will also do the right thing, and include the PO files in the source package and install mo files.
* Now there are no hardcoded paths in the code, meaning that the upstream code is not Ubuntu specific and can be built for every distribution.

If you accept these suggestions, we can then go on to enable automatic imports and exports of translations in Launchpad, which would make your life as a maintainer a lot easier while managing translations. It shouldn't take more than five minutes, and we can do it over IRC.

I hope you find this branch useful, and good work with gufw!

To post a comment you must log in.
Revision history for this message
costales (costales) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
costales (costales) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed directory 'Alacarte_menu'
2=== renamed directory 'global_command' => 'bin'
3=== modified file 'bin/gufw'
4--- global_command/gufw 2010-06-13 09:22:18 +0000
5+++ bin/gufw 2010-10-04 19:55:55 +0000
6@@ -1,4 +1,4 @@
7 #!/bin/bash
8 # This script starts Gufw from the console
9-su-to-root -X -c /usr/share/gufw/gufw.py
10-
11+# FIXME: This is a hack. The executable path should not be hardcoded
12+su-to-root -X -c 'python /usr/share/pyshared/gufw/gufw.py'
13
14=== added directory 'data'
15=== renamed directory 'icon' => 'data/media'
16=== renamed file 'pixmaps/allow_allow.png' => 'data/media/allow_allow.png'
17=== renamed file 'pixmaps/allow_deny.png' => 'data/media/allow_deny.png'
18=== renamed file 'pixmaps/allow_disable.png' => 'data/media/allow_disable.png'
19=== renamed file 'pixmaps/allow_reject.png' => 'data/media/allow_reject.png'
20=== renamed file 'pixmaps/deny_allow.png' => 'data/media/deny_allow.png'
21=== renamed file 'pixmaps/deny_deny.png' => 'data/media/deny_deny.png'
22=== renamed file 'pixmaps/deny_disable.png' => 'data/media/deny_disable.png'
23=== renamed file 'pixmaps/deny_reject.png' => 'data/media/deny_reject.png'
24=== renamed file 'src/glade/disable.png' => 'data/media/disable.png'
25=== renamed file 'pixmaps/disable_allow.png' => 'data/media/disable_allow.png'
26=== renamed file 'pixmaps/disable_deny.png' => 'data/media/disable_deny.png'
27=== renamed file 'pixmaps/disable_disable.png' => 'data/media/disable_disable.png'
28=== renamed file 'pixmaps/disable_reject.png' => 'data/media/disable_reject.png'
29=== renamed file 'src/glade/gufw.png' => 'data/media/gufw.png'
30=== renamed file 'src/glade/gufw_menu.png' => 'data/media/gufw_menu.png'
31=== renamed file 'icon/gufw_menu.png' => 'data/media/icon.png'
32=== renamed file 'pixmaps/reject_allow.png' => 'data/media/reject_allow.png'
33=== renamed file 'pixmaps/reject_deny.png' => 'data/media/reject_deny.png'
34=== renamed file 'pixmaps/reject_disable.png' => 'data/media/reject_disable.png'
35=== renamed file 'pixmaps/reject_reject.png' => 'data/media/reject_reject.png'
36=== renamed file 'pixmaps/source.xcf' => 'data/media/source.xcf'
37=== renamed directory 'src/glade' => 'data/ui'
38=== modified file 'data/ui/gufw.glade'
39--- src/glade/gufw.glade 2010-08-26 17:07:42 +0000
40+++ data/ui/gufw.glade 2010-10-04 19:55:55 +0000
41@@ -2,9 +2,10 @@
42 <glade-interface>
43 <!-- interface-requires gtk+ 2.16 -->
44 <!-- interface-naming-policy toplevel-contextual -->
45+ <!-- interface-local-resource-path ../media -->
46 <widget class="GtkWindow" id="winMain">
47 <property name="title" translatable="yes">Firewall</property>
48- <property name="icon">gufw_menu.png</property>
49+ <property name="icon">../media/gufw_menu.png</property>
50 <signal name="delete_event" handler="winMain_delete_event_cb"/>
51 <child>
52 <widget class="GtkVBox" id="vbox1">
53@@ -482,7 +483,7 @@
54 <child>
55 <widget class="GtkImage" id="imgShield">
56 <property name="visible">True</property>
57- <property name="pixbuf">disable.png</property>
58+ <property name="pixbuf">../media/gufw.png</property>
59 </widget>
60 <packing>
61 <property name="position">1</property>
62@@ -1009,7 +1010,7 @@
63 <property name="resizable">False</property>
64 <property name="window_position">center-on-parent</property>
65 <property name="destroy_with_parent">True</property>
66- <property name="icon">gufw_menu.png</property>
67+ <property name="icon">../media/gufw_menu.png</property>
68 <property name="type_hint">dialog</property>
69 <property name="transient_for">winMain</property>
70 <signal name="key_press_event" handler="winAdd_key_press_event_cb"/>
71@@ -3058,7 +3059,7 @@
72 <property name="resizable">False</property>
73 <property name="window_position">center-on-parent</property>
74 <property name="destroy_with_parent">True</property>
75- <property name="icon">gufw_menu.png</property>
76+ <property name="icon">../media/gufw_menu.png</property>
77 <property name="type_hint">dialog</property>
78 <property name="transient_for">winMain</property>
79 <property name="has_separator">False</property>
80@@ -3104,7 +3105,7 @@
81 http://creativecommons.org/licenses/by/3.0/at/
82 All modified pictures are licenced by the same
83 creative commons as original.</property>
84- <property name="logo">gufw.png</property>
85+ <property name="logo">../media/gufw.png</property>
86 <signal name="delete_event" handler="winAbout_delete_event_cb"/>
87 <child internal-child="vbox">
88 <widget class="GtkVBox" id="dialog-vbox1">
89@@ -3133,7 +3134,7 @@
90 <property name="modal">True</property>
91 <property name="window_position">center-on-parent</property>
92 <property name="destroy_with_parent">True</property>
93- <property name="icon">gufw_menu.png</property>
94+ <property name="icon">../media/gufw_menu.png</property>
95 <property name="type_hint">dialog</property>
96 <property name="transient_for">winMain</property>
97 <signal name="key_press_event" handler="winPreferences_key_press_event_cb"/>
98@@ -3606,7 +3607,7 @@
99 <property name="modal">True</property>
100 <property name="window_position">center-on-parent</property>
101 <property name="destroy_with_parent">True</property>
102- <property name="icon">gufw_menu.png</property>
103+ <property name="icon">../media/gufw_menu.png</property>
104 <property name="type_hint">dialog</property>
105 <property name="transient_for">winMain</property>
106 <signal name="key_press_event" handler="winLog_key_press_event_cb"/>
107
108=== renamed directory 'src' => 'gufw'
109=== renamed file 'Alacarte_menu/gufw.desktop' => 'gufw.desktop.in'
110--- Alacarte_menu/gufw.desktop 2010-06-13 09:22:18 +0000
111+++ gufw.desktop.in 2010-10-04 19:55:55 +0000
112@@ -1,57 +1,8 @@
113 [Desktop Entry]
114-Version=1.0
115+_Name=Firewall configuration
116+_Comment=Allows you to configure ufw firewall
117 Type=Application
118 Terminal=false
119-Exec=su-to-root -X -c /usr/share/gufw/gufw.py
120-Name=Firewall configuration
121-Name[zh_CN]=防火墙配置
122-Name[uk]=Налаштування фаєрволу
123-Name[sk]=Nastavenia firewall
124-Name[ru]=Брандмауэр
125-Name[pt_BR]=Configuração do firewall
126-Name[pt]=Configuração de Firewall
127-Name[nl]=Firewall-instellingen
128-Name[mk]=конфигурирација на огнениот ѕид
129-Name[ko]=방화벽 설정
130-Name[ja]=ファイアウォールの設定
131-Name[it]=Configurazione firewall
132-Name[id]=Konfigurasi firewall
133-Name[hu]=Tűzfalbeállítás
134-Name[gl]=Configuración da devasa
135-Name[fr]=Configuration du pare-feu
136-Name[fi]=Palomuurin asetukset
137-Name[es]=Configuración cortafuegos
138-Name[en_AU]=Firewall configuration
139-Name[da]=Konfiguration af brandmur
140-Name[cs]=Nastavení firewallu
141-Name[ca]=Configuració del tallafocs
142-Name[bg]=Конфигуриране на защитната стена
143-Name[ast]=Configuración del tornafuéu
144-Name[ar]=إعدادات الجدار الناري
145-Comment=Allows you to configure ufw firewall
146-Comment[zh_CN]=允许您配置 ufw 防火墙
147-Comment[uk]=Дозволяє настроїти фаєрвол ufw
148-Comment[sk]=Umožní vám nastaviť ufw firewall
149-Comment[ru]=Настроить брандмауэр ufw
150-Comment[pt_BR]=Permite a você configurar o firewall ufw
151-Comment[pt]=Permite-lhe configurar ufw firewall
152-Comment[nl]=Hiermee kunt u de ufw-firewall instellen
153-Comment[mk]=Овозможува да го конфигурирате ufw огнениот ѕид
154-Comment[ko]=ufw 방화벽을 설정합니다
155-Comment[ja]=ufw ファイアウォールの設定を行えます
156-Comment[it]=Configura il firewall ufw
157-Comment[id]=Memudahkan anda untuk mengkonfigurasi firewall ufw
158-Comment[hu]=Az ufw tűzfal beállítása
159-Comment[gl]=Permítelle configurar a súa devasa ufw
160-Comment[fr]=Vous autorise à configurer le pare-feu ufw
161-Comment[fi]=Graafinen käyttöliittymä ufw-palomuurin hallintaan
162-Comment[es]=Permite configurar el cortafuegos ufw
163-Comment[en_AU]=Configure the ufw firewall
164-Comment[da]=Giver dig mulighed for at konfigurere ufw-brandmur
165-Comment[cs]=Umožňuje nastavení firewallu ufw
166-Comment[ca]=Us permet configurar el tallafocs ufw
167-Comment[bg]=ГПИ за контрол и настройка на ufw
168-Comment[ast]=Permite configurar el tornafuéu ufw
169-Comment[ar]=يسٌمح لك بإعداد الجدار الناري UFW
170-Icon=/usr/share/icons/hicolor/48x48/apps/gufw_menu.png
171+Exec=gufw
172+Icon=/usr/share/gufw/media/icon.png
173 Categories=System;Settings;
174
175=== added file 'gufw/__init__.py'
176--- gufw/__init__.py 1970-01-01 00:00:00 +0000
177+++ gufw/__init__.py 2010-10-04 19:55:55 +0000
178@@ -0,0 +1,1 @@
179+# -*- coding: utf-8 -*-
180
181=== added file 'gufw/gufwconfig.py'
182--- gufw/gufwconfig.py 1970-01-01 00:00:00 +0000
183+++ gufw/gufwconfig.py 2010-10-04 19:55:55 +0000
184@@ -0,0 +1,58 @@
185+# -*- coding: utf-8 -*-
186+### BEGIN LICENSE
187+# This file is in the public domain
188+### END LICENSE
189+
190+# THIS IS Gufw CONFIGURATION FILE
191+# YOU CAN PUT THERE SOME GLOBAL VALUE
192+# Do not touch unless you know what you're doing.
193+# you're warned :)
194+
195+__all__ = [
196+ 'project_path_not_found',
197+ 'get_data_file',
198+ 'get_data_path',
199+ ]
200+
201+# Where your project will look for your data (for instance, images and ui
202+# files). By default, this is ../data, relative your trunk layout
203+__gufw_data_directory__ = '../data/'
204+__license__ = ''
205+
206+import os
207+
208+import gettext
209+from gettext import gettext as _
210+gettext.textdomain('gufw')
211+
212+class project_path_not_found(Exception):
213+ """Raised when we can't find the project directory."""
214+
215+
216+def get_data_file(*path_segments):
217+ """Get the full path to a data file.
218+
219+ Returns the path to a file underneath the data directory (as defined by
220+ `get_data_path`). Equivalent to os.path.join(get_data_path(),
221+ *path_segments).
222+ """
223+ return os.path.join(get_data_path(), *path_segments)
224+
225+
226+def get_data_path():
227+ """Retrieve gufw data path
228+
229+ This path is by default <gufw_lib_path>/../data/ in trunk
230+ and /usr/share/gufw in an installed version but this path
231+ is specified at installation time.
232+ """
233+
234+ # Get pathname absolute or relative.
235+ path = os.path.join(
236+ os.path.dirname(__file__), __gufw_data_directory__)
237+
238+ abs_data_path = os.path.abspath(path)
239+ if not os.path.exists(abs_data_path):
240+ raise project_path_not_found
241+
242+ return abs_data_path
243
244=== modified file 'gufw/model/__init__.py'
245--- src/model/__init__.py 2010-06-13 09:22:18 +0000
246+++ gufw/model/__init__.py 2010-10-04 19:55:55 +0000
247@@ -0,0 +1,1 @@
248+# -*- coding: utf-8 -*-
249
250=== modified file 'gufw/view/__init__.py'
251--- src/view/__init__.py 2010-06-13 09:22:18 +0000
252+++ gufw/view/__init__.py 2010-10-04 19:55:55 +0000
253@@ -0,0 +1,1 @@
254+# -*- coding: utf-8 -*-
255
256=== modified file 'gufw/view/guiGufw.py'
257--- src/view/guiGufw.py 2010-08-29 10:18:32 +0000
258+++ gufw/view/guiGufw.py 2010-10-04 19:55:55 +0000
259@@ -21,15 +21,14 @@
260 import sys
261 import locale
262 import gettext
263+from gettext import gettext as _
264 import commands
265 import threading
266+import os
267+from gufwconfig import get_data_file, get_data_path
268
269 # Locale translations
270-DIR = "/usr/share/locale-langpack"
271-_ = gettext.gettext
272-gettext.bindtextdomain("gufw", DIR)
273 gettext.textdomain("gufw")
274-gtk.glade.bindtextdomain("gufw", DIR)
275 gtk.glade.textdomain("gufw")
276
277
278@@ -39,7 +38,11 @@
279 self.firewall = firewall
280
281 # Set GUI objects
282- self.glade = gtk.glade.XML(sys.path[0] + "/glade/gufw.glade")
283+ ui_filename = get_data_file('ui', 'gufw.glade')
284+ if not os.path.exists(ui_filename):
285+ ui_filename = None
286+ self.glade = gtk.glade.XML(ui_filename)
287+
288 self.model_rules = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING,
289 gobject.TYPE_STRING, gobject.TYPE_STRING)
290 self.model_report = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING,
291@@ -253,7 +256,8 @@
292 self.add_btn_add.set_sensitive(0)
293 self.btn_remove_rule.set_sensitive(0)
294 self.menu_remove.set_sensitive(0)
295- self.shield.set_from_file("/usr/share/pixmaps/gufw/disable_disable.png")
296+ shield_filename = os.path.join(get_data_path(), 'media/disable_disable.png')
297+ self.shield.set_from_file(shield_filename)
298 else:
299 self.cb_policy_incoming.set_sensitive(1)
300 self.cb_policy_outgoing.set_sensitive(1)
301@@ -264,14 +268,13 @@
302 else:
303 self.btn_remove_rule.set_sensitive(1)
304 self.menu_remove.set_sensitive(1)
305-
306- shield = "/usr/share/pixmaps/gufw/" + \
307- self.firewall.get_default_policy("incoming") + \
308+
309+ shield_name = self.firewall.get_default_policy("incoming") + \
310 "_" + \
311- self.firewall.get_default_policy("outgoing") + \
312- ".png"
313- self.shield.set_from_file(shield)
314-
315+ self.firewall.get_default_policy("outgoing")
316+ shield_filename = os.path.join(get_data_path(), 'media/%s.png' % shield_name)
317+ self.shield.set_from_file(shield_filename)
318+
319 # Menu
320 self.menu_pref.set_sensitive(1)
321 if self.firewall.get_gufw_logging() == "enable":
322
323=== renamed directory 'man_page' => 'man'
324=== added file 'man/gufw.8'
325--- man/gufw.8 1970-01-01 00:00:00 +0000
326+++ man/gufw.8 2010-10-04 19:55:55 +0000
327@@ -0,0 +1,96 @@
328+.TH gufw 8 "10 Oct 2010"
329+
330+.SH NAME
331+Gufw \- Graphic user interface for managing ufw
332+.PP
333+.SH DESCRIPTION
334+Gufw is an easy to use Ubuntu / Linux firewall, powered by ufw.
335+
336+Gufw is an easy, intuitive, way to manage your Linux firewall. It supports common tasks such as allowing or blocking pre-configured, common p2p, or individual ports port(s), and many others! Gufw is powered by ufw , runs on Ubuntu, and anywhere else Python, GTK, and Ufw are available.
337+Introduction
338+iptables is already a very powerful tool by itself, but it's syntax can get awkward at times and hard to figure out, so Ubuntu developers decided to make ufw ("The reason ufw was developed is that we wanted to create a server-level firewalling utility that was a little bit more for `human beings`"), which was to be simpler. Now, on the graphical side of things, Firestarer already existed. But why not make an even easier to use GUI for desktop `human beings`, powered by ufw? This is where Gufw comes in.
339+
340+.SH RUN
341+.TP
342+You can run Gufw in GNOME menu: /System/Administration/Firewall configuration
343+
344+.SH "USAGE"
345+.SH BASIC SETTINGS
346+.PP
347+Gufw has two states: Enabled and disabled.
348+When Gufw is enabled, you can allow/reject/deny all incoming and outgoing connections.
349+
350+.SH ADD PRECONFIGURED RULE(S)
351+.PP
352+You can select between more Programs and Services preconfigured.
353+Once Program/Service can have multiples rules.
354+
355+.SH ADD SIMPLE RULE(S)
356+.PP
357+You can specify the port or service, and protocol to be allowed (allow traffic), reject (reject traffic without reply), denied (deny traffic with reply), limit (limit traffic) on the host, or limit an IP or Port (Protecting against brute-force login attacks).
358+The port can be a number of 5 digits, from 1 to 65535.
359+The service can be any of /etc/services file (By example tcpmux, echo, discard, systat...).
360+The protocol can be:
361+ 1. tcp: Apply rule for all traffic in protocol tcp.
362+ 2. udp: Apply rule for all traffic in protocol udp.
363+ 3. both: Apply rule for all traffic in protocol tcp and udp.
364+
365+.SH ADD ADVANCED RULE(S)
366+.PP
367+You can add an advanced rule.
368+You can specify:
369+ 1. Protocol: tcp, udp or both.
370+ 2. From IP Addres: You can allow/deny/reject/limit traffic from IP address. This parameter is optional or you can use "Any". Example for a range: 192.168.1.0/9
371+ 3. From Port: You can allow/deny/reject/limit traffic from a port. This parameter is optional. The port can be a number of 5 digits, from 1 to 65535. You can use a range ports with this format port1:port2 (by example 3234:3237), or add multiple ports with port1,port2 (by example 3234,3254).
372+ 4. To IP Addres: You can allow/deny/limit traffic to an IP address. This parameter is optional or you can use "Any". Example for a range: 192.168.1.0/9
373+ 5. To Port: You can allow/deny/reject/limit traffic to a Port. This parameter is optional. The port can be a number of 5 digits, from 1 to 65535. You can use a range ports with this format port1:port2 (by example 3234:3237).
374+
375+.SH GENERAL TO PRECONFIGURED / SIMPLE / ADVANCED
376+.PP
377+With the extended parameters you can:
378+Insert a rule in a specific row
379+Set the log level for ufw.
380+
381+.SH REMOVE ONE RULE
382+.PP
383+Steps:
384+ 1. Select a rule in the list.
385+ 2. Click in Remove button.
386+You can delete more rules if you select it.
387+
388+.SH RESET CONFIGURATION
389+.PP
390+You will remove all rules and reset the ufw configuration to intial status!
391+
392+.SH EDIT PREFERENCES
393+.PP
394+You can edit your preferences in /Edit/Preferences menu.
395+Preferences:
396+ 1. Register Gufw log: You will have got a log of all operations of Gufw.
397+ 2. ufw log enabled: You will enable/disable and set the level of the ufw log.
398+
399+.SH LISTENING REPORT
400+.PP
401+You can enable the Listening Report in the Preferences window.
402+The listening report will display the ports on the live system in the listening
403+state for TCP and the open state for UDP. It's the same report that the
404+listening report in ufw.
405+
406+.SH "NOTES"
407+.SH HOW TO AUTOSTART GUFW WITH THE SYSTEM?
408+.PP
409+A short answer is, you really don't need to autostart Gufw. Gufw is just a settings tool for ufw (the real firewall), and they are split separate.
410+Think of Gufw as a settings dialog. After you do all of the changes and close it, the settings are still in effect (for example, when you setup a new printer - after you close the setup window, your printer setup still stays!).
411+So there is no need to add Gufw to auto-start, unless you're going to change your firewall settings very frequently. If you enable the firewall and close Gufw, the firewall will still be enabled, even after a reboot.
412+REMEMBER: Once configured it will stay that way, so you don't need to be running Gufw on your desktop all the time!
413+
414+.SH SEE ALSO
415+.PP
416+\fBufw\fR(8)
417+
418+.SH AUTHOR
419+.PP
420+Gufw is (C) 2008-2010, Marcos Alvarez Costales.
421+
422+.PP
423+This manual page was originally written by Marcos Alvarez Costales <marcos@ubuntu-ast.org>
424
425=== removed file 'man_page/gufw.8.gz'
426Binary files man_page/gufw.8.gz 2010-08-16 13:50:22 +0000 and man_page/gufw.8.gz 1970-01-01 00:00:00 +0000 differ
427=== removed directory 'pixmaps'
428=== added directory 'po'
429=== added file 'po/POTFILES.in'
430--- po/POTFILES.in 1970-01-01 00:00:00 +0000
431+++ po/POTFILES.in 2010-10-04 19:55:55 +0000
432@@ -0,0 +1,3 @@
433+gufw/view/guiGufw.py
434+[type: gettext/glade] data/ui/gufw.glade
435+gufw.desktop.in
436
437=== modified file 'setup.py' (properties changed: +x to -x)
438--- setup.py 2010-08-16 13:50:22 +0000
439+++ setup.py 2010-10-04 19:55:55 +0000
440@@ -1,62 +1,88 @@
441 #!/usr/bin/env python
442-
443-# Gufw 10.10.1 - http://gufw.tuxfamily.org
444-# Copyright (C) 2008-2010 Marcos Alvarez Costales <marcos@ubuntu-ast.org>
445-#
446-# Gufw is free software; you can redistribute it and/or modify
447-# it under the terms of the GNU General Public License as published by
448-# the Free Software Foundation; either version 3 of the License, or
449-# (at your option) any later version.
450-#
451-# Gufw is distributed in the hope that it will be useful,
452-# but WITHOUT ANY WARRANTY; without even the implied warranty of
453-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
454-# GNU General Public License for more details.
455-#
456-# You should have received a copy of the GNU General Public License
457-# along with Gufw; if not, see http://www.gnu.org/licenses for more
458-# information.
459-
460-import sys, os
461-assert sys.version >= '2', "Install Python 2.0 or greater"
462-from distutils.core import setup, Extension
463-import glob
464-
465-
466-# Create data files
467-data = [ ('/usr/share/applications', ['Alacarte_menu/gufw.desktop']),
468- ('/usr/share/gufw/glade', glob.glob("src/glade/*.*")),
469- ('/usr/bin', ['global_command/gufw']),
470- ('/usr/share/icons/hicolor/48x48/apps', glob.glob("icon/*.*")),
471- ('/usr/share/man/man8', ['man_page/gufw.8.gz']),
472- ('/usr/share/gufw/model', glob.glob("src/model/*.*")),
473- ('/usr/share/pixmaps/gufw', glob.glob("pixmaps/*.png")),
474- ('/usr/share/gufw/view', glob.glob("src/view/*.*")),
475- ('/usr/share/gufw', glob.glob("src/*.py")) ]
476-
477-
478-
479-# Create locale list
480-locales = []
481-for i in os.listdir("./locale-langpack/"):
482- locales.append(i)
483-# Adding locales to data files:
484-for i in locales:
485- locale = ("/usr/share/locale-langpack/%s/LC_MESSAGES/"%i,["locale-langpack/%s/LC_MESSAGES/gufw.mo"%i])
486- data.append(locale)
487-
488-
489-
490-# Setup stage
491-setup(
492- name = "Gufw",
493- version = "10.10.1",
494- description = "An easy, intuitive, way to manage your Linux firewall. It supports common tasks such as allowing or blocking pre-configured, common p2p, or individual ports port(s), and many others!",
495- author = "Marcos Alvarez Costales <marcos@ubuntu-ast.org>",
496- author_email = "<marcos@ubuntu-ast.org>",
497- url = "http://gufw.tuxfamily.org",
498- license = "GPL3",
499- packages = ["doc"],
500- data_files = data
501+# -*- coding: utf-8 -*-
502+### BEGIN LICENSE
503+# This file is in the public domain
504+### END LICENSE
505+
506+###################### DO NOT TOUCH THIS (HEAD TO THE SECOND PART) ######################
507+
508+import os
509+import sys
510+
511+try:
512+ import DistUtilsExtra.auto
513+except ImportError:
514+ print >> sys.stderr, 'To build gufw you need https://launchpad.net/python-distutils-extra'
515+ sys.exit(1)
516+assert DistUtilsExtra.auto.__version__ >= '2.18', 'needs DistUtilsExtra.auto >= 2.18'
517+
518+def update_data_path(prefix, oldvalue=None):
519+
520+ try:
521+ fin = file('gufw/gufwconfig.py', 'r')
522+ fout = file(fin.name + '.new', 'w')
523+
524+ for line in fin:
525+ fields = line.split(' = ') # Separate variable from value
526+ if fields[0] == '__gufw_data_directory__':
527+ # update to prefix, store oldvalue
528+ if not oldvalue:
529+ oldvalue = fields[1]
530+ line = "%s = '%s'\n" % (fields[0], prefix)
531+ else: # restore oldvalue
532+ line = "%s = %s" % (fields[0], oldvalue)
533+ fout.write(line)
534+
535+ fout.flush()
536+ fout.close()
537+ fin.close()
538+ os.rename(fout.name, fin.name)
539+ except (OSError, IOError), e:
540+ print ("ERROR: Can't find gufw/gufwconfig.py")
541+ sys.exit(1)
542+ return oldvalue
543+
544+
545+def update_desktop_file(datadir):
546+
547+ try:
548+ fin = file('gufw.desktop.in', 'r')
549+ fout = file(fin.name + '.new', 'w')
550+
551+ for line in fin:
552+ if 'Icon=' in line:
553+ line = "Icon=%s\n" % (datadir + 'media/icon.png')
554+ fout.write(line)
555+ fout.flush()
556+ fout.close()
557+ fin.close()
558+ os.rename(fout.name, fin.name)
559+ except (OSError, IOError), e:
560+ print ("ERROR: Can't find gufw.desktop.in")
561+ sys.exit(1)
562+
563+
564+class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
565+ def run(self):
566+ previous_value = update_data_path(self.prefix + '/share/gufw/')
567+ update_desktop_file(self.prefix + '/share/gufw/')
568+ DistUtilsExtra.auto.install_auto.run(self)
569+ update_data_path(self.prefix, previous_value)
570+
571+
572+
573+##################################################################################
574+###################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ######################
575+##################################################################################
576+
577+DistUtilsExtra.auto.setup(
578+ name='gufw',
579+ version='10.10.1',
580+ license='GPL-3',
581+ author='Marcos Alvarez Costales',
582+ author_email='marcos@ubuntu-ast.org',
583+ description='An easy, intuitive, way to manage your Linux firewall. It supports common tasks such as allowing or blocking pre-configured, common p2p, or individual ports port(s), and many others!',
584+ url='http://gufw.tuxfamily.org',
585+ cmdclass={'install': InstallAndUpdateDataDirectory}
586 )
587

Subscribers

People subscribed via source and target branches

to all changes: