mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-21 04:10:37 +02:00
chore(deploy): rename index_only
variable to is_index_only
for Python idiomaticness
This commit is contained in:
parent
dc3fd0bdd1
commit
da5ff1c928
@ -94,7 +94,7 @@ def _get_index_includes(base_dir):
|
|||||||
return index_includes
|
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".
|
"""Upload the contents of the directory `repo_section` (including subdirectories) to the AWS S3 "bucket".
|
||||||
|
|
||||||
The contents of that subdir of the
|
The contents of that subdir of the
|
||||||
@ -106,12 +106,12 @@ def update_awsbucket(repo_section, index_only=False):
|
|||||||
+ config['awsbucket'] + '"')
|
+ config['awsbucket'] + '"')
|
||||||
|
|
||||||
if common.set_command_in_config('s3cmd'):
|
if common.set_command_in_config('s3cmd'):
|
||||||
update_awsbucket_s3cmd(repo_section, index_only)
|
update_awsbucket_s3cmd(repo_section, is_index_only)
|
||||||
else:
|
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.
|
"""Upload using the CLI tool s3cmd, which provides rsync-like sync.
|
||||||
|
|
||||||
The upload is done in multiple passes to reduce the chance of
|
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/'
|
s3url = s3bucketurl + '/fdroid/'
|
||||||
|
|
||||||
if index_only:
|
if is_index_only:
|
||||||
logging.debug(_('s3cmd syncs indexes from {path} to {url} and deletes removed')
|
logging.debug(_('s3cmd syncs indexes from {path} to {url} and deletes removed')
|
||||||
.format(path=repo_section, url=s3url))
|
.format(path=repo_section, url=s3url))
|
||||||
sync_indexes_flags = []
|
sync_indexes_flags = []
|
||||||
@ -199,7 +199,7 @@ def update_awsbucket_s3cmd(repo_section, index_only=False):
|
|||||||
raise FDroidException()
|
raise FDroidException()
|
||||||
|
|
||||||
|
|
||||||
def update_awsbucket_libcloud(repo_section, index_only=False):
|
def update_awsbucket_libcloud(repo_section, is_index_only=False):
|
||||||
"""No summary.
|
"""No summary.
|
||||||
|
|
||||||
Upload the contents of the directory `repo_section` (including
|
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 + '/'):
|
if obj.name.startswith(upload_dir + '/'):
|
||||||
objs[obj.name] = obj
|
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)]
|
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 = [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))
|
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'):
|
elif config and config.get('identity_file'):
|
||||||
rsyncargs += ['-e', 'ssh -oBatchMode=yes -oIdentitiesOnly=yes -i ' + config['identity_file']]
|
rsyncargs += ['-e', 'ssh -oBatchMode=yes -oIdentitiesOnly=yes -i ' + config['identity_file']]
|
||||||
url = serverwebroot['url']
|
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)
|
logging.info('rsyncing ' + repo_section + ' to ' + url)
|
||||||
if index_only:
|
if is_index_only:
|
||||||
rsyncargs += _get_index_file_paths(repo_section)
|
rsyncargs += _get_index_file_paths(repo_section)
|
||||||
rsyncargs += [f'{url}/{repo_section}/']
|
rsyncargs += [f'{url}/{repo_section}/']
|
||||||
logging.info(rsyncargs)
|
logging.info(rsyncargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user