File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed
Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ A brief description of the categories of changes:
6363 dependencies improving initial build times involving external dependency
6464 fetching.
6565
66+ * (gazelle) Improve runfiles lookup hermeticity.
67+
6668## [ 0.25.0] - 2023-08-22
6769
6870### Changed
Original file line number Diff line number Diff line change @@ -38,13 +38,20 @@ var (
3838)
3939
4040func startParserProcess (ctx context.Context ) {
41- parseScriptRunfile , err := runfiles .Rlocation ("rules_python_gazelle_plugin/python/parse" )
41+ rfiles , err := runfiles .New ()
42+ if err != nil {
43+ log .Printf ("failed to create a runfiles object: %v\n " , err )
44+ os .Exit (1 )
45+ }
46+
47+ parseScriptRunfile , err := rfiles .Rlocation ("rules_python_gazelle_plugin/python/parse" )
4248 if err != nil {
4349 log .Printf ("failed to initialize parser: %v\n " , err )
4450 os .Exit (1 )
4551 }
4652
4753 cmd := exec .CommandContext (ctx , parseScriptRunfile )
54+ cmd .Env = append (os .Environ (), rfiles .Env ()... )
4855
4956 cmd .Stderr = os .Stderr
5057
Original file line number Diff line number Diff line change 3939func startStdModuleProcess (ctx context.Context ) {
4040 stdModulesSeen = make (map [string ]struct {})
4141
42- stdModulesScriptRunfile , err := runfiles .Rlocation ("rules_python_gazelle_plugin/python/std_modules" )
42+ rfiles , err := runfiles .New ()
43+ if err != nil {
44+ log .Printf ("failed to create a runfiles object: %v\n " , err )
45+ os .Exit (1 )
46+ }
47+
48+ stdModulesScriptRunfile , err := rfiles .Rlocation ("rules_python_gazelle_plugin/python/std_modules" )
4349 if err != nil {
4450 log .Printf ("failed to initialize std_modules: %v\n " , err )
4551 os .Exit (1 )
@@ -49,7 +55,8 @@ func startStdModuleProcess(ctx context.Context) {
4955
5056 cmd .Stderr = os .Stderr
5157 // All userland site-packages should be ignored.
52- cmd .Env = []string {"PYTHONNOUSERSITE=1" }
58+ cmd .Env = append ([]string {"PYTHONNOUSERSITE=1" }, rfiles .Env ()... )
59+
5360 stdin , err := cmd .StdinPipe ()
5461 if err != nil {
5562 log .Printf ("failed to initialize std_modules: %v\n " , err )
You can’t perform that action at this time.
0 commit comments