From d8c9f88f2496f528ffcef10b81da2326c9c14c1a Mon Sep 17 00:00:00 2001 From: proletarius101 Date: Tue, 4 Jun 2024 20:30:35 +0800 Subject: [PATCH] chore(deploy): rename `index_only` variable to `is_index_only` for Python idiomaticness --- fdroidserver/deploy.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/fdroidserver/deploy.py b/fdroidserver/deploy.py index de0a7fab..1279683e 100644 --- a/fdroidserver/deploy.py +++ b/fdroidserver/deploy.py @@ -97,7 +97,7 @@ def _get_index_includes(base_dir): return index_includes -def update_awsbucket(repo_section, index_only=False, verbose=False, quiet=False): +def update_awsbucket(repo_section, is_index_only=False, verbose=False, quiet=False): """Upload the contents of the directory `repo_section` (including subdirectories) to the AWS S3 "bucket". The contents of that subdir of the @@ -117,26 +117,26 @@ def update_awsbucket(repo_section, index_only=False, verbose=False, quiet=False) logging.warning( 'No syncing tool set in config.yml!. Defaulting to using s3cmd' ) - update_awsbucket_s3cmd(repo_section, index_only) + update_awsbucket_s3cmd(repo_section, is_index_only) if config['s3cmd'] is True and config['rclone'] is True: logging.warning( 'Both syncing tools set in config.yml!. Defaulting to using s3cmd' ) - update_awsbucket_s3cmd(repo_section, index_only) + update_awsbucket_s3cmd(repo_section, is_index_only) if config['s3cmd'] is True and config['rclone'] is not True: - update_awsbucket_s3cmd(repo_section, index_only) + update_awsbucket_s3cmd(repo_section, is_index_only) if config['rclone'] is True and config['s3cmd'] is not True: update_remote_storage_with_rclone(repo_section, verbose, quiet) elif common.set_command_in_config('s3cmd'): - update_awsbucket_s3cmd(repo_section, index_only) + update_awsbucket_s3cmd(repo_section, is_index_only) elif common.set_command_in_config('rclone'): update_remote_storage_with_rclone(repo_section, verbose, quiet) else: - update_awsbucket_libcloud(repo_section, index_only) + update_awsbucket_libcloud(repo_section, is_index_only) -def update_awsbucket_s3cmd(repo_section, index_only=False): +def update_awsbucket_s3cmd(repo_section, is_index_only=False): """Upload using the CLI tool s3cmd, which provides rsync-like sync. The upload is done in multiple passes to reduce the chance of @@ -190,7 +190,7 @@ def update_awsbucket_s3cmd(repo_section, index_only=False): ) ) - if index_only: + if is_index_only: logging.debug(_('s3cmd syncs indexes from {path} to {url} and deletes removed') .format(path=repo_section, url=s3url)) sync_indexes_flags = [] @@ -357,7 +357,7 @@ def update_remote_storage_with_rclone(repo_section, verbose=False, quiet=False): raise FDroidException() -def update_awsbucket_libcloud(repo_section, index_only=False): +def update_awsbucket_libcloud(repo_section, is_index_only=False): """No summary. Upload the contents of the directory `repo_section` (including @@ -405,7 +405,7 @@ def update_awsbucket_libcloud(repo_section, index_only=False): if obj.name.startswith(upload_dir + '/'): objs[obj.name] = obj - if index_only: + if is_index_only: index_files = [f"{os.getcwd()}/{name}" for name in _get_index_file_paths(repo_section)] files_to_upload = [os.path.join(root, name) for root, dirs, files in os.walk(os.path.join(os.getcwd(), repo_section)) for name in files] files_to_upload = list(set(files_to_upload) & set(index_files)) @@ -507,9 +507,9 @@ def update_serverwebroot(serverwebroot, repo_section): 'ssh -oBatchMode=yes -oIdentitiesOnly=yes -i ' + config['identity_file'], ] url = serverwebroot['url'] - index_only = serverwebroot.get('index_only', False) + is_index_only = serverwebroot.get('index_only', False) logging.info('rsyncing ' + repo_section + ' to ' + url) - if index_only: + if is_index_only: rsyncargs += _get_index_file_paths(repo_section) rsyncargs += [f'{url}/{repo_section}/'] logging.info(rsyncargs)