mirror of https://github.com/databricks/cli.git
Correctly mark pypi package name specs with multiple specifiers as remote libraries
This commit is contained in:
parent
edc08149d3
commit
a0c29c9c27
|
@ -77,6 +77,11 @@ func IsLibraryLocal(dep string) bool {
|
|||
var packageRegex = regexp.MustCompile(`^[a-zA-Z0-9\-_]+\s?(\[.*\])?\s?((==|!=|<=|>=|~=|==|>|<)\s?\d+(\.\d+){0,2}(\.\*)?)?$`)
|
||||
|
||||
func isPackage(name string) bool {
|
||||
// If the name contains comma, it's a package name with miultiple version specifiers
|
||||
if strings.Contains(name, ",") {
|
||||
return true
|
||||
}
|
||||
|
||||
if packageRegex.MatchString(name) {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -62,6 +62,8 @@ func TestIsLibraryLocal(t *testing.T) {
|
|||
{path: "beautifulsoup4 ~= 4.12.3", expected: false},
|
||||
{path: "beautifulsoup4[security, tests]", expected: false},
|
||||
{path: "beautifulsoup4[security, tests] ~= 4.12.3", expected: false},
|
||||
{path: "beautifulsoup4>=1.0.0,<2.0.0", expected: false},
|
||||
{path: "beautifulsoup4>=1.0.0,~=1.2.0,<2.0.0", expected: false},
|
||||
{path: "https://github.com/pypa/pip/archive/22.0.2.zip", expected: false},
|
||||
{path: "pip @ https://github.com/pypa/pip/archive/22.0.2.zip", expected: false},
|
||||
{path: "requests [security] @ https://github.com/psf/requests/archive/refs/heads/main.zip", expected: false},
|
||||
|
|
Loading…
Reference in New Issue