3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are met:
6 # * Redistributions of source code must retain the above copyright notice,
7 # this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above copyright
9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution.
11 # * Neither the name of the author nor the names of its contributors may be
12 # used to endorse or promote products derived from this software without
13 # specific prior written permission.
15 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 # POSSIBILITY OF SUCH DAMAGE.
27 # Small script to update qrc files (lang.qrc, icons.qrc)
28 # by Christophe Dumez <chris@qbittorrent.org>
31 from os
.path
import splitext
, join
33 # update languages files directory
34 languages_list
= [x
for x
in os
.listdir('lang') if x
.endswith('.qm')]
35 output
= '''<!DOCTYPE RCC><RCC version="1.0">
38 for language
in languages_list
:
39 output
+= ' <file>%s</file>'%('lang'+os
.sep
+language
)
41 output
+= '''</qresource>
43 lang_file
= open('lang.qrc', 'w')
44 lang_file
.write(output
)
47 # update search_engine directory
48 os
.chdir('gui/searchengine')
50 for root
, dirs
, files
in os
.walk('nova3'):
52 if file.startswith("__"):
54 if splitext(file)[-1] in ('.py', '.png'):
55 search_list
.append(join(root
, file))
57 output
= '''<!DOCTYPE RCC><RCC version="1.0">
60 for file in search_list
:
61 output
+= ' <file>%s</file>'%(file)
63 output
+= '''</qresource>
65 search_file
= open('search.qrc', 'w')
66 search_file
.write(output
)
71 # update icons files directory
73 for root
, dirs
, files
in os
.walk('icons'):
74 if 'skin_unused' in dirs
:
75 dirs
.remove('skin_unused')
77 if splitext(file)[-1] in ('.png', '.jpg', '.gif'):
78 icons_list
.append(join(root
, file))
80 output
= '''<!DOCTYPE RCC><RCC version="1.0">
83 for icon
in icons_list
:
84 output
+= ' <file>%s</file>'%(icon)
86 output
+= '''</qresource>
88 icons_file
= open('icons.qrc', 'w')
89 icons_file
.write(output
)