diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-02 03:15:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-02 04:59:16 +0300 |
commit | 41d2d6da0c96d351b47acb64d3e0decdba16cb16 (patch) | |
tree | 8f955ed71d907ab9f7ee97627a9a7c91192d139a /build_files/utils | |
parent | bab9de2a52929fe2b45ecddb1eb09da3378e303b (diff) |
Cleanup: pep8 (indentation, spacing, long lines)
Diffstat (limited to 'build_files/utils')
-rwxr-xr-x | build_files/utils/make_update.py | 69 | ||||
-rwxr-xr-x | build_files/utils/make_utils.py | 2 |
2 files changed, 38 insertions, 33 deletions
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 |