Преглед изворни кода

Merge pull request #40257 from Xrayez/custom-modules-expandvars

Expand env vars for `custom_modules` build option
Rémi Verschelde пре 5 година
родитељ
комит
70e21154f0
1 измењених фајлова са 3 додато и 2 уклоњено
  1. 3 2
      methods.py

+ 3 - 2
methods.py

@@ -217,14 +217,15 @@ void unregister_module_types() {
 def convert_custom_modules_path(path):
 def convert_custom_modules_path(path):
     if not path:
     if not path:
         return path
         return path
+    path = os.path.realpath(os.path.expanduser(os.path.expandvars(path)))
     err_msg = "Build option 'custom_modules' must %s"
     err_msg = "Build option 'custom_modules' must %s"
     if not os.path.isdir(path):
     if not os.path.isdir(path):
         raise ValueError(err_msg % "point to an existing directory.")
         raise ValueError(err_msg % "point to an existing directory.")
-    if os.path.realpath(path) == os.path.realpath("modules"):
+    if path == os.path.realpath("modules"):
         raise ValueError(err_msg % "be a directory other than built-in `modules` directory.")
         raise ValueError(err_msg % "be a directory other than built-in `modules` directory.")
     if is_module(path):
     if is_module(path):
         raise ValueError(err_msg % "point to a directory with modules, not a single module.")
         raise ValueError(err_msg % "point to a directory with modules, not a single module.")
-    return os.path.realpath(os.path.expanduser(path))
+    return path
 
 
 
 
 def disable_module(self):
 def disable_module(self):