mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-04 22:40:12 +01:00
code formatting: black --skip-string-normalization --line-length 100
This commit is contained in:
parent
7f458f8f8c
commit
08cde5c2e6
@ -49,9 +49,9 @@ from .exception import FDroidException
|
||||
options = None
|
||||
|
||||
|
||||
def make_binary_transparency_log(repodirs, btrepo='binary_transparency',
|
||||
url=None,
|
||||
commit_title='fdroid update'):
|
||||
def make_binary_transparency_log(
|
||||
repodirs, btrepo='binary_transparency', url=None, commit_title='fdroid update'
|
||||
):
|
||||
'''Log the indexes in a standalone git repo to serve as a "binary
|
||||
transparency" log.
|
||||
|
||||
@ -103,7 +103,7 @@ For more info on this idea:
|
||||
output = json.load(fp, object_pairs_hook=collections.OrderedDict)
|
||||
with open(dest, 'w') as fp:
|
||||
json.dump(output, fp, indent=2)
|
||||
gitrepo.index.add([repof, ])
|
||||
gitrepo.index.add([repof])
|
||||
for f in ('index.jar', 'index-v1.jar'):
|
||||
repof = os.path.join(repodir, f)
|
||||
if not os.path.exists(repof):
|
||||
@ -116,7 +116,7 @@ For more info on this idea:
|
||||
jarout.writestr(info, jarin.read(info.filename))
|
||||
jarout.close()
|
||||
jarin.close()
|
||||
gitrepo.index.add([repof, ])
|
||||
gitrepo.index.add([repof])
|
||||
|
||||
output_files = []
|
||||
for root, dirs, files in os.walk(repodir):
|
||||
@ -137,10 +137,10 @@ For more info on this idea:
|
||||
fslogfile = os.path.join(cpdir, 'filesystemlog.json')
|
||||
with open(fslogfile, 'w') as fp:
|
||||
json.dump(output, fp, indent=2)
|
||||
gitrepo.index.add([os.path.join(repodir, 'filesystemlog.json'), ])
|
||||
gitrepo.index.add([os.path.join(repodir, 'filesystemlog.json')])
|
||||
|
||||
for f in glob.glob(os.path.join(cpdir, '*.HTTP-headers.json')):
|
||||
gitrepo.index.add([os.path.join(repodir, os.path.basename(f)), ])
|
||||
gitrepo.index.add([os.path.join(repodir, os.path.basename(f))])
|
||||
|
||||
gitrepo.index.commit(commit_title)
|
||||
|
||||
@ -168,7 +168,8 @@ def main():
|
||||
|
||||
if not os.path.exists(options.git_repo):
|
||||
raise FDroidException(
|
||||
'"%s" does not exist! Create it, or use --git-repo' % options.git_repo)
|
||||
'"%s" does not exist! Create it, or use --git-repo' % options.git_repo
|
||||
)
|
||||
|
||||
session = requests.Session()
|
||||
|
||||
@ -186,9 +187,7 @@ def main():
|
||||
dlurl = options.url + '/' + repodir + '/' + f
|
||||
http_headers_file = os.path.join(gitrepodir, f + '.HTTP-headers.json')
|
||||
|
||||
headers = {
|
||||
'User-Agent': 'F-Droid 0.102.3'
|
||||
}
|
||||
headers = {'User-Agent': 'F-Droid 0.102.3'}
|
||||
etag = None
|
||||
if os.path.exists(http_headers_file):
|
||||
with open(http_headers_file) as fp:
|
||||
@ -196,7 +195,9 @@ def main():
|
||||
|
||||
r = session.head(dlurl, headers=headers, allow_redirects=False)
|
||||
if r.status_code != 200:
|
||||
logging.debug('HTTP Response (' + str(r.status_code) + '), did not download ' + dlurl)
|
||||
logging.debug(
|
||||
'HTTP Response (' + str(r.status_code) + '), did not download ' + dlurl
|
||||
)
|
||||
continue
|
||||
if etag and etag == r.headers.get('ETag'):
|
||||
logging.debug('ETag matches, did not download ' + dlurl)
|
||||
|
@ -1,5 +1,4 @@
|
||||
class FDroidException(Exception):
|
||||
|
||||
def __init__(self, value=None, detail=None):
|
||||
self.value = value
|
||||
self.detail = detail
|
||||
@ -22,12 +21,14 @@ class FDroidException(Exception):
|
||||
else:
|
||||
ret = str(self.value)
|
||||
if self.detail:
|
||||
ret += "\n==== detail begin ====\n%s\n==== detail end ====" % ''.join(self.detail).strip()
|
||||
ret += (
|
||||
"\n==== detail begin ====\n%s\n==== detail end ===="
|
||||
% ''.join(self.detail).strip()
|
||||
)
|
||||
return ret
|
||||
|
||||
|
||||
class MetaDataException(Exception):
|
||||
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
|
||||
|
@ -73,9 +73,7 @@ def main():
|
||||
sigpath = os.path.join(output_dir, sigfilename)
|
||||
|
||||
if not os.path.exists(sigpath):
|
||||
gpgargs = ['gpg', '-a',
|
||||
'--output', sigpath,
|
||||
'--detach-sig']
|
||||
gpgargs = ['gpg', '-a', '--output', sigpath, '--detach-sig']
|
||||
if 'gpghome' in config:
|
||||
gpgargs.extend(['--homedir', config['gpghome']])
|
||||
if 'gpgkey' in config:
|
||||
|
@ -99,7 +99,8 @@ def main():
|
||||
|
||||
if 'jarsigner' not in config:
|
||||
raise FDroidException(
|
||||
_('Java jarsigner not found! Install in standard location or set java_paths!'))
|
||||
_('Java jarsigner not found! Install in standard location or set java_paths!')
|
||||
)
|
||||
|
||||
repodirs = ['repo']
|
||||
if config['archive_older'] != 0:
|
||||
|
@ -33,6 +33,7 @@ import threading
|
||||
|
||||
class Tail(object):
|
||||
''' Represents a tail command. '''
|
||||
|
||||
def __init__(self, tailed_file):
|
||||
''' Initiate a Tail instance.
|
||||
Check for file validity, assigns callback function to standard out.
|
||||
@ -95,7 +96,6 @@ class Tail(object):
|
||||
|
||||
|
||||
class TailError(Exception):
|
||||
|
||||
def __init__(self, msg):
|
||||
self.message = msg
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user