aboutsummaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
authorRoman Lacko <backup.rlacko@gmail.com>2014-04-21 22:56:37 +0200
committerRoman Lacko <backup.rlacko@gmail.com>2014-04-21 22:56:37 +0200
commitaaa87609878674d068b801de7f1c896b377d515d (patch)
tree30aa5cc1af8e6237ad1e5e94732d594d7d01c218 /utils.py
parent4ba5d5fbcc62d8a5eb4b80d995a3bfb3be094d1f (diff)
Re-generate examples Qt resource files for Python 3 compatibility when preparing binary packages
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/utils.py b/utils.py
index 88127b033..487ed5d48 100644
--- a/utils.py
+++ b/utils.py
@@ -425,3 +425,23 @@ def get_environment_from_batch_command(env_cmd, initial=None):
# let the process finish
proc.communicate()
return result
+
+
+def regenerate_qt_resources(src, pyside_rcc_path, pyside_rcc_options):
+ names = os.listdir(src)
+ for name in names:
+ srcname = os.path.join(src, name)
+ if os.path.isdir(srcname):
+ regenerate_qt_resources(srcname,
+ pyside_rcc_path,
+ pyside_rcc_options)
+ elif srcname.endswith('.qrc'):
+ # Replace last occurence of '.qrc' in srcname
+ srcname_split = srcname.rsplit('.qrc', 1)
+ dstname = '_rc.py'.join(srcname_split)
+ if os.path.exists(dstname):
+ log.info('Regenerating %s from %s' % \
+ (dstname, os.path.basename(srcname)))
+ run_process([pyside_rcc_path,
+ pyside_rcc_options,
+ srcname, '-o', dstname])