-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
30 lines (25 loc) · 952 Bytes
/
setup.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
import os
import subprocess
from subprocess import call
import shutil
if __name__ == '__main__':
"""
Running `python setup.py` will generate a cryptoprice.zip file which can
be uploaded to the AWS Lambda website and be used as a fully functioning
lambda function.
"""
# Place our resources into zip_folder
print("Adding contents to zip folder")
os.mkdir('zip_folder')
call(['cp', 'cryptoprice.py', 'zip_folder/'])
call(['cp', 'skill.py', 'zip_folder/'])
call(['cp', '-rf', 'data/', 'zip_folder/data/'])
FNULL = open(os.devnull, 'w')
call(['pip', 'install', 'requests', '-t', 'zip_folder'], stdout=FNULL, stderr=subprocess.STDOUT)
# Zip contents of zip_folder
print("Zipping contents")
shutil.make_archive('cryptoprice', 'zip', 'zip_folder')
# Remove folders used to create zip
print("Removing unneeded files")
call(['rm', '-rf', 'zip_folder'])
print("Build success")