py3: Use print() function
This commit is contained in:
parent
414708b405
commit
413d539a7b
@ -1,4 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
import logging
|
||||
import os
|
||||
@ -113,7 +113,7 @@ def main():
|
||||
try:
|
||||
return args.command.run(args, proxied_config, enabled_extensions)
|
||||
except NotImplementedError:
|
||||
print root_cmd.format_help()
|
||||
print(root_cmd.format_help())
|
||||
return 1
|
||||
|
||||
except KeyboardInterrupt:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
import argparse
|
||||
import collections
|
||||
@ -112,7 +112,7 @@ class Command(object):
|
||||
|
||||
def exit(self, status_code=0, message=None, usage=None):
|
||||
"""Optionally print a message and exit."""
|
||||
print '\n\n'.join(m for m in (usage, message) if m)
|
||||
print('\n\n'.join(m for m in (usage, message) if m))
|
||||
sys.exit(status_code)
|
||||
|
||||
def format_usage(self, prog=None):
|
||||
@ -341,7 +341,7 @@ class ConfigCommand(Command):
|
||||
self.set(base_verbosity_level=-1)
|
||||
|
||||
def run(self, config, errors, extensions):
|
||||
print config_lib.format(config, extensions, errors)
|
||||
print(config_lib.format(config, extensions, errors))
|
||||
return 0
|
||||
|
||||
|
||||
@ -353,5 +353,5 @@ class DepsCommand(Command):
|
||||
self.set(base_verbosity_level=-1)
|
||||
|
||||
def run(self):
|
||||
print deps.format_dependency_list()
|
||||
print(deps.format_dependency_list())
|
||||
return 0
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
import io
|
||||
import os.path
|
||||
@ -10,13 +10,13 @@ from mopidy.utils import path
|
||||
|
||||
def load():
|
||||
settings_file = path.expand_path(b'$XDG_CONFIG_DIR/mopidy/settings.py')
|
||||
print 'Checking %s' % settings_file
|
||||
print('Checking %s' % settings_file)
|
||||
|
||||
setting_globals = {}
|
||||
try:
|
||||
execfile(settings_file, setting_globals)
|
||||
except Exception as e:
|
||||
print 'Problem loading settings: %s' % e
|
||||
print('Problem loading settings: %s' % e)
|
||||
return setting_globals
|
||||
|
||||
|
||||
@ -106,20 +106,20 @@ def main():
|
||||
'spotify', 'scrobbler', 'mpd', 'mpris', 'local', 'stream', 'http']
|
||||
extensions = [e for e in ext.load_extensions() if e.ext_name in known]
|
||||
|
||||
print b'Converted config:\n'
|
||||
print config_lib.format(config, extensions)
|
||||
print(b'Converted config:\n')
|
||||
print(config_lib.format(config, extensions))
|
||||
|
||||
conf_file = path.expand_path(b'$XDG_CONFIG_DIR/mopidy/mopidy.conf')
|
||||
if os.path.exists(conf_file):
|
||||
print '%s exists, exiting.' % conf_file
|
||||
print('%s exists, exiting.' % conf_file)
|
||||
sys.exit(1)
|
||||
|
||||
print 'Write new config to %s? [yN]' % conf_file,
|
||||
print('Write new config to %s? [yN]' % conf_file, end=' ')
|
||||
if raw_input() != 'y':
|
||||
print 'Not saving, exiting.'
|
||||
print('Not saving, exiting.')
|
||||
sys.exit(0)
|
||||
|
||||
serialized_config = config_lib.format(config, extensions, display=False)
|
||||
with io.open(conf_file, 'wb') as filehandle:
|
||||
filehandle.write(serialized_config)
|
||||
print 'Done.'
|
||||
print('Done.')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user