Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: lib/webports/source_package.py

Issue 1636153003: Handle keyboard interrupt during build (Closed) Base URL: https://chromium.googlesource.com/webports.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. 1 # Copyright (c) 2014 The Native Client Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import contextlib 5 import contextlib
6 import fnmatch 6 import fnmatch
7 import os 7 import os
8 import re 8 import re
9 import subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 old_log_level = util.log_level 358 old_log_level = util.log_level
359 util.log_level = util.LOG_VERBOSE 359 util.log_level = util.LOG_VERBOSE
360 try: 360 try:
361 self.Download() 361 self.Download()
362 self.Extract() 362 self.Extract()
363 self.Patch() 363 self.Patch()
364 self.RunBuildSh() 364 self.RunBuildSh()
365 self.CreatePkgFile() 365 self.CreatePkgFile()
366 finally: 366 finally:
367 util.log_level = old_log_level 367 util.log_level = old_log_level
368 except KeyboardInterrupt:
369 # Treat KeyboardInterrupt as special, and not an actual failure. This
370 # avoid log spew to stdout when they user interupts a quit build.
371 raise
368 except: 372 except:
369 if log_filename: 373 if log_filename:
370 with open(log_filename) as log_file: 374 with open(log_filename) as log_file:
371 sys.stdout.write(log_file.read()) 375 sys.stdout.write(log_file.read())
372 raise 376 raise
373 377
374 duration = FormatTimeDelta(time.time() - start) 378 duration = FormatTimeDelta(time.time() - start)
375 util.LogHeading('Build complete', ' [took %s]' % duration) 379 util.LogHeading('Build complete', ' [took %s]' % duration)
376 380
377 def RunBuildSh(self): 381 def RunBuildSh(self):
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 if os.path.isdir(package_name): 792 if os.path.isdir(package_name):
789 return SourcePackage(package_name, config) 793 return SourcePackage(package_name, config)
790 794
791 for subdir in DEFAULT_LOCATIONS: 795 for subdir in DEFAULT_LOCATIONS:
792 pkg_root = os.path.join(paths.NACLPORTS_ROOT, subdir, package_name) 796 pkg_root = os.path.join(paths.NACLPORTS_ROOT, subdir, package_name)
793 info = os.path.join(pkg_root, 'pkg_info') 797 info = os.path.join(pkg_root, 'pkg_info')
794 if os.path.exists(info): 798 if os.path.exists(info):
795 return SourcePackage(pkg_root, config) 799 return SourcePackage(pkg_root, config)
796 800
797 raise Error("Package not found: %s" % package_name) 801 raise Error("Package not found: %s" % package_name)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698