Flutter Engine
The Flutter Engine
create.py
Go to the documentation of this file.
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 the asset."""
10
11
12import argparse
13import os
14import subprocess
15
16
17NODE_URL = "https://nodejs.org/dist/v12.16.3/node-v12.16.3-linux-x64.tar.xz"
18NODE_EXTRACT_NAME = "node-v12.16.3-linux-x64"
19
20
21def create_asset(target_dir):
22 """Create the asset."""
23 p1 = subprocess.Popen(["curl", NODE_URL], stdout=subprocess.PIPE)
24 p2 = subprocess.Popen(["tar", "-C", target_dir, "-xJf" "-"], stdin=p1.stdout)
25 p1.stdout.close() # Allow p1 to receive a SIGPIPE if p2 exits.
26 _,_ = p2.communicate()
27 os.rename(
28 os.path.join(target_dir, NODE_EXTRACT_NAME),
29 os.path.join(target_dir, "node")
30 )
31
32
33def main():
34 parser = argparse.ArgumentParser()
35 parser.add_argument('--target_dir', '-t', required=True)
36 args = parser.parse_args()
37 create_asset(args.target_dir)
38
39
40if __name__ == '__main__':
41 main()
def main()
Definition: create.py:69
def create_asset(target_dir)
Definition: create.py:32
Definition: main.py:1