Rename bundle root path

This commit is contained in:
Gleb Kanterov 2024-10-08 10:18:52 +02:00
parent df61375995
commit 43ce278299
No known key found for this signature in database
GPG Key ID: 4D87C640DBD00176
1 changed files with 11 additions and 11 deletions

View File

@ -111,10 +111,10 @@ func (m *pythonMutator) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagno
} }
rightRoot, diags := m.runPythonMutator(ctx, leftRoot, runPythonMutatorOpts{ rightRoot, diags := m.runPythonMutator(ctx, leftRoot, runPythonMutatorOpts{
cacheDir: cacheDir, cacheDir: cacheDir,
rootPath: b.BundleRootPath, bundleRootPath: b.BundleRootPath,
pythonPath: pythonPath, pythonPath: pythonPath,
loadLocations: experimental.PyDABs.LoadLocations, loadLocations: experimental.PyDABs.LoadLocations,
}) })
mutateDiags = diags mutateDiags = diags
if diags.HasError() { if diags.HasError() {
@ -160,10 +160,10 @@ func createCacheDir(ctx context.Context) (string, error) {
} }
type runPythonMutatorOpts struct { type runPythonMutatorOpts struct {
cacheDir string cacheDir string
rootPath string bundleRootPath string
pythonPath string pythonPath string
loadLocations bool loadLocations bool
} }
func (m *pythonMutator) runPythonMutator(ctx context.Context, root dyn.Value, opts runPythonMutatorOpts) (dyn.Value, diag.Diagnostics) { func (m *pythonMutator) runPythonMutator(ctx context.Context, root dyn.Value, opts runPythonMutatorOpts) (dyn.Value, diag.Diagnostics) {
@ -204,7 +204,7 @@ func (m *pythonMutator) runPythonMutator(ctx context.Context, root dyn.Value, op
_, processErr := process.Background( _, processErr := process.Background(
ctx, ctx,
args, args,
process.WithDir(opts.rootPath), process.WithDir(opts.bundleRootPath),
process.WithStderrWriter(stderrWriter), process.WithStderrWriter(stderrWriter),
process.WithStdoutWriter(stdoutWriter), process.WithStdoutWriter(stdoutWriter),
) )
@ -245,7 +245,7 @@ func (m *pythonMutator) runPythonMutator(ctx context.Context, root dyn.Value, op
return dyn.InvalidValue, diag.Errorf("failed to load locations: %s", err) return dyn.InvalidValue, diag.Errorf("failed to load locations: %s", err)
} }
output, outputDiags := loadOutputFile(opts.rootPath, outputPath, locations) output, outputDiags := loadOutputFile(opts.bundleRootPath, outputPath, locations)
pythonDiagnostics = pythonDiagnostics.Extend(outputDiags) pythonDiagnostics = pythonDiagnostics.Extend(outputDiags)
// we pass through pythonDiagnostic because it contains warnings // we pass through pythonDiagnostic because it contains warnings
@ -317,7 +317,7 @@ func loadOutputFile(rootPath string, outputPath string, locations *pythonLocatio
// we need absolute path because later parts of pipeline assume all paths are absolute // we need absolute path because later parts of pipeline assume all paths are absolute
// and this file will be used as location to resolve relative paths. // and this file will be used as location to resolve relative paths.
// //
// virtualPath has to stay in rootPath, because locations outside root path are not allowed: // virtualPath has to stay in bundleRootPath, because locations outside root path are not allowed:
// //
// Error: path /var/folders/.../pydabs/dist/*.whl is not contained in bundle root path // Error: path /var/folders/.../pydabs/dist/*.whl is not contained in bundle root path
// //