Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

setup: add --force option to build_qt command

Now build_qt doesn't execute pyuic or pyrcc for unmodified files
by default.

Changeset bcf7534c6b45

Parent a0dc320b762e

by Yuya Nishihara

Changes to one file · Browse files at bcf7534c6b45 Showing diff from parent a0dc320b762e Diff from another changeset...

Change 1 of 3 Show Entire File setup.py Stacked
 
13
14
15
 
16
17
18
 
57
58
59
60
 
 
 
61
62
63
 
64
65
66
 
67
68
69
70
71
 
 
72
73
74
 
83
84
85
 
 
86
87
88
 
13
14
15
16
17
18
19
 
58
59
60
 
61
62
63
64
65
 
66
67
68
 
69
70
71
72
73
74
75
76
77
78
79
 
88
89
90
91
92
93
94
95
@@ -13,6 +13,7 @@
 import subprocess  from distutils.core import setup, Command  from distutils.command.build import build +from distutils.dep_util import newer  from distutils.spawn import spawn, find_executable  from os.path import isdir, exists, join, walk, splitext   @@ -57,18 +58,22 @@
   class build_qt(Command):   description = "build PyQt GUIs (.ui) and resources (.qrc)" - user_options = [] + user_options = [('force', 'f', 'forcibly compile everything' + ' (ignore file timestamps)')] + boolean_options = ('force',)     def initialize_options(self): - pass + self.force = None     def finalize_options(self): - pass + self.set_undefined_options('build', ('force', 'force'))     def compile_ui(self, ui_file, py_file=None):   # Search for pyuic4 in python bin dir, then in the $Path.   if py_file is None:   py_file = splitext(ui_file)[0] + "_ui.py" + if not(self.force or newer(ui_file, py_file)): + return   try:   from PyQt4 import uic   fp = open(py_file, 'w') @@ -83,6 +88,8 @@
  # Search for pyuic4 in python bin dir, then in the $Path.   if py_file is None:   py_file = splitext(qrc_file)[0] + "_rc.py" + if not(self.force or newer(qrc_file, py_file)): + return   if os.system('pyrcc4 "%s" -o "%s"' % (qrc_file, py_file)) > 0:   print "Unable to generate python module for resource file", qrc_file