21 lines
461 B
Go
21 lines
461 B
Go
//go:build !linux
|
|
|
|
package isolation
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
func acquirePythonInstallLock(buildRoot, version string) (func(), error) {
|
|
lockPath := filepath.Join(buildRoot, ".install-"+version+".lock")
|
|
if err := os.Mkdir(lockPath, 0700); err != nil {
|
|
if errors.Is(err, os.ErrExist) {
|
|
return nil, errors.New("Python version installation is already running")
|
|
}
|
|
return nil, err
|
|
}
|
|
return func() { _ = os.Remove(lockPath) }, nil
|
|
}
|