|
9 | 9 | import time
|
10 | 10 | from imp import load_source
|
11 | 11 | from shutil import copy
|
12 |
| -from shutil import copyfile, copytree |
| 12 | +from shutil import copyfile |
13 | 13 | from tempfile import mkdtemp
|
14 |
| -from collections import defaultdict |
15 | 14 |
|
16 | 15 | import boto3
|
17 | 16 | import botocore
|
@@ -243,32 +242,24 @@ def build(src, requirements=False, local_package=None):
|
243 | 242 | else output_filename
|
244 | 243 | )
|
245 | 244 |
|
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 |
| - |
250 | 245 | files = []
|
251 | 246 | for filename in os.listdir(src):
|
252 | 247 | if os.path.isfile(filename):
|
253 | 248 | if filename == '.DS_Store':
|
254 | 249 | continue
|
255 | 250 | if filename == 'config.yaml':
|
256 | 251 | 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)) |
260 | 255 |
|
261 | 256 | # "cd" into `temp_path` directory.
|
262 | 257 | os.chdir(path_to_temp)
|
263 | 258 | 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)) |
272 | 263 |
|
273 | 264 | # Zip them together into a single file.
|
274 | 265 | # TODO: Delete temp directory created once the archive has been compiled.
|
|
0 commit comments