Skip to content

Commit 028713e

Browse files
committed
Revert "Related to issue nficano#64 "Subdirectories not included in zip package"."
This reverts commit 893e6e8.
1 parent 893e6e8 commit 028713e

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

aws_lambda/aws_lambda.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
import time
1010
from imp import load_source
1111
from shutil import copy
12-
from shutil import copyfile, copytree
12+
from shutil import copyfile
1313
from tempfile import mkdtemp
14-
from collections import defaultdict
1514

1615
import boto3
1716
import botocore
@@ -243,32 +242,24 @@ def build(src, requirements=False, local_package=None):
243242
else output_filename
244243
)
245244

246-
# Allow definition of source code directories we want to build into our zipped package.
247-
build_config = defaultdict(**cfg.get('build', {}))
248-
source_directories = [d.strip() for d in build_config.get('source_directories', '').split(',')]
249-
250245
files = []
251246
for filename in os.listdir(src):
252247
if os.path.isfile(filename):
253248
if filename == '.DS_Store':
254249
continue
255250
if filename == 'config.yaml':
256251
continue
257-
elif os.path.isdir(filename) and filename in source_directories:
258-
print('Bundling directory: %r' % filename)
259-
files.append(os.path.join(src, filename))
252+
# TODO: Check subdirectories for '.DS_Store' files
253+
print('Bundling: %r' % filename)
254+
files.append(os.path.join(src, filename))
260255

261256
# "cd" into `temp_path` directory.
262257
os.chdir(path_to_temp)
263258
for f in files:
264-
if os.path.isfile(f):
265-
_, filename = os.path.split(f)
266-
267-
# Copy handler file into root of the packages folder.
268-
copyfile(f, os.path.join(path_to_temp, filename))
269-
elif os.path.isdir(f):
270-
destination_folder = os.path.join(path_to_temp, f[len(src) + 1:])
271-
copytree(f, destination_folder)
259+
_, filename = os.path.split(f)
260+
261+
# Copy handler file into root of the packages folder.
262+
copyfile(f, os.path.join(path_to_temp, filename))
272263

273264
# Zip them together into a single file.
274265
# TODO: Delete temp directory created once the archive has been compiled.

aws_lambda/project_templates/config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,3 @@ aws_secret_access_key:
2525
environment_variables:
2626
env_1: foo
2727
env_2: baz
28-
29-
# Build options
30-
build:
31-
include_source_directories: lib # a common delimited list of directories in your project root that contains source to package.

0 commit comments

Comments
 (0)