Skip to content

Commit b5f9a49

Browse files
RichhLiRichard Li
and
Richard Li
authored
Fix PATH Order (tensorchord#1679)
* fix path order Signed-off-by: Richard Li <[email protected]> * whitespace Signed-off-by: Richard Li <[email protected]> --------- Signed-off-by: Richard Li <[email protected]> Co-authored-by: Richard Li <[email protected]>
1 parent 1e21826 commit b5f9a49

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

pkg/lang/ir/v1/system.go

+12-7
Original file line numberDiff line numberDiff line change
@@ -353,15 +353,20 @@ func (g *generalGraph) compileBaseImage() (llb.State, error) {
353353
// 1. configured paths in the Starlark frontend `runtime.environ(extra_path=[...])`
354354
// 2. paths in the base image
355355
// 3. others added during the image building (Python paths, etc.)
356-
extraPaths := make(map[string]bool)
357-
for _, path := range strings.Split(kv[1], ":") {
358-
extraPaths[path] = true
359-
}
356+
357+
// iterate over the original paths and add them to the map
358+
pathMap := make(map[string]bool)
360359
for _, path := range g.RuntimeEnvPaths {
361-
extraPaths[path] = false
360+
pathMap[path] = true
362361
}
363-
for path, required := range extraPaths {
364-
if required {
362+
// split the PATH into different paths
363+
newPaths := strings.Split(kv[1], ":")
364+
// iterate over the new paths
365+
for _, path := range newPaths {
366+
// check if the path is already in the map
367+
if _, ok := pathMap[path]; !ok {
368+
// if not, add the path to the map and slice
369+
pathMap[path] = true
365370
g.RuntimeEnvPaths = append(g.RuntimeEnvPaths, path)
366371
}
367372
}

0 commit comments

Comments
 (0)