[Bf-blender-cvs] [df3316cbe98] master: Cleanup: run autopep8 on build_files/

Campbell Barton noreply at git.blender.org
Wed Apr 20 07:13:01 CEST 2022


Commit: df3316cbe98e19def7284c028e53682db0be9a30
Author: Campbell Barton
Date:   Wed Apr 20 15:08:46 2022 +1000
Branches: master
https://developer.blender.org/rBdf3316cbe98e19def7284c028e53682db0be9a30

Cleanup: run autopep8 on build_files/

Replace multiple hashes with over-lines for make_source_archive.py.

===================================================================

M	build_files/cmake/clang_array_check.py
M	build_files/cmake/project_source_info.py
M	build_files/utils/make_source_archive.py
M	build_files/utils/make_update.py
M	build_files/utils/make_utils.py

===================================================================

diff --git a/build_files/cmake/clang_array_check.py b/build_files/cmake/clang_array_check.py
index b015c5c6e7c..db9fd2d57a4 100644
--- a/build_files/cmake/clang_array_check.py
+++ b/build_files/cmake/clang_array_check.py
@@ -202,9 +202,9 @@ def parm_size(node_child):
 
     # NOT PERFECT CODE, EXTRACT SIZE FROM TOKENS
     if len(tokens) >= 3:  # foo [ 1 ]
-        if      ((tokens[-3].kind == TokenKind.PUNCTUATION and tokens[-3].spelling == "[") and
-                 (tokens[-2].kind == TokenKind.LITERAL and tokens[-2].spelling.isdigit()) and
-                 (tokens[-1].kind == TokenKind.PUNCTUATION and tokens[-1].spelling == "]")):
+        if ((tokens[-3].kind == TokenKind.PUNCTUATION and tokens[-3].spelling == "[") and
+            (tokens[-2].kind == TokenKind.LITERAL and tokens[-2].spelling.isdigit()) and
+                (tokens[-1].kind == TokenKind.PUNCTUATION and tokens[-1].spelling == "]")):
             # ---
             return int(tokens[-2].spelling)
     return -1
diff --git a/build_files/cmake/project_source_info.py b/build_files/cmake/project_source_info.py
index 1479d62e6c5..7a00f756e03 100644
--- a/build_files/cmake/project_source_info.py
+++ b/build_files/cmake/project_source_info.py
@@ -114,12 +114,11 @@ def makefile_log() -> List[str]:
         print("Can't execute process")
         sys.exit(1)
 
-
     while process.poll():
         time.sleep(1)
 
     # We know this is always true based on the input arguments to `Popen`.
-    stdout: IO[bytes] = process.stdout # type: ignore
+    stdout: IO[bytes] = process.stdout  # type: ignore
 
     out = stdout.read()
     stdout.close()
@@ -210,7 +209,7 @@ def build_defines_as_source() -> str:
     )
 
     # We know this is always true based on the input arguments to `Popen`.
-    stdout: IO[bytes] = process.stdout # type: ignore
+    stdout: IO[bytes] = process.stdout  # type: ignore
 
     return cast(str, stdout.read().strip().decode('ascii'))
 
@@ -228,7 +227,7 @@ def build_defines_as_args() -> List[str]:
 def queue_processes(
         process_funcs: Sequence[Tuple[Callable[..., subprocess.Popen[Any]], Tuple[Any, ...]]],
         *,
-        job_total: int =-1,
+        job_total: int = -1,
         sleep: float = 0.1,
 ) -> None:
     """ Takes a list of function arg pairs, each function must return a process
diff --git a/build_files/utils/make_source_archive.py b/build_files/utils/make_source_archive.py
index e06be9d5ba7..befd6d84534 100755
--- a/build_files/utils/make_source_archive.py
+++ b/build_files/utils/make_source_archive.py
@@ -143,8 +143,8 @@ def packages_path(current_directory: Path, cli_args: Any) -> Optional[Path]:
 
     return Path(relpath)
 
-
-### Manifest creation
+# -----------------------------------------------------------------------------
+# Manifest creation
 
 
 def create_manifest(
@@ -195,7 +195,8 @@ def packages_to_manifest(outfile: TextIO, packages_dir: Path) -> None:
         print(path, file=outfile)
 
 
-### Higher-level functions
+# -----------------------------------------------------------------------------
+# Higher-level functions
 
 
 def create_tarball(
@@ -249,7 +250,8 @@ def cleanup(manifest: Path) -> None:
     print("OK")
 
 
-## Low-level commands
+# -----------------------------------------------------------------------------
+# Low-level commands
 
 
 def git_ls_files(directory: Path = Path(".")) -> Iterable[Path]:
@@ -265,7 +267,7 @@ def git_ls_files(directory: Path = Path(".")) -> Iterable[Path]:
         yield path
 
 
-def git_command(*cli_args: Union[bytes, str, Path] ) -> Iterable[str]:
+def git_command(*cli_args: Union[bytes, str, Path]) -> Iterable[str]:
     """Generator, yields lines of output from a Git command."""
     command = ("git", *cli_args)
 
diff --git a/build_files/utils/make_update.py b/build_files/utils/make_update.py
index 3701913bd5d..bf140812ebb 100755
--- a/build_files/utils/make_update.py
+++ b/build_files/utils/make_update.py
@@ -129,6 +129,7 @@ def svn_update(args, release_version):
                 call(svn_non_interactive + ["switch", svn_url + dirname, dirpath], exit_on_error=False)
                 call(svn_non_interactive + ["update", dirpath])
 
+
 # Test if git repo can be updated.
 def git_update_skip(args, check_remote_exists=True):
     if make_utils.command_missing(args.git_command):
diff --git a/build_files/utils/make_utils.py b/build_files/utils/make_utils.py
index b1aab93d698..e4c676474b5 100755
--- a/build_files/utils/make_utils.py
+++ b/build_files/utils/make_utils.py
@@ -47,8 +47,10 @@ def check_output(cmd, exit_on_error=True):
 
 
 def git_branch_exists(git_command, branch):
-    return call([git_command, "rev-parse", "--verify", branch], exit_on_error=False, silent=True) == 0 or \
-           call([git_command, "rev-parse", "--verify", "remotes/origin/" + branch], exit_on_error=False, silent=True) == 0
+    return (
+        call([git_command, "rev-parse", "--verify", branch], exit_on_error=False, silent=True) == 0 or
+        call([git_command, "rev-parse", "--verify", "remotes/origin/" + branch], exit_on_error=False, silent=True) == 0
+    )
 
 
 def git_branch(git_command):



More information about the Bf-blender-cvs mailing list