1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
#!/usr/bin/env python
# coding: utf-8
"""
Virtualbricks - a vde/qemu gui written in python and GTK/Glade.
Copyright (C) 2011 Virtualbricks team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""
CURRENT_VERSION="1.0"
CURRENT_MICRO_VERSION="0"
SUPPORTED_LANGS = ['it','nl','fr','de','es']
from distutils.core import setup
import os
import sys
import tempfile
import re
sys.prefix="/usr/local"
for arg in sys.argv:
if arg.startswith('--build-base='):
sys.prefix=arg.split('=')[1]
glade = open('share/virtualbricks.template.glade','r').read()
try:
micro = open('.bzr/branch/last-revision','r').read().split(' ')[0]
except:
micro = CURRENT_MICRO_VERSION
if micro == '':
micro = CURRENT_MICRO_VERSION
virtualbricks_version=CURRENT_VERSION+'.'+micro
open('/tmp/virtualbricks.glade.step1','w+').write(re.sub('___VERSION___', virtualbricks_version, glade))
glade = open('/tmp/virtualbricks.glade.step1','r').read()
open('share/virtualbricks.glade','w+').write(re.sub('__IMAGES_PATH__', sys.prefix + '/share', glade))
FILES = [
( 'bin', ['main/virtualbricks']),
( 'share/virtualbricks/', ['share/virtualbricks.glade']),
( 'share/applications', ['share/virtualbricks.desktop']),
( 'share/pixmaps', ['share/virtualbricks.png']),
( 'share/pixmaps', ['images/Connect.png']),
( 'share/pixmaps', ['images/Disconnect.png']),
( 'share/pixmaps', ['images/Event.png']),
( 'share/pixmaps', ['images/Qemu.png']),
( 'share/pixmaps', ['images/Switch.png']),
( 'share/pixmaps', ['images/Tap.png']),
( 'share/pixmaps', ['images/Capture.png']),
( 'share/pixmaps', ['images/TunnelConnect.png']),
( 'share/pixmaps', ['images/TunnelListen.png']),
( 'share/pixmaps', ['images/Wirefilter.png']),
( 'share/pixmaps', ['images/Wire.png']),
( 'share/pixmaps', ['images/Router.png']),
( 'share/pixmaps', ['images/SwitchWrapper.png'])
]
tempdirs = []
for l in SUPPORTED_LANGS:
directory_name = tempfile.mkdtemp()
tempdirs.append(directory_name)
command = 'msgfmt -o ' + directory_name + '/virtualbricks.mo ' + 'locale/virtualbricks/' + l + '.po'
os.system(command)
FILES.append(('share/locale/'+l+'/LC_MESSAGES/', [directory_name + '/virtualbricks.mo']))
setup( data_files=FILES, name='virtualbricks', version=virtualbricks_version,
description='Virtualbricks Virtualization Tools',
license='GPL2',
author='Daniele Lacamera, Rainer Haage, Francesco Apollonio, Pierre-Louis Bonicoli, Simone Abbati',
author_email='qemulator-list@createweb.de',
url='http://www.virtualbricks.eu/',
packages=['virtualbricks', 'virtualbricks.gui'],
package_dir = {'': '.'}
)
print "Cleaning..",
#Remove compiled l10n files
for d in tempdirs:
try:
#Remove the compiled file
os.unlink(d + '/virtualbricks.mo')
# Clean up the directory
os.removedirs(d)
except:
print "Not critical error while removing: %s(.virtualbricks.mo)" %d
continue
#Remove .glade file created in setup process
try:
os.unlink('share/virtualbricks.glade')
print "Done"
except:
print "Not critical error while removing glade file"
|