-
Notifications
You must be signed in to change notification settings - Fork 1
/
unpack.py
34 lines (26 loc) · 917 Bytes
/
unpack.py
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
#!/usr/bin/env python
# -*- coding: utf8 -*-
# __author__ = "Richard B Winters"
# __copyright__ = "Copyright 2011-2015, Massively Modified, Inc."
# __credits__ = ["Richard B Winters"]
# __license__ = "Apache-2.0"
# __maintainer__ = "Richard B Winters"
# __email__ = "support@mmogp.com"
# __status__ = "Production"
import sys
import os
import urllib
import tarfile
# Define remote url and local destination of source archive
remote = sys.argv[1] + sys.argv[2] + sys.argv[4]
archive = os.path.abspath(sys.argv[5] + sys.argv[3] + sys.argv[4])
# Fetch source archive
urllib.urlretrieve (remote, archive)
# Define output directory for decompressed source archive
destination = os.path.abspath(sys.argv[6])
# Extract
source = tarfile.open(archive,'r:gz');
source.extractall(destination)
# Relocate the source to the application rood (i.e to the directory above containing node_modules directory)
# Exit
sys.exit(0)