{"action":"created","comment":{"url":"https://api.github.com/repos/awslabs/aws-sam-cli/pulls/comments/234418637","pull_request_review_id":176064916,"id":234418637,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNDQxODYzNw==","diff_hunk":"@@ -0,0 +1,94 @@\n+\n+import os\n+import shutil\n+import yaml\n+\n+from samcli.yamlhelper import yaml_parse\n+from samcli.commands.local.lib.sam_function_provider import SamFunctionProvider\n+\n+\n+class BuildContext(object):\n+\n+    def __init__(self, template_file, source_root, build_dir, clean=False, use_container=False):\n+        self._template_file = template_file\n+        self._source_root = source_root\n+        self._build_dir = build_dir\n+        self._clean = clean\n+        self._use_container = use_container\n+\n+        self._function_provider = None\n+        self._template_dict = None\n+        self._app_builder = None\n+\n+    def __enter__(self):\n+        self._template_dict = self._get_template_data(self._template_file)\n+        self._function_provider = SamFunctionProvider(self._template_dict)\n+\n+        self._build_dir = self._setup_build_dir()\n+\n+        return self\n+\n+    def __exit__(self, *args):\n+        pass\n+\n+    @property\n+    def function_provider(self):\n+        return self._function_provider\n+\n+    @property\n+    def template_dict(self):\n+        return self._template_dict\n+\n+    @property\n+    def build_dir(self):\n+        return self._build_dir\n+\n+    @property\n+    def source_root(self):\n+        return self._source_root\n+\n+    @property\n+    def use_container(self):\n+        return self._use_container\n+\n+    @property\n+    def output_template_path(self):\n+        return os.path.join(self._build_dir, \"built-template.yaml\")\n+\n+    def _setup_build_dir(self):\n+\n+        # Get absolute path\n+        self._build_dir = os.path.abspath(self._build_dir)","path":"samcli/commands/build/build_context.py","position":89,"original_position":61,"commit_id":"6048d676184ff43cc6608231b0d1a0ba4603defe","original_commit_id":"b559395d6dd8f728ca8b20254e366888a298127a","user":{"login":"sanathkr","id":22755571,"node_id":"MDQ6VXNlcjIyNzU1NTcx","avatar_url":"https://avatars3.githubusercontent.com/u/22755571?v=4","gravatar_id":"","url":"https://api.github.com/users/sanathkr","html_url":"https://github.com/sanathkr","followers_url":"https://api.github.com/users/sanathkr/followers","following_url":"https://api.github.com/users/sanathkr/following{/other_user}","gists_url":"https://api.github.com/users/sanathkr/gists{/gist_id}","starred_url":"https://api.github.com/users/sanathkr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanathkr/subscriptions","organizations_url":"https://api.github.com/users/sanathkr/orgs","repos_url":"https://api.github.com/users/sanathkr/repos","events_url":"https://api.github.com/users/sanathkr/events{/privacy}","received_events_url":"https://api.github.com/users/sanathkr/received_events","type":"User","site_admin":false},"body":"changed to use Pathlib","created_at":"2018-11-17T19:32:09Z","updated_at":"2018-11-17T19:32:09Z","html_url":"https://github.com/awslabs/aws-sam-cli/pull/766#discussion_r234418637","pull_request_url":"https://api.github.com/repos/awslabs/aws-sam-cli/pulls/766","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/awslabs/aws-sam-cli/pulls/comments/234418637"},"html":{"href":"https://github.com/awslabs/aws-sam-cli/pull/766#discussion_r234418637"},"pull_request":{"href":"https://api.github.com/repos/awslabs/aws-sam-cli/pulls/766"}},"in_reply_to_id":233315860},"pull_request":{"url":"https://api.github.com/repos/awslabs/aws-sam-cli/pulls/766","id":230676411,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwNjc2NDEx","html_url":"https://github.com/awslabs/aws-sam-cli/pull/766","diff_url":"https://github.com/awslabs/aws-sam-cli/pull/766.diff","patch_url":"https://github.com/awslabs/aws-sam-cli/pull/766.patch","issue_url":"https://api.github.com/repos/awslabs/aws-sam-cli/issues/766","number":766,"state":"open","locked":false,"title":"WIP: Implementation of \"sam build\" CLI command","user":{"login":"sanathkr","id":22755571,"node_id":"MDQ6VXNlcjIyNzU1NTcx","avatar_url":"https://avatars3.githubusercontent.com/u/22755571?v=4","gravatar_id":"","url":"https://api.github.com/users/sanathkr","html_url":"https://github.com/sanathkr","followers_url":"https://api.github.com/users/sanathkr/followers","following_url":"https://api.github.com/users/sanathkr/following{/other_user}","gists_url":"https://api.github.com/users/sanathkr/gists{/gist_id}","starred_url":"https://api.github.com/users/sanathkr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanathkr/subscriptions","organizations_url":"https://api.github.com/users/sanathkr/orgs","repos_url":"https://api.github.com/users/sanathkr/repos","events_url":"https://api.github.com/users/sanathkr/events{/privacy}","received_events_url":"https://api.github.com/users/sanathkr/received_events","type":"User","site_admin":false},"body":"*Description of changes:*\r\nImplementation of #743 - `sam build` command.\r\n\r\nThis PR is a very early implementation. It supports only Python functions, integrates with `aws-lambda-builders` project, and doesn't have any tests\r\n\r\n![sambuild](https://user-images.githubusercontent.com/22755571/48452650-e2a4d800-e764-11e8-9658-c5f17d897154.gif)\r\n\r\n\r\nBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.\r\n","created_at":"2018-11-14T00:57:57Z","updated_at":"2018-11-17T19:32:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6bb03d8774d8e55617762e2ed427c043dd74d576","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/awslabs/aws-sam-cli/pulls/766/commits","review_comments_url":"https://api.github.com/repos/awslabs/aws-sam-cli/pulls/766/comments","review_comment_url":"https://api.github.com/repos/awslabs/aws-sam-cli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/awslabs/aws-sam-cli/issues/766/comments","statuses_url":"https://api.github.com/repos/awslabs/aws-sam-cli/statuses/6048d676184ff43cc6608231b0d1a0ba4603defe","head":{"label":"sanathkr:sambuild","ref":"sambuild","sha":"6048d676184ff43cc6608231b0d1a0ba4603defe","user":{"login":"sanathkr","id":22755571,"node_id":"MDQ6VXNlcjIyNzU1NTcx","avatar_url":"https://avatars3.githubusercontent.com/u/22755571?v=4","gravatar_id":"","url":"https://api.github.com/users/sanathkr","html_url":"https://github.com/sanathkr","followers_url":"https://api.github.com/users/sanathkr/followers","following_url":"https://api.github.com/users/sanathkr/following{/other_user}","gists_url":"https://api.github.com/users/sanathkr/gists{/gist_id}","starred_url":"https://api.github.com/users/sanathkr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanathkr/subscriptions","organizations_url":"https://api.github.com/users/sanathkr/orgs","repos_url":"https://api.github.com/users/sanathkr/repos","events_url":"https://api.github.com/users/sanathkr/events{/privacy}","received_events_url":"https://api.github.com/users/sanathkr/received_events","type":"User","site_admin":false},"repo":{"id":152456799,"node_id":"MDEwOlJlcG9zaXRvcnkxNTI0NTY3OTk=","name":"aws-sam-cli","full_name":"sanathkr/aws-sam-cli","private":false,"owner":{"login":"sanathkr","id":22755571,"node_id":"MDQ6VXNlcjIyNzU1NTcx","avatar_url":"https://avatars3.githubusercontent.com/u/22755571?v=4","gravatar_id":"","url":"https://api.github.com/users/sanathkr","html_url":"https://github.com/sanathkr","followers_url":"https://api.github.com/users/sanathkr/followers","following_url":"https://api.github.com/users/sanathkr/following{/other_user}","gists_url":"https://api.github.com/users/sanathkr/gists{/gist_id}","starred_url":"https://api.github.com/users/sanathkr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanathkr/subscriptions","organizations_url":"https://api.github.com/users/sanathkr/orgs","repos_url":"https://api.github.com/users/sanathkr/repos","events_url":"https://api.github.com/users/sanathkr/events{/privacy}","received_events_url":"https://api.github.com/users/sanathkr/received_events","type":"User","site_admin":false},"html_url":"https://github.com/sanathkr/aws-sam-cli","description":"AWS SAM CLI 🐿 is a CLI tool for local development and testing of Serverless applications","fork":true,"url":"https://api.github.com/repos/sanathkr/aws-sam-cli","forks_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/forks","keys_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/teams","hooks_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/hooks","issue_events_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/issues/events{/number}","events_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/events","assignees_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/assignees{/user}","branches_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/branches{/branch}","tags_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/tags","blobs_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/languages","stargazers_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/stargazers","contributors_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/contributors","subscribers_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/subscribers","subscription_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/subscription","commits_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/contents/{+path}","compare_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/merges","archive_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/downloads","issues_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/issues{/number}","pulls_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/labels{/name}","releases_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/releases{/id}","deployments_url":"https://api.github.com/repos/sanathkr/aws-sam-cli/deployments","created_at":"2018-10-10T16:41:42Z","updated_at":"2018-11-11T10:48:15Z","pushed_at":"2018-11-16T02:23:54Z","git_url":"git://github.com/sanathkr/aws-sam-cli.git","ssh_url":"git@github.com:sanathkr/aws-sam-cli.git","clone_url":"https://github.com/sanathkr/aws-sam-cli.git","svn_url":"https://github.com/sanathkr/aws-sam-cli","homepage":"","size":17265,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"awslabs:develop","ref":"develop","sha":"480979f27f9913f7f843c24a04ccaf090364d592","user":{"login":"awslabs","id":3299148,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyOTkxNDg=","avatar_url":"https://avatars0.githubusercontent.com/u/3299148?v=4","gravatar_id":"","url":"https://api.github.com/users/awslabs","html_url":"https://github.com/awslabs","followers_url":"https://api.github.com/users/awslabs/followers","following_url":"https://api.github.com/users/awslabs/following{/other_user}","gists_url":"https://api.github.com/users/awslabs/gists{/gist_id}","starred_url":"https://api.github.com/users/awslabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awslabs/subscriptions","organizations_url":"https://api.github.com/users/awslabs/orgs","repos_url":"https://api.github.com/users/awslabs/repos","events_url":"https://api.github.com/users/awslabs/events{/privacy}","received_events_url":"https://api.github.com/users/awslabs/received_events","type":"Organization","site_admin":false},"repo":{"id":92205085,"node_id":"MDEwOlJlcG9zaXRvcnk5MjIwNTA4NQ==","name":"aws-sam-cli","full_name":"awslabs/aws-sam-cli","private":false,"owner":{"login":"awslabs","id":3299148,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyOTkxNDg=","avatar_url":"https://avatars0.githubusercontent.com/u/3299148?v=4","gravatar_id":"","url":"https://api.github.com/users/awslabs","html_url":"https://github.com/awslabs","followers_url":"https://api.github.com/users/awslabs/followers","following_url":"https://api.github.com/users/awslabs/following{/other_user}","gists_url":"https://api.github.com/users/awslabs/gists{/gist_id}","starred_url":"https://api.github.com/users/awslabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awslabs/subscriptions","organizations_url":"https://api.github.com/users/awslabs/orgs","repos_url":"https://api.github.com/users/awslabs/repos","events_url":"https://api.github.com/users/awslabs/events{/privacy}","received_events_url":"https://api.github.com/users/awslabs/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/awslabs/aws-sam-cli","description":"AWS SAM CLI 🐿 is a CLI tool for local development and testing of Serverless applications","fork":false,"url":"https://api.github.com/repos/awslabs/aws-sam-cli","forks_url":"https://api.github.com/repos/awslabs/aws-sam-cli/forks","keys_url":"https://api.github.com/repos/awslabs/aws-sam-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/awslabs/aws-sam-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/awslabs/aws-sam-cli/teams","hooks_url":"https://api.github.com/repos/awslabs/aws-sam-cli/hooks","issue_events_url":"https://api.github.com/repos/awslabs/aws-sam-cli/issues/events{/number}","events_url":"https://api.github.com/repos/awslabs/aws-sam-cli/events","assignees_url":"https://api.github.com/repos/awslabs/aws-sam-cli/assignees{/user}","branches_url":"https://api.github.com/repos/awslabs/aws-sam-cli/branches{/branch}","tags_url":"https://api.github.com/repos/awslabs/aws-sam-cli/tags","blobs_url":"https://api.github.com/repos/awslabs/aws-sam-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/awslabs/aws-sam-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/awslabs/aws-sam-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/awslabs/aws-sam-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/awslabs/aws-sam-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/awslabs/aws-sam-cli/languages","stargazers_url":"https://api.github.com/repos/awslabs/aws-sam-cli/stargazers","contributors_url":"https://api.github.com/repos/awslabs/aws-sam-cli/contributors","subscribers_url":"https://api.github.com/repos/awslabs/aws-sam-cli/subscribers","subscription_url":"https://api.github.com/repos/awslabs/aws-sam-cli/subscription","commits_url":"https://api.github.com/repos/awslabs/aws-sam-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/awslabs/aws-sam-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/awslabs/aws-sam-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/awslabs/aws-sam-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/awslabs/aws-sam-cli/contents/{+path}","compare_url":"https://api.github.com/repos/awslabs/aws-sam-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/awslabs/aws-sam-cli/merges","archive_url":"https://api.github.com/repos/awslabs/aws-sam-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/awslabs/aws-sam-cli/downloads","issues_url":"https://api.github.com/repos/awslabs/aws-sam-cli/issues{/number}","pulls_url":"https://api.github.com/repos/awslabs/aws-sam-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/awslabs/aws-sam-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/awslabs/aws-sam-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/awslabs/aws-sam-cli/labels{/name}","releases_url":"https://api.github.com/repos/awslabs/aws-sam-cli/releases{/id}","deployments_url":"https://api.github.com/repos/awslabs/aws-sam-cli/deployments","created_at":"2017-05-23T18:16:23Z","updated_at":"2018-11-16T23:14:29Z","pushed_at":"2018-11-16T02:23:56Z","git_url":"git://github.com/awslabs/aws-sam-cli.git","ssh_url":"git@github.com:awslabs/aws-sam-cli.git","clone_url":"https://github.com/awslabs/aws-sam-cli.git","svn_url":"https://github.com/awslabs/aws-sam-cli","homepage":"","size":17209,"stargazers_count":3473,"watchers_count":3473,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":476,"mirror_url":null,"archived":false,"open_issues_count":120,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":476,"open_issues":120,"watchers":3473,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/awslabs/aws-sam-cli/pulls/766"},"html":{"href":"https://github.com/awslabs/aws-sam-cli/pull/766"},"issue":{"href":"https://api.github.com/repos/awslabs/aws-sam-cli/issues/766"},"comments":{"href":"https://api.github.com/repos/awslabs/aws-sam-cli/issues/766/comments"},"review_comments":{"href":"https://api.github.com/repos/awslabs/aws-sam-cli/pulls/766/comments"},"review_comment":{"href":"https://api.github.com/repos/awslabs/aws-sam-cli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/awslabs/aws-sam-cli/pulls/766/commits"},"statuses":{"href":"https://api.github.com/repos/awslabs/aws-sam-cli/statuses/6048d676184ff43cc6608231b0d1a0ba4603defe"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sanathkr"}}