Home | History | Annotate | Download | only in procdump_win
      1 #!/usr/bin/env python
      2 #
      3 # Copyright 2018 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 the asset."""
     10 
     11 
     12 import argparse
     13 import common
     14 import subprocess
     15 import utils
     16 
     17 
     18 # Download URL can be found on this page:
     19 # https://docs.microsoft.com/en-us/sysinternals/downloads/procdump
     20 PROCDUMP_URL = 'https://download.sysinternals.com/files/Procdump.zip'
     21 
     22 
     23 def create_asset(target_dir):
     24   """Create the asset."""
     25   with utils.tmp_dir():
     26     subprocess.check_call(["curl", PROCDUMP_URL, "-o", "procdump.zip"])
     27     subprocess.check_call(["unzip", "procdump.zip", "-d", target_dir])
     28 
     29 
     30 def main():
     31   parser = argparse.ArgumentParser()
     32   parser.add_argument('--target_dir', '-t', required=True)
     33   args = parser.parse_args()
     34   create_asset(args.target_dir)
     35 
     36 
     37 if __name__ == '__main__':
     38   main()
     39