1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-20 20:00:37 +02:00

chore(deploy): rename index_only variable to is_index_only for Python idiomaticness

This commit is contained in:
proletarius101 2024-06-04 20:30:35 +08:00
parent dc3fd0bdd1
commit da5ff1c928
No known key found for this signature in database

View File

@ -94,7 +94,7 @@ def _get_index_includes(base_dir):
return index_includes
def update_awsbucket(repo_section, index_only=False):
def update_awsbucket(repo_section, is_index_only=False):
"""Upload the contents of the directory `repo_section` (including subdirectories) to the AWS S3 "bucket".
The contents of that subdir of the
@ -106,12 +106,12 @@ def update_awsbucket(repo_section, index_only=False):
+ config['awsbucket'] + '"')
if common.set_command_in_config('s3cmd'):
update_awsbucket_s3cmd(repo_section, index_only)
update_awsbucket_s3cmd(repo_section, is_index_only)
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
@ -155,7 +155,7 @@ def update_awsbucket_s3cmd(repo_section, index_only=False):
s3url = s3bucketurl + '/fdroid/'
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 = []
@ -199,7 +199,7 @@ def update_awsbucket_s3cmd(repo_section, index_only=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
@ -242,7 +242,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))
@ -335,9 +335,9 @@ def update_serverwebroot(serverwebroot, repo_section):
elif config and config.get('identity_file'):
rsyncargs += ['-e', '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)