src/eric7/PipInterface/Pip.py

branch
eric7-maintenance
changeset 9371
1da8bc75946f
parent 9305
3b7ef53c34c7
parent 9323
6ae7193558ac
child 9442
906485dcd210
equal deleted inserted replaced
9306:90dc02c8a384 9371:1da8bc75946f
472 dia = PipDialog(self.tr("Install Packages from Requirements")) 472 dia = PipDialog(self.tr("Install Packages from Requirements"))
473 res = dia.startProcess(interpreter, args) 473 res = dia.startProcess(interpreter, args)
474 if res: 474 if res:
475 dia.exec() 475 dia.exec()
476 476
477 def installEditableProject(self, interpreter, projectPath):
478 """
479 Public method to install a project in development mode.
480
481 @param interpreter interpreter to be used for execution
482 @type str
483 @param projectPath path of the project
484 @type str
485 """
486 if interpreter and projectPath:
487 args = ["-m", "pip", "install"]
488 if Preferences.getPip("PipSearchIndex"):
489 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple"
490 args += ["--index-url", indexUrl]
491 args += ["--editable", projectPath]
492
493 dia = PipDialog(self.tr("Install Project"))
494 res = dia.startProcess(interpreter, args)
495 if res:
496 dia.exec()
497
477 def uninstallPackages(self, packages, venvName): 498 def uninstallPackages(self, packages, venvName):
478 """ 499 """
479 Public method to uninstall the given list of packages. 500 Public method to uninstall the given list of packages.
480 501
481 @param packages list of packages to uninstall 502 @param packages list of packages to uninstall
989 dependencies = [] 1010 dependencies = []
990 1011
991 if envName: 1012 if envName:
992 interpreter = self.getVirtualenvInterpreter(envName) 1013 interpreter = self.getVirtualenvInterpreter(envName)
993 if interpreter: 1014 if interpreter:
994 from . import pipdeptree
995
996 with open(pipdeptree.__file__, "r") as f:
997 content = f.read()
998 args = [ 1015 args = [
999 "-c", 1016 os.path.join(os.path.dirname(__file__), "pipdeptree.py"),
1000 content,
1001 "--json-tree", 1017 "--json-tree",
1002 ] 1018 ]
1003 if localPackages: 1019 if localPackages:
1004 args.append("--local-only") 1020 args.append("--local-only")
1005 if usersite: 1021 if usersite:
1046 licenses = [] 1062 licenses = []
1047 1063
1048 if envName: 1064 if envName:
1049 interpreter = self.getVirtualenvInterpreter(envName) 1065 interpreter = self.getVirtualenvInterpreter(envName)
1050 if interpreter: 1066 if interpreter:
1051 from . import piplicenses 1067
1052
1053 with open(piplicenses.__file__, "r") as f:
1054 content = f.read()
1055 args = [ 1068 args = [
1056 "-c", 1069 os.path.join(os.path.dirname(__file__), "piplicenses.py"),
1057 content,
1058 "--from", 1070 "--from",
1059 "mixed", 1071 "mixed",
1060 "--with-system", 1072 "--with-system",
1061 "--with-authors", 1073 "--with-authors",
1062 "--with-urls", 1074 "--with-urls",
1065 if localPackages: 1077 if localPackages:
1066 args.append("--local-only") 1078 args.append("--local-only")
1067 if usersite: 1079 if usersite:
1068 args.append("--user-only") 1080 args.append("--user-only")
1069 if summary: 1081 if summary:
1070 args.append("--summary") 1082 args.append("--summary-by-license")
1071 1083
1072 proc = QProcess() 1084 proc = QProcess()
1073 proc.start(interpreter, args) 1085 proc.start(interpreter, args)
1074 if proc.waitForStarted(15000) and proc.waitForFinished(30000): 1086 if proc.waitForStarted(15000) and proc.waitForFinished(30000):
1075 output = str( 1087 output = str(

eric ide

mercurial