• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2#
3# Copyright 2017 Google Inc.
4#
5# Use of this source code is governed by a BSD-style license that can be
6# found in the LICENSE file.
7
8
9"""Create Bloaty as a Linux executable."""
10
11
12import argparse
13import os
14import subprocess
15import shutil
16import utils
17
18REPO = 'https://github.com/google/bloaty'
19TAG = 'v1.0'
20
21def create_asset(target_dir):
22  with utils.tmp_dir():
23    # Check out bloaty
24    subprocess.check_call(['git', 'clone', '--depth', '1', '-b', TAG,
25                           '--single-branch', REPO])
26    os.chdir('bloaty')
27    # Build bloaty
28    subprocess.check_call(['cmake', '.'])
29    subprocess.check_call(['make', '-j'])
30
31    shutil.move('./bloaty', target_dir)
32
33
34def main():
35  parser = argparse.ArgumentParser()
36  parser.add_argument('--target_dir', '-t', required=True)
37  args = parser.parse_args()
38  create_asset(args.target_dir)
39
40
41if __name__ == '__main__':
42  main()
43