mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
Make the run_mypy.py script find Uranium via the PYTHONPATH env var.
This commit is contained in:
parent
42982b7a86
commit
60d4e6e4fd
1 changed files with 11 additions and 4 deletions
15
run_mypy.py
15
run_mypy.py
|
@ -4,8 +4,7 @@ import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
# A quick Python implementation of unix 'where' command.
|
# A quick Python implementation of unix 'where' command.
|
||||||
def where(exeName):
|
def where(exeName, searchPath=os.getenv("PATH")):
|
||||||
searchPath = os.getenv("PATH")
|
|
||||||
paths = searchPath.split(";" if sys.platform == "win32" else ":")
|
paths = searchPath.split(";" if sys.platform == "win32" else ":")
|
||||||
for path in paths:
|
for path in paths:
|
||||||
candidatePath = os.path.join(path, exeName)
|
candidatePath = os.path.join(path, exeName)
|
||||||
|
@ -21,10 +20,18 @@ def findModules(path):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
# Find Uranium via the PYTHONPATH var
|
||||||
|
uraniumUMPath = where("UM", os.getenv("PYTHONPATH"))
|
||||||
|
if uraniumUMPath is None:
|
||||||
|
uraniumUMPath = os.path.join("..", "Uranium")
|
||||||
|
uraniumPath = os.path.dirname(uraniumUMPath)
|
||||||
|
|
||||||
|
mypyPathParts = [".", os.path.join(".", "plugins"), os.path.join(".", "plugins", "VersionUpgrade"),
|
||||||
|
uraniumPath, os.path.join(uraniumPath, "stubs")]
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
os.putenv("MYPYPATH", r".;.\plugins;.\plugins\VersionUpgrade;..\Uranium\;..\Uranium\stubs\\" )
|
os.putenv("MYPYPATH", ";".join(mypyPathParts))
|
||||||
else:
|
else:
|
||||||
os.putenv("MYPYPATH", r".:./plugins:./plugins/VersionUpgrade:../Uranium/:../Uranium\stubs/")
|
os.putenv("MYPYPATH", ":".join(mypyPathParts))
|
||||||
|
|
||||||
# Mypy really needs to be run via its Python script otherwise it can't find its data files.
|
# Mypy really needs to be run via its Python script otherwise it can't find its data files.
|
||||||
mypyExe = where("mypy.bat" if sys.platform == "win32" else "mypy")
|
mypyExe = where("mypy.bat" if sys.platform == "win32" else "mypy")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue