Skip to content

Commit ebf03c4

Browse files
committed
Normalize other paths used as input to the plan
Previously, the following paths were normalized: the working directory for commands and the path elements when source_path is a list. With this change, the following paths are normalized too: plain paths given as source_path strings, path values of npm_requirements and pip_requirements.
1 parent b94d49f commit ebf03c4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

package.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,6 @@ def commands_step(path, commands):
767767
commands = map(str.strip, commands.splitlines())
768768

769769
if path:
770-
path = os.path.normpath(path)
771770
step("set:workdir", path)
772771

773772
batch = []
@@ -805,7 +804,7 @@ def commands_step(path, commands):
805804

806805
for claim in claims:
807806
if isinstance(claim, str):
808-
path = claim
807+
path = os.path.normpath(claim)
809808
if not os.path.exists(path):
810809
abort(
811810
'Could not locate source_path "{path}". Paths are relative to directory where `terraform plan` is being run ("{pwd}")'.format(
@@ -823,6 +822,8 @@ def commands_step(path, commands):
823822

824823
elif isinstance(claim, dict):
825824
path = claim.get("path")
825+
if path:
826+
path = os.path.normpath(path)
826827
patterns = claim.get("patterns")
827828
commands = claim.get("commands")
828829
if patterns:
@@ -849,7 +850,7 @@ def commands_step(path, commands):
849850
)
850851
else:
851852
pip_requirements_step(
852-
pip_requirements,
853+
os.path.normpath(pip_requirements),
853854
prefix,
854855
required=True,
855856
tmp_dir=claim.get("pip_tmp_dir"),
@@ -875,13 +876,12 @@ def commands_step(path, commands):
875876
)
876877
else:
877878
npm_requirements_step(
878-
npm_requirements,
879+
os.path.normpath(npm_requirements),
879880
prefix,
880881
required=True,
881882
tmp_dir=claim.get("npm_tmp_dir"),
882883
)
883884
if path:
884-
path = os.path.normpath(path)
885885
step("zip", path, prefix)
886886
if patterns:
887887
# Take patterns into account when computing hash

0 commit comments

Comments
 (0)