aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-12-27 03:57:49 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-12-27 03:57:49 +0100
commit879e295de04bc0699462c959a1d331dcf5446345 (patch)
tree998d651a0a38b310dc396994c80d5b693d2ec225 /src
parent7adc75dedf789c61ca15b0ccf239367b171be30c (diff)
downloadblogc-879e295de04bc0699462c959a1d331dcf5446345.tar.gz
blogc-879e295de04bc0699462c959a1d331dcf5446345.tar.bz2
blogc-879e295de04bc0699462c959a1d331dcf5446345.zip
github-lambda: drop external dependencies
Diffstat (limited to 'src')
-rw-r--r--src/blogc-github-lambda/lambda_function.py18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/blogc-github-lambda/lambda_function.py b/src/blogc-github-lambda/lambda_function.py
index 3f7d13d..44f1bc9 100644
--- a/src/blogc-github-lambda/lambda_function.py
+++ b/src/blogc-github-lambda/lambda_function.py
@@ -22,9 +22,7 @@ import urllib2
import shutil
cwd = os.path.dirname(os.path.abspath(__file__))
-bindir = os.path.join(cwd, 'bin')
-
-os.environ['PATH'] = '%s:%s' % (bindir, os.environ.get('PATH', ''))
+os.environ['PATH'] = '%s:%s' % (cwd, os.environ.get('PATH', ''))
s3 = boto3.resource('s3')
@@ -33,16 +31,6 @@ if GITHUB_AUTH is not None and ':' not in GITHUB_AUTH:
GITHUB_AUTH = boto3.client('kms').decrypt(
CiphertextBlob=base64.b64decode(GITHUB_AUTH))['Plaintext']
-# this is just a safeguard, just in case lambda stops supporting symlinks
-# in zip files
-for binary in subprocess.check_output([os.path.join(bindir, 'busybox'),
- '--list']).split():
- dst = os.path.join(bindir, binary)
- if not os.path.islink(dst):
- os.symlink('busybox', dst)
- else:
- break # if one symlink exists, all the others will likely exist
-
def get_tarball(repo_name):
tarball_url = 'https://api.github.com/repos/%s/tarball/master' % repo_name
@@ -157,8 +145,8 @@ def lambda_handler(event, context):
stream = None if debug else subprocess.PIPE
rootdir = get_tarball(payload['repository']['full_name'])
- rv = subprocess.call([os.path.join(bindir, 'make'), '-C', rootdir,
- 'BLOGC=%s' % os.path.join(bindir, 'blogc'),
+ rv = subprocess.call(['make', '-C', rootdir,
+ 'BLOGC=%s' % os.path.join(cwd, 'blogc'),
'OUTPUT_DIR=_build'],
stdout=stream, stderr=stream)
if rv != 0: