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

Merge branch 'ci/fix_os_pathlike' into 'master'

ci: fix subtyping in type annotations under python3.7

See merge request espressif/esp-idf!19255
Fu Hanxi пре 3 година
родитељ
комит
cdbc581f96

+ 2 - 2
tools/ci/check_deprecated_kconfigs.py

@@ -24,7 +24,7 @@ IGNORE_DIRS: Tuple = (
 )
 
 
-def _parse_path(path: os.PathLike[str], sep: str=None) -> Set:
+def _parse_path(path: 'os.PathLike[str]', sep: str=None) -> Set:
     ret = set()
     with open(path, 'r', encoding='utf-8') as f:
         for line in f:
@@ -34,7 +34,7 @@ def _parse_path(path: os.PathLike[str], sep: str=None) -> Set:
     return ret
 
 
-def _valid_directory(path: os.PathLike[str]) -> os.PathLike[str]:
+def _valid_directory(path: 'os.PathLike[str]') -> 'os.PathLike[str]':
     if not os.path.isdir(path):
         raise argparse.ArgumentTypeError('{} is not a valid directory!'.format(path))
     return path

+ 3 - 3
tools/ci/check_public_headers.py

@@ -56,12 +56,12 @@ def exec_cmd_to_temp_file(what: List, suffix: str='') -> Tuple[int, str, str, st
     return rc, out, err, out_file.name, cmd
 
 
-def exec_cmd(what: List, out_file: Union[tempfile._TemporaryFileWrapper[bytes], int]=subprocess.PIPE) -> Tuple[int, str, str, str]:
+def exec_cmd(what: List, out_file: Union['tempfile._TemporaryFileWrapper[bytes]', int]=subprocess.PIPE) -> Tuple[int, str, str, str]:
     p = subprocess.Popen(what, stdin=subprocess.PIPE, stdout=out_file, stderr=subprocess.PIPE)
     output_b, err_b = p.communicate()
     rc = p.returncode
-    output: str = output_b.decode('utf-8') if output is not None else ''
-    err: str = err_b.decode('utf-8') if err is not None else ''
+    output: str = output_b.decode('utf-8') if output_b is not None else ''
+    err: str = err_b.decode('utf-8') if err_b is not None else ''
     return rc, output, err, ' '.join(what)
 
 

+ 1 - 1
tools/ci/check_rules_yml.py

@@ -76,7 +76,7 @@ class YMLConfig:
 YML_CONFIG = YMLConfig(ROOT_YML_FP)
 
 
-def validate_needed_rules(rules_yml: os.PathLike[str]) -> int:
+def validate_needed_rules(rules_yml: 'os.PathLike[str]') -> int:
     res = 0
     needed_rules = deepcopy(YML_CONFIG.all_extends)
     with open(rules_yml) as fr:

+ 1 - 1
tools/idf.py

@@ -472,7 +472,7 @@ def init_cli(verbose_output: List=None) -> Any:
                 with open(os.path.join(args.build_dir, 'flasher_args.json')) as file:
                     flasher_args: Dict[str, Any] = json.load(file)
 
-                def flasher_path(f: Union[str, os.PathLike[str]]) -> str:
+                def flasher_path(f: Union[str, 'os.PathLike[str]']) -> str:
                     if type(args.build_dir) is bytes:
                         args.build_dir = args.build_dir.decode()
                     return _safe_relpath(os.path.join(args.build_dir, f))