eric6/PipInterface/Pip.py

changeset 8222
5994b80b8760
parent 8218
7c09585bd960
child 8234
fcb6b4b96274
equal deleted inserted replaced
8221:0572a215bd2f 8222:5994b80b8760
581 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple" 581 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple"
582 args += ["--index-url", indexUrl] 582 args += ["--index-url", indexUrl]
583 583
584 proc = QProcess() 584 proc = QProcess()
585 proc.start(interpreter, args) 585 proc.start(interpreter, args)
586 if proc.waitForStarted(15000): 586 if proc.waitForStarted(15000) and proc.waitForFinished(30000):
587 if proc.waitForFinished(30000): 587 output = str(proc.readAllStandardOutput(),
588 output = str(proc.readAllStandardOutput(), 588 Preferences.getSystem("IOEncoding"),
589 Preferences.getSystem("IOEncoding"), 589 'replace').strip()
590 'replace').strip() 590 try:
591 try: 591 jsonList = json.loads(output)
592 jsonList = json.loads(output) 592 except Exception:
593 except Exception: 593 jsonList = []
594 jsonList = [] 594
595 595 for package in jsonList:
596 for package in jsonList: 596 if isinstance(package, dict):
597 if isinstance(package, dict): 597 packages.append((
598 packages.append(( 598 package["name"],
599 package["name"], 599 package["version"],
600 package["version"], 600 ))
601 ))
602 601
603 return packages 602 return packages
604 603
605 def getOutdatedPackages(self, envName, localPackages=True, 604 def getOutdatedPackages(self, envName, localPackages=True,
606 notRequired=False, usersite=False): 605 notRequired=False, usersite=False):
643 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple" 642 indexUrl = Preferences.getPip("PipSearchIndex") + "/simple"
644 args += ["--index-url", indexUrl] 643 args += ["--index-url", indexUrl]
645 644
646 proc = QProcess() 645 proc = QProcess()
647 proc.start(interpreter, args) 646 proc.start(interpreter, args)
648 if proc.waitForStarted(15000): 647 if proc.waitForStarted(15000) and proc.waitForFinished(30000):
649 if proc.waitForFinished(30000): 648 output = str(proc.readAllStandardOutput(),
650 output = str(proc.readAllStandardOutput(), 649 Preferences.getSystem("IOEncoding"),
651 Preferences.getSystem("IOEncoding"), 650 'replace').strip()
652 'replace').strip() 651 try:
653 try: 652 jsonList = json.loads(output)
654 jsonList = json.loads(output) 653 except Exception:
655 except Exception: 654 jsonList = []
656 jsonList = [] 655
657 656 for package in jsonList:
658 for package in jsonList: 657 if isinstance(package, dict):
659 if isinstance(package, dict): 658 packages.append((
660 packages.append(( 659 package["name"],
661 package["name"], 660 package["version"],
662 package["version"], 661 package["latest_version"],
663 package["latest_version"], 662 ))
664 ))
665 663
666 return packages 664 return packages
667 665
668 def getPackageDetails(self, name, version): 666 def getPackageDetails(self, name, version):
669 """ 667 """

eric ide

mercurial