blob: c5513c48d185dfa8bf99982fb2bcb76eb9e34cd7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
from __future__ import print_function
import os
import sys
import logging
import argparse
# Explicitly enable local imports
# Don't forget to add imported scripts to inputs of the calling command!
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import fetch_from
def parse_args():
parser = argparse.ArgumentParser()
fetch_from.add_common_arguments(parser)
parser.add_argument('--file-name', required=True)
parser.add_argument('--archive', required=True)
return parser.parse_args()
def main(args):
archive = args.archive
file_name = args.file_name.rstrip('-')
fetch_from.process(archive, file_name, args, remove=False)
if __name__ == '__main__':
args = parse_args()
fetch_from.setup_logging(args, os.path.basename(__file__))
try:
main(args)
except Exception as e:
logging.exception(e)
print(open(args.abs_log_path).read(), file=sys.stderr)
sys.stderr.flush()
import error
sys.exit(error.ExitCodes.INFRASTRUCTURE_ERROR if fetch_from.is_temporary(e) else 1)
|