From 41d2d6da0c96d351b47acb64d3e0decdba16cb16 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 2 Oct 2020 10:15:51 +1000 Subject: Cleanup: pep8 (indentation, spacing, long lines) --- build_files/buildbot/buildbot_utils.py | 11 ++-- .../buildbot/codesign/archive_with_indicator.py | 2 +- build_files/buildbot/worker_pack.py | 8 ++- build_files/buildbot/worker_test.py | 2 +- build_files/cmake/cmake_netbeans_project.py | 2 +- .../cmake/cmake_static_check_clang_array.py | 4 +- build_files/utils/make_update.py | 69 ++++++++++++---------- build_files/utils/make_utils.py | 2 +- 8 files changed, 55 insertions(+), 45 deletions(-) (limited to 'build_files') diff --git a/build_files/buildbot/buildbot_utils.py b/build_files/buildbot/buildbot_utils.py index 919b197b380..2fce979466e 100644 --- a/build_files/buildbot/buildbot_utils.py +++ b/build_files/buildbot/buildbot_utils.py @@ -50,22 +50,23 @@ class Builder: # Detect platform if name.startswith('mac'): self.platform = 'mac' - self.command_prefix = [] + self.command_prefix = [] elif name.startswith('linux'): self.platform = 'linux' if is_tool('scl'): - self.command_prefix = ['scl', 'enable', 'devtoolset-9', '--'] + self.command_prefix = ['scl', 'enable', 'devtoolset-9', '--'] else: - self.command_prefix = [] + self.command_prefix = [] elif name.startswith('win'): self.platform = 'win' - self.command_prefix = [] + self.command_prefix = [] else: raise ValueError('Unkonw platform for builder ' + self.platform) # Always 64 bit now self.bits = 64 + def create_builder_from_arguments(): parser = argparse.ArgumentParser() parser.add_argument('builder_name') @@ -106,7 +107,7 @@ class VersionInfo: def _parse_header_file(self, filename, define): import re - regex = re.compile("^#\s*define\s+%s\s+(.*)" % define) + regex = re.compile(r"^#\s*define\s+%s\s+(.*)" % define) with open(filename, "r") as file: for l in file: match = regex.match(l) diff --git a/build_files/buildbot/codesign/archive_with_indicator.py b/build_files/buildbot/codesign/archive_with_indicator.py index 085026fcf98..e5c4be885bc 100644 --- a/build_files/buildbot/codesign/archive_with_indicator.py +++ b/build_files/buildbot/codesign/archive_with_indicator.py @@ -102,7 +102,7 @@ class ArchiveWithIndicator: # Wait for until archive is fully stored. actual_archive_size = self.archive_filepath.stat().st_size - if actual_archive_size != expected_archive_size: + if actual_archive_size != expected_archive_size: print('Partial/invalid archive size (expected ' f'{expected_archive_size} got {actual_archive_size})') return False diff --git a/build_files/buildbot/worker_pack.py b/build_files/buildbot/worker_pack.py index 82b406cd42d..a5727a66e09 100644 --- a/build_files/buildbot/worker_pack.py +++ b/build_files/buildbot/worker_pack.py @@ -35,7 +35,7 @@ def get_package_name(builder, platform=None): package_name = 'blender-' + info.full_version if platform: - package_name += '-' + platform + package_name += '-' + platform if not (builder.branch == 'master' or builder.is_release_branch): if info.is_development_build: package_name = builder.branch + "-" + package_name @@ -175,7 +175,11 @@ def pack_linux(builder): print("Stripping python...") py_target = os.path.join(builder.install_dir, info.short_version) - buildbot_utils.call(builder.command_prefix + ['find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';']) + buildbot_utils.call( + builder.command_prefix + [ + 'find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';', + ], + ) # Construct package name platform_name = 'linux64' diff --git a/build_files/buildbot/worker_test.py b/build_files/buildbot/worker_test.py index db02801007e..8a6e7d4bb69 100644 --- a/build_files/buildbot/worker_test.py +++ b/build_files/buildbot/worker_test.py @@ -33,7 +33,7 @@ def get_ctest_arguments(builder): def test(builder): os.chdir(builder.build_dir) - command = builder.command_prefix + ['ctest'] + get_ctest_arguments(builder) + command = builder.command_prefix + ['ctest'] + get_ctest_arguments(builder) buildbot_utils.call(command) diff --git a/build_files/cmake/cmake_netbeans_project.py b/build_files/cmake/cmake_netbeans_project.py index 35985e532b8..cfc3ff6b6fa 100755 --- a/build_files/cmake/cmake_netbeans_project.py +++ b/build_files/cmake/cmake_netbeans_project.py @@ -182,7 +182,7 @@ def create_nb_project_main(): f.write(' \n') # default, but this dir is infact not in blender dir so we can ignore it # f.write(' ^(nbproject)$\n') - f.write(' ^(nbproject|__pycache__|.*\.py|.*\.html|.*\.blend)$\n') + f.write(r' ^(nbproject|__pycache__|.*\.py|.*\.html|.*\.blend)$\n') f.write(' \n') f.write(' %s\n' % SOURCE_DIR) # base_root_rel diff --git a/build_files/cmake/cmake_static_check_clang_array.py b/build_files/cmake/cmake_static_check_clang_array.py index 4a7a22619cc..61eee360d6e 100644 --- a/build_files/cmake/cmake_static_check_clang_array.py +++ b/build_files/cmake/cmake_static_check_clang_array.py @@ -49,8 +49,8 @@ def main(): check_commands = [] for c, inc_dirs, defs in source_info: - #~if "source/blender" not in c: - #~ continue + # ~if "source/blender" not in c: + # ~ continue cmd = ([CHECKER_BIN] + CHECKER_ARGS + diff --git a/build_files/utils/make_update.py b/build_files/utils/make_update.py index ae7269b07cd..53f6b3d447f 100755 --- a/build_files/utils/make_update.py +++ b/build_files/utils/make_update.py @@ -92,30 +92,32 @@ def svn_update(args, release_version): print_stage("Updating Precompiled Libraries and Tests") if os.path.isdir(lib_dirpath): - for dirname in os.listdir(lib_dirpath): - dirpath = os.path.join(lib_dirpath, dirname) - - if dirname == ".svn": - # Cleanup must be run from svn root directory if it exists. - if not make_utils.command_missing(args.svn_command): - call(svn_non_interactive + ["cleanup", lib_dirpath]) - continue - - svn_dirpath = os.path.join(dirpath, ".svn") - svn_root_dirpath = os.path.join(lib_dirpath, ".svn") - - if os.path.isdir(dirpath) and \ - (os.path.exists(svn_dirpath) or os.path.exists(svn_root_dirpath)): - if make_utils.command_missing(args.svn_command): - sys.stderr.write("svn not found, can't update libraries\n") - sys.exit(1) - - # Cleanup to continue with interrupted downloads. - if os.path.exists(svn_dirpath): - call(svn_non_interactive + ["cleanup", dirpath]) - # Switch to appropriate branch and update. - call(svn_non_interactive + ["switch", svn_url + dirname, dirpath], exit_on_error=False) - call(svn_non_interactive + ["update", dirpath]) + for dirname in os.listdir(lib_dirpath): + dirpath = os.path.join(lib_dirpath, dirname) + + if dirname == ".svn": + # Cleanup must be run from svn root directory if it exists. + if not make_utils.command_missing(args.svn_command): + call(svn_non_interactive + ["cleanup", lib_dirpath]) + continue + + svn_dirpath = os.path.join(dirpath, ".svn") + svn_root_dirpath = os.path.join(lib_dirpath, ".svn") + + if ( + os.path.isdir(dirpath) and + (os.path.exists(svn_dirpath) or os.path.exists(svn_root_dirpath)) + ): + if make_utils.command_missing(args.svn_command): + sys.stderr.write("svn not found, can't update libraries\n") + sys.exit(1) + + # Cleanup to continue with interrupted downloads. + if os.path.exists(svn_dirpath): + call(svn_non_interactive + ["cleanup", dirpath]) + # Switch to appropriate branch and update. + 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): @@ -127,9 +129,11 @@ def git_update_skip(args, check_remote_exists=True): rebase_merge = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-merge'], exit_on_error=False) rebase_apply = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-apply'], exit_on_error=False) merge_head = check_output([args.git_command, 'rev-parse', '--git-path', 'MERGE_HEAD'], exit_on_error=False) - if os.path.exists(rebase_merge) or \ - os.path.exists(rebase_apply) or \ - os.path.exists(merge_head): + if ( + os.path.exists(rebase_merge) or + os.path.exists(rebase_apply) or + os.path.exists(merge_head) + ): return "rebase or merge in progress, complete it first" # Abort if uncommitted changes. @@ -139,13 +143,14 @@ def git_update_skip(args, check_remote_exists=True): # Test if there is an upstream branch configured if check_remote_exists: - branch = check_output([args.git_command, "rev-parse", "--abbrev-ref", "HEAD"]) - remote = check_output([args.git_command, "config", "branch." + branch + ".remote"], exit_on_error=False) - if len(remote) == 0: - return "no remote branch to pull from" + branch = check_output([args.git_command, "rev-parse", "--abbrev-ref", "HEAD"]) + remote = check_output([args.git_command, "config", "branch." + branch + ".remote"], exit_on_error=False) + if len(remote) == 0: + return "no remote branch to pull from" return "" + # Update blender repository. def blender_update(args): print_stage("Updating Blender Git Repository") @@ -184,7 +189,7 @@ def submodules_update(args, release_version, branch): os.chdir(submodule_path) msg = git_update_skip(args, check_remote_exists=False) if msg: - skip_msg += submodule_path + " skipped: " + msg + "\n" + skip_msg += submodule_path + " skipped: " + msg + "\n" else: if make_utils.git_branch(args.git_command) != submodule_branch: call([args.git_command, "fetch", "origin"]) diff --git a/build_files/utils/make_utils.py b/build_files/utils/make_utils.py index ce87bdd46e4..9f928bb524d 100755 --- a/build_files/utils/make_utils.py +++ b/build_files/utils/make_utils.py @@ -64,7 +64,7 @@ def git_branch_release_version(branch, tag): if release_version: release_version = release_version.group(1) elif tag: - release_version = re.search("^v([0-9]*\.[0-9]*).*", tag) + release_version = re.search(r"^v([0-9]*\.[0-9]*).*", tag) if release_version: release_version = release_version.group(1) return release_version -- cgit v1.2.3