ProjectPyramid/Project.py

changeset 91
893e1f0baf23
parent 88
464745dfb03a
child 95
2b0933087db9
equal deleted inserted replaced
90:020b73b61327 91:893e1f0baf23
602 if virtEnv: 602 if virtEnv:
603 fullCmd = self.getPyramidCommand(cmd, variant) 603 fullCmd = self.getPyramidCommand(cmd, variant)
604 if fullCmd != cmd: 604 if fullCmd != cmd:
605 variants.append(variant) 605 variants.append(variant)
606 else: 606 else:
607 fullCmd = self.getPyramidCommand(cmd, variant)
607 if isWindowsPlatform(): 608 if isWindowsPlatform():
608 debugEnv = self.__getDebugEnvironment(variant) 609 if fullCmd != cmd:
609 fullCmd = os.path.join(debugEnv, "Scripts", cmd)
610 if variant.lower() in fullCmd.lower():
611 variants.append(variant) 610 variants.append(variant)
612 else: 611 else:
613 try: 612 try:
614 fullCmds = Utilities.getExecutablePaths(cmd) 613 fullCmds = Utilities.getExecutablePaths(cmd)
615 except AttributeError: 614 except AttributeError:
691 """ 690 """
692 virtualEnv = self.__getVirtualEnvironment(language) 691 virtualEnv = self.__getVirtualEnvironment(language)
693 if isWindowsPlatform() and not virtualEnv: 692 if isWindowsPlatform() and not virtualEnv:
694 virtualEnv = self.__getDebugEnvironment(language) 693 virtualEnv = self.__getDebugEnvironment(language)
695 if isWindowsPlatform(): 694 if isWindowsPlatform():
696 cmd = os.path.join(virtualEnv, "Scripts", cmd + '.exe') 695 fullCmds = [
696 os.path.join(virtualEnv, "Scripts", cmd + '.exe'),
697 os.path.join(virtualEnv, "bin", cmd + '.exe'),
698 cmd # fall back to just cmd
699 ]
700 for cmd in fullCmds:
701 if os.path.exists(cmd):
702 break
697 else: 703 else:
698 fullCmds = [ 704 fullCmds = [
699 os.path.join(virtualEnv, "bin", cmd), 705 os.path.join(virtualEnv, "bin", cmd),
700 os.path.join(virtualEnv, "local", "bin", cmd), 706 os.path.join(virtualEnv, "local", "bin", cmd),
701 Utilities.getExecutablePath(cmd), 707 Utilities.getExecutablePath(cmd),
711 Public method to build the Python command. 717 Public method to build the Python command.
712 718
713 @return python command (string) 719 @return python command (string)
714 """ 720 """
715 language = self.__e5project.getProjectLanguage() 721 language = self.__e5project.getProjectLanguage()
716 pythonExe = "python" 722 virtualEnv = self.__getVirtualEnvironment()
717 if isWindowsPlatform(): 723 if isWindowsPlatform():
718 pythonExe += ".exe" 724 pythonExeList = ["python.exe", "pypy.exe"]
725 if not virtualEnv:
726 virtualEnv = self.__getDebugEnvironment(language)
727 for pythonExe in pythonExeList:
728 for python in [
729 os.path.join(virtualEnv, "Scripts", pythonExe),
730 os.path.join(virtualEnv, "bin", pythonExe),
731 os.path.join(virtualEnv, pythonExe)
732 ]:
733 if os.path.exists(python):
734 break
735 else:
736 python = ""
737
738 if python:
739 break
740 else:
741 python = ""
719 else: 742 else:
720 if language == "Python3": 743 if language == "Python3":
721 pythonExe = "python3" 744 pythonExeList = ["python3", "pypy3"]
722 elif language == "Python2": 745 elif language == "Python2":
723 pythonExe = "python2" 746 pythonExeList = ["python2", "pypy2"]
724 virtualEnv = self.__getVirtualEnvironment() 747 if not virtualEnv:
725 if isWindowsPlatform() and not virtualEnv: 748 pythonExeList.append("pypy")
726 virtualEnv = self.__getDebugEnvironment(language) 749 virtualEnv = self.__getDebugEnvironment(language)
727 if virtualEnv: 750
728 if isWindowsPlatform(): 751 for pythonExe in pythonExeList:
729 python = os.path.join(virtualEnv, "Scripts", pythonExe) 752 for python in [
730 if not os.path.exists(python): 753 os.path.join(virtualEnv, "bin", pythonExe),
731 python = os.path.join(virtualEnv, pythonExe) 754 # omit the version character
755 os.path.join(virtualEnv, "bin", pythonExe)[:-1],
756 ]:
757 if os.path.exists(python):
758 break
759 else:
760 python = ""
761
762 if python:
763 break
732 else: 764 else:
733 python = os.path.join(virtualEnv, "bin", pythonExe) 765 python = ""
734 if not os.path.exists(python):
735 python = python[:-1] # omit the version character
736 else:
737 python = pythonExe
738 766
739 return python 767 return python
740 768
741 def __pyramidInfo(self): 769 def __pyramidInfo(self):
742 """ 770 """

eric ide

mercurial