github.com/databricks/cli@v0.203.0/bundle/artifacts/whl/infer.go (about)

     1  package whl
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  
     7  	"github.com/databricks/cli/bundle"
     8  	"github.com/databricks/cli/python"
     9  )
    10  
    11  type infer struct {
    12  	name string
    13  }
    14  
    15  func (m *infer) Apply(ctx context.Context, b *bundle.Bundle) error {
    16  	artifact := b.Config.Artifacts[m.name]
    17  	py, err := python.DetectExecutable(ctx)
    18  	if err != nil {
    19  		return err
    20  	}
    21  	artifact.BuildCommand = fmt.Sprintf("%s setup.py bdist_wheel", py)
    22  
    23  	return nil
    24  }
    25  
    26  func (m *infer) Name() string {
    27  	return fmt.Sprintf("artifacts.whl.Infer(%s)", m.name)
    28  }
    29  
    30  func InferBuildCommand(name string) bundle.Mutator {
    31  	return &infer{
    32  		name: name,
    33  	}
    34  }