mirror of https://github.com/databricks/cli.git
clean up redundant comments
This commit is contained in:
parent
ba3062b654
commit
6a7fae08ba
|
@ -130,35 +130,29 @@ func readFile(file *zip.File) ([]byte, error) {
|
||||||
// The function is idempotent: repeated calls with the same input will produce the same output.
|
// The function is idempotent: repeated calls with the same input will produce the same output.
|
||||||
// If the target wheel already exists, it returns the path to the existing wheel without processing.
|
// If the target wheel already exists, it returns the path to the existing wheel without processing.
|
||||||
func PatchWheel(ctx context.Context, path, outputDir string) (string, error) {
|
func PatchWheel(ctx context.Context, path, outputDir string) (string, error) {
|
||||||
// Get the modification time of the input wheel
|
|
||||||
fileInfo, err := os.Stat(path)
|
fileInfo, err := os.Stat(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
wheelMtime := fileInfo.ModTime().UTC()
|
wheelMtime := fileInfo.ModTime().UTC()
|
||||||
|
|
||||||
// Parse the wheel filename to extract components
|
|
||||||
wheelInfo, err := ParseWheelFilename(path)
|
wheelInfo, err := ParseWheelFilename(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the base version without any local version
|
|
||||||
baseVersion := strings.SplitN(wheelInfo.Version, "+", 2)[0]
|
baseVersion := strings.SplitN(wheelInfo.Version, "+", 2)[0]
|
||||||
|
|
||||||
// Calculate the timestamp suffix for the new version
|
|
||||||
dt := strings.Replace(wheelMtime.Format("20060102150405.00"), ".", "", 1)
|
dt := strings.Replace(wheelMtime.Format("20060102150405.00"), ".", "", 1)
|
||||||
dt = strings.Replace(dt, ".", "", 1)
|
dt = strings.Replace(dt, ".", "", 1)
|
||||||
newVersion := baseVersion + "+" + dt
|
newVersion := baseVersion + "+" + dt
|
||||||
|
|
||||||
// Create the new wheel filename
|
|
||||||
newFilename := fmt.Sprintf("%s-%s-%s.whl",
|
newFilename := fmt.Sprintf("%s-%s-%s.whl",
|
||||||
wheelInfo.Distribution,
|
wheelInfo.Distribution,
|
||||||
newVersion,
|
newVersion,
|
||||||
strings.Join(wheelInfo.Tags, "-"))
|
strings.Join(wheelInfo.Tags, "-"))
|
||||||
outpath := filepath.Join(outputDir, newFilename)
|
outpath := filepath.Join(outputDir, newFilename)
|
||||||
|
|
||||||
// Check if the target wheel already exists
|
|
||||||
if _, err := os.Stat(outpath); err == nil {
|
if _, err := os.Stat(outpath); err == nil {
|
||||||
// Target wheel already exists, return its path
|
// Target wheel already exists, return its path
|
||||||
return outpath, nil
|
return outpath, nil
|
||||||
|
|
Loading…
Reference in New Issue