logging.warn() was deprecated in Python 3.3, use logging.warning()

sed -i 's,logging\.warn(,logging.warning(,g' fdroid */*.*

https://docs.python.org/3.3/library/logging.html#logging.Logger.warning
This commit is contained in:
Hans-Christoph Steiner 2020-05-25 17:36:58 +02:00
parent 67332d83a5
commit 6030445be0
10 changed files with 34 additions and 31 deletions

View File

@ -137,9 +137,9 @@ def main():
system_langcode, system_encoding = locale.getdefaultlocale()
if system_encoding is None or system_encoding.lower() not in ('utf-8', 'utf8'):
logging.warn(_("Encoding is set to '{enc}' fdroid might run "
"into encoding issues. Please set it to 'UTF-8' "
"for best results.".format(enc=system_encoding)))
logging.warning(_("Encoding is set to '{enc}' fdroid might run "
"into encoding issues. Please set it to 'UTF-8' "
"for best results.".format(enc=system_encoding)))
try:
mod.main()

View File

@ -278,7 +278,7 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
ftp.get(toolsversion_log, os.path.join(log_dir, toolsversion_log))
logging.debug('retrieved %s', toolsversion_log)
except Exception as e:
logging.warn('could not get %s from builder vm: %s' % (toolsversion_log, e))
logging.warning('could not get %s from builder vm: %s' % (toolsversion_log, e))
# Retrieve the built files...
logging.info("Retrieving build output...")

View File

@ -131,9 +131,9 @@ def main():
if not package:
raise FDroidException(_("Couldn't find package ID"))
if not versionName:
logging.warn(_("Couldn't find latest version name"))
logging.warning(_('Could not find latest version name'))
if not versionCode:
logging.warn(_("Couldn't find latest version code"))
logging.warning(_('Could not find latest version code'))
else:
raise FDroidException(_("No gradle project could be found. Specify --subdir?"))

View File

@ -130,7 +130,7 @@ def main():
if 'sdk_path' in test_config:
common.write_to_config(test_config, 'sdk_path', options.android_home)
else:
logging.warn('Looks like this is already an F-Droid repo, cowardly refusing to overwrite it...')
logging.warning('Looks like this is already an F-Droid repo, cowardly refusing to overwrite it...')
logging.info('Try running `fdroid init` in an empty directory.')
raise FDroidException('Repository already exists.')
@ -209,8 +209,8 @@ def main():
opensc_so = files[0]
else:
opensc_so = '/usr/lib/opensc-pkcs11.so'
logging.warn('No OpenSC PKCS#11 module found, '
+ 'install OpenSC then edit "opensc-fdroid.cfg"!')
logging.warning('No OpenSC PKCS#11 module found, '
+ 'install OpenSC then edit "opensc-fdroid.cfg"!')
with open(os.path.join(examplesdir, 'opensc-fdroid.cfg'), 'r') as f:
opensc_fdroid = f.read()
opensc_fdroid = re.sub('^library.*', 'library = ' + opensc_so, opensc_fdroid,

View File

@ -109,8 +109,8 @@ def main():
continue
if fail == "INSTALL_FAILED_ALREADY_EXISTS":
logging.warn(_("'{apkfilename}' is already installed on {dev}.")
.format(apkfilename=apk, dev=dev))
logging.warning(_('"{apkfilename}" is already installed on {dev}.')
.format(apkfilename=apk, dev=dev))
else:
raise FDroidException(_("Failed to install '{apkfilename}' on {dev}: {error}")
.format(apkfilename=apk, dev=dev, error=fail))

View File

@ -159,7 +159,7 @@ def scan_source(build_dir, build=metadata.Build()):
def warnproblem(what, path_in_build_dir):
if toignore(path_in_build_dir):
return
logging.warn('Found %s at %s' % (what, path_in_build_dir))
logging.warning('Found %s at %s' % (what, path_in_build_dir))
if json_per_build is not None:
json_per_build['warnings'].append([what, path_in_build_dir])
@ -356,8 +356,8 @@ def main():
json_per_appid['current-source-state'] = json_per_build
count = scan_source(build_dir)
if count > 0:
logging.warn(_('Scanner found {count} problems in {appid}:')
.format(count=count, appid=appid))
logging.warning(_('Scanner found {count} problems in {appid}:')
.format(count=count, appid=appid))
probcount += count
app.builds = []
@ -378,19 +378,19 @@ def main():
count = scan_source(build_dir, build)
if count > 0:
logging.warn(_('Scanner found {count} problems in {appid}:{versionCode}:')
.format(count=count, appid=appid, versionCode=build.versionCode))
logging.warning(_('Scanner found {count} problems in {appid}:{versionCode}:')
.format(count=count, appid=appid, versionCode=build.versionCode))
probcount += count
except BuildException as be:
logging.warn("Could not scan app %s due to BuildException: %s" % (
logging.warning('Could not scan app %s due to BuildException: %s' % (
appid, be))
probcount += 1
except VCSException as vcse:
logging.warn("VCS error while scanning app %s: %s" % (appid, vcse))
logging.warning('VCS error while scanning app %s: %s' % (appid, vcse))
probcount += 1
except Exception:
logging.warn("Could not scan app %s due to unknown error: %s" % (
logging.warning('Could not scan app %s due to unknown error: %s' % (
appid, traceback.format_exc()))
probcount += 1

View File

@ -207,7 +207,7 @@ def update_awsbucket_libcloud(repo_section):
s3url = 's3://' + awsbucket + '/' + obj.name
logging.info(' deleting ' + s3url)
if not driver.delete_object(obj):
logging.warn('Could not delete ' + s3url)
logging.warning('Could not delete ' + s3url)
upload = True
if upload:
@ -229,7 +229,7 @@ def update_awsbucket_libcloud(repo_section):
object_name, obj = objs.popitem()
s3url = 's3://' + awsbucket + '/' + object_name
if object_name.startswith(upload_dir):
logging.warn(' deleting ' + s3url)
logging.warning(' deleting ' + s3url)
driver.delete_object(obj)
else:
logging.info(' skipping ' + s3url)
@ -773,8 +773,9 @@ def main():
and not config.get('binary_transparency_remote') \
and not config.get('virustotal_apikey') \
and local_copy_dir is None:
logging.warn(_('No option set! Edit your config.py to set at least one of these:')
+ '\nserverwebroot, servergitmirrors, local_copy_dir, awsbucket, virustotal_apikey, androidobservatory, or binary_transparency_remote')
logging.warning(_('No option set! Edit your config.py to set at least one of these:')
+ '\nserverwebroot, servergitmirrors, local_copy_dir, awsbucket, '
+ 'virustotal_apikey, androidobservatory, or binary_transparency_remote')
sys.exit(1)
repo_sections = ['repo']

View File

@ -76,7 +76,9 @@ def extract(options):
if tmp_apk and os.path.exists(tmp_apk):
os.remove(tmp_apk)
else:
logging.warn(_('refuse downloading via insecure HTTP connection (use HTTPS or specify --no-https-check): {apkfilename}').format(apkfilename=apk))
logging.warning(_('refuse downloading via insecure HTTP connection '
'(use HTTPS or specify --no-https-check): {apkfilename}')
.format(apkfilename=apk))
except FDroidException as e:
logging.warning(_("Failed fetching signatures for '{apkfilename}': {error}")
.format(apkfilename=apk, error=e))

View File

@ -366,7 +366,7 @@ def update_wiki(apps, sortedids, apks):
else:
logging.debug("Page " + page.name + " is unchanged")
else:
logging.warn("Deleting page " + page.name)
logging.warning('Deleting page ' + page.name)
page.delete('No longer published')
for pagename, text in genp.items():
logging.debug("Checking " + pagename)
@ -2162,15 +2162,15 @@ def main():
msg = _("{apkfilename} ({appid}) has no metadata!") \
.format(apkfilename=apk['apkName'], appid=apk['packageName'])
if options.delete_unknown:
logging.warn(msg + '\n\t' + _("deleting: repo/{apkfilename}")
.format(apkfilename=apk['apkName']))
logging.warning(msg + '\n\t' + _("deleting: repo/{apkfilename}")
.format(apkfilename=apk['apkName']))
rmf = os.path.join(repodirs[0], apk['apkName'])
if not os.path.exists(rmf):
logging.error(_("Could not find {path} to remove it").format(path=rmf))
else:
os.remove(rmf)
else:
logging.warn(msg + '\n\t' + _("Use `fdroid update -c` to create it."))
logging.warning(msg + '\n\t' + _('Use `fdroid update -c` to create it.'))
copy_triple_t_store_metadata(apps)
insert_obbs(repodirs[0], apps, apks)

View File

@ -117,7 +117,7 @@ def get_build_vm(srvdir, provider=None):
logging.debug('build vm provider \'virtualbox\' selected')
return VirtualboxBuildVm(abssrvdir)
else:
logging.warn('build vm provider not supported: \'%s\'', provider)
logging.warning('build vm provider not supported: \'%s\'', provider)
# try guessing provider from installed software
kvm_installed = shutil.which('kvm') is not None
@ -451,8 +451,8 @@ class LibvirtBuildVm(FDroidBuildVm):
os.remove('box.img')
else:
logging.warn("could not connect to storage-pool 'default', "
"skip packaging buildserver box")
logging.warning("could not connect to storage-pool 'default', "
"skip packaging buildserver box")
def box_add(self, boxname, boxfile, force=True):
boximg = '%s_vagrant_box_image_0.img' % (boxname)