Merge branch 'master' of git.labs.intellij.net:idea/ultimate

This commit is contained in:
Andrey Vlasovskikh
2012-01-16 12:56:06 +04:00
3 changed files with 27 additions and 3 deletions
+18 -2
View File
@@ -39,6 +39,21 @@ def do_uninstall(pkg):
error_no_pip()
return pip.main(['uninstall', '-y', pkg])
def do_install(pkg, options):
"""
simple realization for install packages
"""
#TODO: test install
try:
import pip
except ImportError:
error("Python package management tool 'pip' not found. Please install 'pip'", ERROR_NO_PACKAGING_TOOLS)
if options:
return pip.main(['install', pkg, options])
else:
return pip.main(['install', pkg])
def main():
retcode = 0
try:
@@ -51,10 +66,11 @@ def main():
usage()
do_list()
elif cmd == 'install':
if len(sys.argv) != 3:
if len(sys.argv) < 3:
usage()
pkg = sys.argv[2]
retcode = do_install(pkg)
options = sys.argv[3]
retcode = do_install(pkg, options)
elif cmd == 'uninstall':
if len(sys.argv) != 3:
usage()
+1
View File
@@ -21,6 +21,7 @@
<orderEntry type="module" module-name="colorSchemes" scope="RUNTIME" />
<orderEntry type="module" module-name="xml" />
<orderEntry type="module" module-name="relaxng" scope="RUNTIME" />
<orderEntry type="library" name="XmlRPC" level="project" />
</component>
</module>
@@ -9,6 +9,7 @@ import com.jetbrains.python.PythonHelpersLocator;
import com.jetbrains.python.sdk.PythonSdkType;
import com.jetbrains.python.sdk.SdkUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.*;
@@ -77,6 +78,11 @@ public class PyPackageManager {
return myPackagesCache;
}
public void installPackage(@NotNull Sdk sdk, @NotNull PyPackage pkg, @Nullable String options) throws PyExternalProcessException {
runPythonHelper(sdk, PACKAGING_TOOL, list("install", pkg.getName(), options));
myPackagesCache.remove(sdk);
}
@NotNull
public String createVirtualEnv(@NotNull String desinationDir) throws PyExternalProcessException {
// TODO: Add boolean systemSitePackages option
@@ -151,7 +157,8 @@ public class PyPackageManager {
final String name = fields.get(0);
final String version = fields.get(1);
final String location = fields.get(2);
packages.add(new PyPackage(name, version, location, new ArrayList<PyRequirement>()));
if (!"Python".equals(name) && !"wsgiref".equals(name))
packages.add(new PyPackage(name, version, location, new ArrayList<PyRequirement>()));
}
return packages;
}