| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 The LUCI Authors. All rights reserved. | 2 # Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """Manages web/ resource checkout and building. | 6 """Manages web/ resource checkout and building. |
| 7 | 7 |
| 8 This script can be run in one of three modes: | 8 This script can be run in one of three modes: |
| 9 - As "initialize.py", it will perform resource dependency checkout for | 9 - As "initialize.py", it will perform resource dependency checkout for |
| 10 "luci_deploy" and quit. | 10 "luci_deploy" and quit. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 @property | 113 @property |
| 114 def apps_dir(self): | 114 def apps_dir(self): |
| 115 return os.path.join(self._web_dir, 'apps') | 115 return os.path.join(self._web_dir, 'apps') |
| 116 | 116 |
| 117 def _call(self, *args, **kwargs): | 117 def _call(self, *args, **kwargs): |
| 118 LOGGER.debug('Running command (cwd=%s): %s', | 118 LOGGER.debug('Running command (cwd=%s): %s', |
| 119 kwargs.get('cwd', os.getcwd()), | 119 kwargs.get('cwd', os.getcwd()), |
| 120 pipes.quote(' '.join(args))) | 120 pipes.quote(' '.join(args))) |
| 121 | 121 |
| 122 kwargs['stderr'] = subprocess.STDOUT | 122 kwargs['stderr'] = subprocess.STDOUT |
| 123 subprocess.check_call(args, **kwargs) | 123 try: |
| 124 subprocess.check_call(args, **kwargs) |
| 125 except subprocess.CalledProcessError as e: |
| 126 LOGGER.warning('Non-zero return code (%d) from command.', |
| 127 e.returncode, exc_info=LOGGER.isEnabledFor(logging.DEBUG)) |
| 128 sys.exit(e.returncode) |
| 124 | 129 |
| 125 def node(self, *args, **kwargs): | 130 def node(self, *args, **kwargs): |
| 126 self._call(self._node_exe, *args, **kwargs) | 131 self._call(self._node_exe, *args, **kwargs) |
| 127 | 132 |
| 128 def npm(self, *args, **kwargs): | 133 def npm(self, *args, **kwargs): |
| 129 self._call(self._npm_exe, *args, **kwargs) | 134 self._call(self._npm_exe, *args, **kwargs) |
| 130 | 135 |
| 131 def bower(self, *args, **kwargs): | 136 def bower(self, *args, **kwargs): |
| 132 exe = os.path.join(self.web_dir, 'node_modules', 'bower', 'bin', 'bower') | 137 exe = os.path.join(self.web_dir, 'node_modules', 'bower', 'bin', 'bower') |
| 133 return self.node(exe, *args, **kwargs) | 138 return self.node(exe, *args, **kwargs) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 return _main_initialize(args) | 273 return _main_initialize(args) |
| 269 elif script_name == 'build.py': | 274 elif script_name == 'build.py': |
| 270 return _main_deploy(args) | 275 return _main_deploy(args) |
| 271 else: | 276 else: |
| 272 return _main(args) | 277 return _main(args) |
| 273 | 278 |
| 274 | 279 |
| 275 if __name__ == '__main__': | 280 if __name__ == '__main__': |
| 276 logging.basicConfig(level=logging.INFO) | 281 logging.basicConfig(level=logging.INFO) |
| 277 sys.exit(main(sys.argv)) | 282 sys.exit(main(sys.argv)) |
| OLD | NEW |