mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-18404 Not able to install package from devpi repo with old version
This commit is contained in:
@@ -10,7 +10,7 @@ import java.util.Collections;
|
||||
*/
|
||||
public class RepoPackage implements Comparable {
|
||||
private final String myName;
|
||||
private final String myRepoUrl;
|
||||
@Nullable final String myRepoUrl;
|
||||
@Nullable final String myLatestVersion;
|
||||
private final Collection<String> myKeywords;
|
||||
|
||||
@@ -18,11 +18,11 @@ public class RepoPackage implements Comparable {
|
||||
this(name, repoUrl, null);
|
||||
}
|
||||
|
||||
public RepoPackage(String name, String repoUrl, @Nullable String latestVersion) {
|
||||
this(name, repoUrl, latestVersion, Collections.<String>emptyList());
|
||||
public RepoPackage(String name, @Nullable final String repoUrl, @Nullable String latestVersion) {
|
||||
this(name, repoUrl, latestVersion, Collections.emptyList());
|
||||
}
|
||||
|
||||
public RepoPackage(String name, String repoUrl, @Nullable String latestVersion, Collection<String> keywords) {
|
||||
public RepoPackage(String name, @Nullable final String repoUrl, @Nullable String latestVersion, Collection<String> keywords) {
|
||||
myName = name;
|
||||
myRepoUrl = repoUrl;
|
||||
myLatestVersion = latestVersion;
|
||||
@@ -33,6 +33,7 @@ public class RepoPackage implements Comparable {
|
||||
return myName;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getRepoUrl() {
|
||||
return myRepoUrl;
|
||||
}
|
||||
|
||||
@@ -109,6 +109,10 @@ public class PyPIPackageUtil {
|
||||
return Pair.create(pyPackage, null);
|
||||
}
|
||||
|
||||
public static boolean isPyPIRepository(@Nullable final String repository) {
|
||||
return repository != null && repository.startsWith(PYPI_HOST);
|
||||
}
|
||||
|
||||
public void fillAdditionalPackages(@NotNull final String url) {
|
||||
final boolean simpleIndex = url.endsWith("simple/");
|
||||
final List<String> packagesList = parsePyPIListFromWeb(url, simpleIndex);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class PyPackageService implements
|
||||
|
||||
public void addRepository(String repository) {
|
||||
if (repository == null) return;
|
||||
if (repository.startsWith(PyPIPackageUtil.PYPI_HOST)) {
|
||||
if (PyPIPackageUtil.isPyPIRepository(repository)) {
|
||||
PYPI_REMOVED = false;
|
||||
}
|
||||
else {
|
||||
@@ -67,7 +67,7 @@ public class PyPackageService implements
|
||||
public void removeRepository(final String repository) {
|
||||
if (additionalRepositories.contains(repository))
|
||||
additionalRepositories.remove(repository);
|
||||
else if (repository.startsWith(PyPIPackageUtil.PYPI_HOST)) {
|
||||
else if (PyPIPackageUtil.isPyPIRepository(repository)) {
|
||||
PYPI_REMOVED = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public class PyPackageManagementService extends PackageManagementServiceEx {
|
||||
public void installPackage(final RepoPackage repoPackage, String version, boolean forceUpgrade, String extraOptions,
|
||||
final Listener listener, boolean installToUser) {
|
||||
final String packageName = repoPackage.getName();
|
||||
final String repository = PyPIPackageUtil.PYPI_URL.equals(repoPackage.getRepoUrl()) ? null : repoPackage.getRepoUrl();
|
||||
final String repository = PyPIPackageUtil.isPyPIRepository(repoPackage.getRepoUrl()) ? null : repoPackage.getRepoUrl();
|
||||
final List<String> extraArgs = new ArrayList<String>();
|
||||
if (installToUser) {
|
||||
extraArgs.add(PyPackageManager.USE_USER_SITE);
|
||||
@@ -171,7 +171,7 @@ public class PyPackageManagementService extends PackageManagementServiceEx {
|
||||
Collections.addAll(extraArgs, extraOptions.split(" +"));
|
||||
}
|
||||
if (!StringUtil.isEmptyOrSpaces(repository)) {
|
||||
extraArgs.add("--extra-index-url");
|
||||
extraArgs.add("--index-url");
|
||||
extraArgs.add(repository);
|
||||
}
|
||||
if (forceUpgrade) {
|
||||
|
||||
Reference in New Issue
Block a user