mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-20939 Fixed: PyCharm should not suggest to update locally patched package of the last version
Override compareVersions in PyPackageManagementService to catch equal package versions which are not handled by VERSION_COMPARATOR
This commit is contained in:
@@ -333,7 +333,7 @@ public class PyRequirement {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static PyRequirementVersionSpec calculateVersionSpec(@NotNull String version, @NotNull PyRequirementRelation expectedRelation) {
|
||||
public static PyRequirementVersionSpec calculateVersionSpec(@NotNull String version, @NotNull PyRequirementRelation expectedRelation) {
|
||||
final String normalizedVersion = PyRequirementVersionNormalizer.normalize(version);
|
||||
|
||||
return normalizedVersion == null ?
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,6 +29,7 @@ import com.intellij.webcore.packaging.PackageManagementServiceEx;
|
||||
import com.intellij.webcore.packaging.RepoPackage;
|
||||
import com.jetbrains.python.packaging.*;
|
||||
import com.jetbrains.python.packaging.PyPIPackageUtil.PackageDetails;
|
||||
import com.jetbrains.python.packaging.requirement.PyRequirementRelation;
|
||||
import com.jetbrains.python.psi.LanguageLevel;
|
||||
import com.jetbrains.python.sdk.PySdkUtil;
|
||||
import com.jetbrains.python.sdk.PythonSdkType;
|
||||
@@ -386,4 +387,14 @@ public class PyPackageManagementService extends PackageManagementServiceEx {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareVersions(@NotNull String version1, @NotNull String version2) {
|
||||
if (PyRequirement.calculateVersionSpec(version2, PyRequirementRelation.EQ).matches(version1)) {
|
||||
// Here we're catching the case described in PY-20939.
|
||||
// The order of 'version1' and 'version2' is important: version2 is an available version which version1 tries to match
|
||||
return 0;
|
||||
}
|
||||
return super.compareVersions(version1, version2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user