(args)
| 395 | raise RuntimeError('Bad command: %s\n' % options.command) |
| 396 | |
| 397 | def parse_options(args): |
| 398 | parser = argparse.ArgumentParser( |
| 399 | description='Install headers and binaries into filesystem') |
| 400 | parser.add_argument('command', choices=['install', 'uninstall']) |
| 401 | parser.add_argument('--dest-dir', help='custom install prefix for packagers, i.e. DESTDIR', |
| 402 | default=os.getcwd()) |
| 403 | parser.add_argument('--prefix', help='custom install prefix, i.e. PREFIX', |
| 404 | default='/usr/local') |
| 405 | parser.add_argument('--headers-only', help='only install headers', |
| 406 | action='store_true', default=False) |
| 407 | parser.add_argument('--root-dir', help='the root directory of source code', |
| 408 | default=os.getcwd()) |
| 409 | parser.add_argument('--build-dir', help='the location of built binaries', |
| 410 | default='out/Release') |
| 411 | parser.add_argument('--v8-dir', help='the location of V8', |
| 412 | default='deps/v8') |
| 413 | parser.add_argument('--config-gypi-path', help='the location of config.gypi', |
| 414 | default='config.gypi') |
| 415 | parser.add_argument('--is-win', help='build for Windows target', |
| 416 | action='store_true', |
| 417 | default=(sys.platform in ['win32', 'cygwin'])) |
| 418 | parser.add_argument('--silent', help='do not output log', |
| 419 | action='store_true', default=False) |
| 420 | options = parser.parse_args(args) |
| 421 | |
| 422 | # |dest_dir| is a custom install prefix for packagers (think DESTDIR) |
| 423 | # |prefix| is a custom install prefix (think PREFIX) |
| 424 | # Difference is that dest_dir won't be included in shebang lines etc. |
| 425 | # |install_path| thus becomes the base target directory. |
| 426 | options.install_path = os.path.join(options.dest_dir + options.prefix) |
| 427 | |
| 428 | # Read variables from the config.gypi. |
| 429 | with open(options.config_gypi_path) as f: |
| 430 | config = ast.literal_eval(f.read()) |
| 431 | options.variables = config['variables'] |
| 432 | |
| 433 | return options |
| 434 | |
| 435 | if __name__ == '__main__': |
| 436 | run(parse_options(sys.argv[1:])) |
no test coverage detected
searching dependent graphs…