@@ -166,34 +166,22 @@ def build(src, requirements=False, local_package=None, raw_copy=None):
166166 path_to_dist = os .path .join (src , dist_directory )
167167 mkdir (path_to_dist )
168168
169+ path_to_temp = mkdtemp (prefix = 'aws-lambda' )
170+
171+ if raw_copy :
172+ bin_dir = os .path .join (path_to_temp , "lambda_bin" )
173+ import shutil
174+ shutil .copytree (raw_copy , bin_dir )
175+
169176 # Combine the name of the Lambda function with the current timestamp to use
170177 # for the output filename.
171178 function_name = cfg .get ('function_name' )
172179 output_filename = "{0}-{1}.zip" .format (timestamp (), function_name )
173180
174- path_to_temp = mkdtemp (prefix = 'aws-lambda' )
175181 pip_install_to_target (path_to_temp ,
176182 requirements = requirements ,
177183 local_package = local_package )
178184
179- if raw_copy :
180- raw_files = []
181- for filename in os .listdir (raw_copy ):
182- if os .path .isfile (filename ):
183- if filename == '.DS_Store' :
184- continue
185- if filename == 'config.yaml' :
186- continue
187- raw_files .append (os .path .join (src , filename ))
188-
189- # "cd" into `temp_path` directory.
190- os .chdir (path_to_temp )
191- for f in raw_files :
192- _ , filename = os .path .split (f )
193-
194- # Copy handler file into root of the packages folder.
195- copyfile (f , os .path .join (path_to_temp , filename ))
196-
197185
198186 # Gracefully handle whether ".zip" was included in the filename or not.
199187 output_filename = ('{0}.zip' .format (output_filename )
0 commit comments