Skip to content

Commit

Permalink
Merge pull request #20 from fac/add-python-builder
Browse files Browse the repository at this point in the history
Rename Python build package to lambda-package
  • Loading branch information
YasserBennani authored May 24, 2022
2 parents 97a0286 + 8e87b4e commit 371f9ae
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
serverless-tools (0.4.0)
serverless-tools (0.4.1)
aws-sdk-ecr
aws-sdk-lambda
aws-sdk-s3
Expand Down
11 changes: 6 additions & 5 deletions lib/serverless-tools/deployer/python_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ def build
# Poetry does not have an option to install dependencies to a specified target folder.
# Workaround is generating a requirments.txt file using poetry
`poetry export -f requirements.txt --without-hashes > requirements.txt`
# And then installing them using pip to specified "package" target directory
`pip install -r requirements.txt -t ./package`
# Zipping contents of functions and package folders with the
# And then installing them using pip to specified "lambda-package" target directory
`pip install -r requirements.txt -t lambda-package`
# Zipping contents of functions and lambda-package folders with the
# handler file in a zip as required by AWS
`zip -r "#{local_filename}" #{config.handler_file} src`
`cd package && zip -r "../#{local_filename}" ./*`
`zip -jr "#{local_filename}" #{config.handler_file}`
`zip -r "#{local_filename}" src`
`cd lambda-package && zip -r "../#{local_filename}" ./*`
end

def output
Expand Down
2 changes: 1 addition & 1 deletion lib/serverless-tools/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ServerlessTools
VERSION = "0.4.0"
VERSION = "0.4.1"
end
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# a python project file structure
[tool.poetry]
name = "serverless-tools"
version = "0.4.0"
version = "0.4.1"
description = "FreeAgent Serverless Tools"
authors = ["[email protected]"]

Expand Down
4 changes: 2 additions & 2 deletions test/deployer/python_builder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def assert_file_exists?(exists = true)

File.delete(subject.local_filename)

# Delete package directory created by Python deployer build method
# Delete lambda-package directory created by Python deployer build method
File.delete("requirements.txt")
FileUtils.remove_dir("./package",true)
FileUtils.remove_dir("./lambda-package",true)
end

describe "#local_filename" do
Expand Down

0 comments on commit 371f9ae

Please sign in to comment.