Skip to content

Commit

Permalink
WIP: for python3
Browse files Browse the repository at this point in the history
  • Loading branch information
smellman committed Dec 18, 2019
1 parent 6d68c99 commit b0bdb8c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ COPY requirements.txt /opt/app/requirements.txt

# Install packages
RUN yum update -y
RUN yum install -y cpio python2-pip yum-utils zip unzip less
RUN yum install -y cpio python3-pip yum-utils zip unzip less
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

# This had --no-cache-dir, tracing through multiple tickets led to a problem in wheel
RUN pip install -r requirements.txt
RUN pip3 install -r requirements.txt
RUN rm -rf /root/.cache/pip

# Download libraries we need to run in lambda
Expand All @@ -39,7 +39,7 @@ RUN echo "CompressLocalDatabase yes" >> /opt/app/bin/freshclam.conf
WORKDIR /opt/app
RUN zip -r9 --exclude="*test*" /opt/app/build/lambda.zip *.py bin

WORKDIR /usr/lib/python2.7/site-packages
WORKDIR /usr/lib/python3.7/site-packages
RUN zip -r9 /opt/app/build/lambda.zip *

WORKDIR /opt/app
2 changes: 1 addition & 1 deletion clamav.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@


def current_library_search_path():
ld_verbose = subprocess.check_output(["ld", "--verbose"])
ld_verbose = subprocess.check_output(["ld", "--verbose"]).decode('utf-8')
rd_ld = re.compile(RE_SEARCH_DIR)
return rd_ld.findall(ld_verbose)

Expand Down
4 changes: 2 additions & 2 deletions scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import copy
import json
import os
import urllib
from urllib.parse import unquote_plus
from distutils.util import strtobool

import boto3
Expand Down Expand Up @@ -66,7 +66,7 @@ def event_object(event, event_source="s3"):
key_name = s3_obj["object"].get("key", None)

if key_name:
key_name = urllib.unquote_plus(key_name.encode("utf8"))
key_name = unquote_plus(key_name)

# Ensure both bucket and key exist
if (not bucket_name) or (not key_name):
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-scan-lambda
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ docker run --rm \
--memory-swap="${MEM}" \
--cpus="${CPUS}" \
--name="${NAME}" \
lambci/lambda:python2.7 scan.lambda_handler "${EVENT}"
lambci/lambda:python3.7 scan.lambda_handler "${EVENT}"
2 changes: 1 addition & 1 deletion scripts/run-update-lambda
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ docker run --rm \
--memory-swap="${MEM}" \
--cpus="${CPUS}" \
--name="${NAME}" \
lambci/lambda:python2.7 update.lambda_handler
lambci/lambda:python3.7 update.lambda_handler

0 comments on commit b0bdb8c

Please sign in to comment.