Minor fix on path to make it work in Windows (#2494)
This commit is contained in:
parent
84a2bb9671
commit
a14575009c
@ -703,7 +703,8 @@ class PyiGenerator:
|
|||||||
current_module: Any = {}
|
current_module: Any = {}
|
||||||
|
|
||||||
def _write_pyi_file(self, module_path: Path, source: str):
|
def _write_pyi_file(self, module_path: Path, source: str):
|
||||||
relpath = _relative_to_pwd(module_path)
|
relpath = str(_relative_to_pwd(module_path)).replace("\\", "/")
|
||||||
|
print(f"Writing {relpath}")
|
||||||
pyi_content = [
|
pyi_content = [
|
||||||
f'"""Stub file for {relpath}"""',
|
f'"""Stub file for {relpath}"""',
|
||||||
"# ------------------- DO NOT EDIT ----------------------",
|
"# ------------------- DO NOT EDIT ----------------------",
|
||||||
@ -731,9 +732,12 @@ class PyiGenerator:
|
|||||||
logger.info(f"Wrote {relpath}")
|
logger.info(f"Wrote {relpath}")
|
||||||
|
|
||||||
def _scan_file(self, module_path: Path):
|
def _scan_file(self, module_path: Path):
|
||||||
# module_import = str(module_path.with_suffix("")).replace("/", ".")
|
|
||||||
module_import = (
|
module_import = (
|
||||||
_relative_to_pwd(module_path).with_suffix("").as_posix().replace("/", ".")
|
_relative_to_pwd(module_path)
|
||||||
|
.with_suffix("")
|
||||||
|
.as_posix()
|
||||||
|
.replace("/", ".")
|
||||||
|
.replace("\\", ".")
|
||||||
)
|
)
|
||||||
module = importlib.import_module(module_import)
|
module = importlib.import_module(module_import)
|
||||||
logger.debug(f"Read {module_path}")
|
logger.debug(f"Read {module_path}")
|
||||||
|
Loading…
Reference in New Issue
Block a user