localstack / aws-sam-cli-local

Simple wrapper around AWS SAM CLI for use with LocalStack
Apache License 2.0
48 stars 8 forks source link

The wrong path to samlocal is being used in makefile for-loops #8

Open bamajap opened 1 year ago

bamajap commented 1 year ago

I am running my make commands within a Git bash shell on Windows 10.

Actual Makefile target causing the problem:

TEMPLATES = $(shell find . -type f -name 'template.yml')

## Check
## Validate the SAM template
.PHONY: check
check: $(TEMPLATES)
    for template in $^ ; do samlocal validate -t $${template} ; done

Altered Makefile target that easily reproduces the problem:

test: $(shell ls *.*)
    for template in $^ ; do samlocal --version ; done

Running make test with samlocal in the for-loop yields:

C:\My\Path\To\python.exe: can't open file 'C:\\c\\_git\\localstack-poc\\.venv\\Scripts\\samlocal': [Errno 2] No such file or directory
make: *** [Makefile:43: test] Error 2

Running make test with sam in the for-loop yields:

SAM CLI, version 1.61.0

NOTE:

I do NOT have issues running samlocal outside the context of loops (i.e. stand-alone lines). Those commands run successfully.

whummer commented 1 year ago

Thanks for reporting @bamajap . We have just released a new version to pypi - can you please verify if the problem still persists with the latest version of samlocal? Thanks!

bamajap commented 8 months ago

(Apologies for the (very) delayed response, but I had to wait until I could get a new license.)

This is still happening as of version SAM CLI 1.98.0. The C: at the beginning of the path to samlocal should be removed, but it appears that it is still prepended to the path.

lakkeger commented 1 week ago

Hi @bamajap, Just reaching out to check if you were able to resolve this issue or do you need our assistance?