comparison piecrust/processing/tree.py @ 5:474c9882decf

Upgrade to Python 3.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 11 Aug 2014 22:36:47 -0700
parents f485ba500df3
children 0170f449f924
comparison
equal deleted inserted replaced
4:7dc71c2dc9a8 5:474c9882decf
148 print_node(format_timed(start_time, "(bypassing structured processing)")) 148 print_node(format_timed(start_time, "(bypassing structured processing)"))
149 return True 149 return True
150 except Exception as e: 150 except Exception as e:
151 import sys 151 import sys
152 _, __, traceback = sys.exc_info() 152 _, __, traceback = sys.exc_info()
153 raise Exception("Error processing: %s" % node.path, e), None, traceback 153 raise Exception("Error processing: %s" % node.path, e).with_traceback(traceback)
154 154
155 # All outputs of a node must go to the same directory, so we can get 155 # All outputs of a node must go to the same directory, so we can get
156 # the output directory off of the first output. 156 # the output directory off of the first output.
157 base_out_dir = self._getNodeBaseDir(node.outputs[0]) 157 base_out_dir = self._getNodeBaseDir(node.outputs[0])
158 rel_out_dir = os.path.dirname(node.path) 158 rel_out_dir = os.path.dirname(node.path)
159 out_dir = os.path.join(base_out_dir, rel_out_dir) 159 out_dir = os.path.join(base_out_dir, rel_out_dir)
160 if not os.path.isdir(out_dir): 160 if not os.path.isdir(out_dir):
161 if self.lock: 161 if self.lock:
162 with self.lock: 162 with self.lock:
163 if not os.path.isdir(out_dir): 163 if not os.path.isdir(out_dir):
164 os.makedirs(out_dir, 0755) 164 os.makedirs(out_dir, 0o755)
165 else: 165 else:
166 os.makedirs(out_dir, 0755) 166 os.makedirs(out_dir, 0o755)
167 167
168 try: 168 try:
169 start_time = time.clock() 169 start_time = time.clock()
170 proc_res = proc.process(full_path, out_dir) 170 proc_res = proc.process(full_path, out_dir)
171 if proc_res is None: 171 if proc_res is None:
178 print_node(node, "-> %s [clean]" % out_dir) 178 print_node(node, "-> %s [clean]" % out_dir)
179 return False 179 return False
180 except Exception as e: 180 except Exception as e:
181 import sys 181 import sys
182 _, __, traceback = sys.exc_info() 182 _, __, traceback = sys.exc_info()
183 raise Exception("Error processing: %s" % node.path, e), None, traceback 183 raise Exception("Error processing: %s" % node.path, e).with_traceback(traceback)
184 184
185 def _computeNodeState(self, node): 185 def _computeNodeState(self, node):
186 if node.state != STATE_UNKNOWN: 186 if node.state != STATE_UNKNOWN:
187 return 187 return
188 188