7 Module implementing some common utility functions for the Mercurial package. |
7 Module implementing some common utility functions for the Mercurial package. |
8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 import re |
11 import re |
12 import sys |
|
13 |
12 |
14 from PyQt6.QtCore import QProcess, QProcessEnvironment, QCoreApplication |
13 from PyQt6.QtCore import QProcess, QProcessEnvironment, QCoreApplication |
15 |
14 |
16 from eric7 import Utilities |
15 from eric7 import Utilities |
17 from eric7.Globals import isWindowsPlatform |
16 from eric7.Globals import isWindowsPlatform |
29 exe = VcsMercurialPlugin.getPreferences("MercurialExecutablePath") |
28 exe = VcsMercurialPlugin.getPreferences("MercurialExecutablePath") |
30 if not exe: |
29 if not exe: |
31 program = "hg" |
30 program = "hg" |
32 if isWindowsPlatform(): |
31 if isWindowsPlatform(): |
33 program += ".exe" |
32 program += ".exe" |
34 dirName = os.path.dirname(sys.executable) |
33 |
35 if os.path.exists(os.path.join(dirName, program)): |
34 progPath = os.path.join(Utilities.getPythonScriptsDirectory(), program) |
36 exe = os.path.join(dirName, program) |
35 if os.path.exists(progPath): |
37 elif os.path.exists(os.path.join(dirName, "Scripts", program)): |
36 exe = progPath |
38 exe = os.path.join(dirName, "Scripts", program) |
|
39 else: |
|
40 dirName = os.path.dirname(sys.executable) |
|
41 if os.path.exists(os.path.join(dirName, program)): |
|
42 exe = os.path.join(dirName, program) |
|
43 |
37 |
44 if not exe: |
38 if not exe: |
45 exe = program |
39 exe = program |
46 |
40 |
47 return exe |
41 return exe |