mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
Require and use Python3
This commit is contained in:
parent
5630a96b77
commit
c9d8bb9d00
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# -*- mode: python -*-
|
||||
#
|
||||
# This file is part of Plinth.
|
||||
@ -69,7 +69,7 @@ def subcommand_get_installed(_):
|
||||
with open('/dev/null', 'w') as file_handle:
|
||||
status = subprocess.call(['which', 'firewalld'], stdout=file_handle)
|
||||
|
||||
print 'installed' if not status else 'not installed'
|
||||
print('installed' if not status else 'not installed')
|
||||
|
||||
|
||||
def subcommand_get_status(_):
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# -*- mode: python -*-
|
||||
#
|
||||
# This file is part of Plinth.
|
||||
@ -96,7 +96,7 @@ def subcommand_get_installed(_):
|
||||
with open('/dev/null', 'w') as file_handle:
|
||||
status = subprocess.call(['which', 'pagekite'], stdout=file_handle)
|
||||
|
||||
print 'installed' if not status else 'not installed'
|
||||
print('installed' if not status else 'not installed')
|
||||
|
||||
|
||||
def subcommand_start(_):
|
||||
@ -116,7 +116,7 @@ def subcommand_stop(_):
|
||||
def subcommand_get_status(_):
|
||||
"""Print status of the pagekite service"""
|
||||
is_enabled = is_pagekite_enabled()
|
||||
print 'enabled' if is_enabled else 'disabled'
|
||||
print('enabled' if is_enabled else 'disabled')
|
||||
|
||||
|
||||
def is_pagekite_enabled():
|
||||
@ -139,19 +139,19 @@ def subcommand_set_status(arguments):
|
||||
enable = arguments.enable == 'enable'
|
||||
is_enabled = is_pagekite_enabled()
|
||||
if enable and is_enabled:
|
||||
print 'already enabled'
|
||||
print('already enabled')
|
||||
return
|
||||
|
||||
if not enable and not is_enabled:
|
||||
print 'already disabled'
|
||||
print('already disabled')
|
||||
return
|
||||
|
||||
if enable:
|
||||
pagekite_enable()
|
||||
print 'enabled'
|
||||
print('enabled')
|
||||
else:
|
||||
pagekite_disable()
|
||||
print 'disabled'
|
||||
print('disabled')
|
||||
|
||||
|
||||
def pagekite_enable():
|
||||
@ -192,8 +192,8 @@ def subcommand_get_kite(_):
|
||||
kite_secret = match.group(1)
|
||||
continue
|
||||
|
||||
print kite_name
|
||||
print kite_secret
|
||||
print(kite_name)
|
||||
print(kite_secret)
|
||||
|
||||
|
||||
def subcommand_set_kite(arguments):
|
||||
@ -205,7 +205,7 @@ def subcommand_set_kite(arguments):
|
||||
file_path_new = os.path.join(CONFIG_DIR, '10_account.rc.new')
|
||||
with open(file_path, 'r') as read_file_object, \
|
||||
os.fdopen(os.open(file_path_new, os.O_WRONLY | os.O_CREAT,
|
||||
0400), 'w') as write_file_object:
|
||||
0o400), 'w') as write_file_object:
|
||||
for line in read_file_object:
|
||||
if re.match(r'[ \t]*kitename[ \t]*=.*', line):
|
||||
write_file_object.write(
|
||||
@ -225,7 +225,7 @@ def subcommand_set_kite(arguments):
|
||||
def subcommand_get_service_status(arguments):
|
||||
"""Print status of the pagekite service"""
|
||||
is_enabled = is_service_enabled(arguments.service)
|
||||
print 'enabled' if is_enabled else 'disabled'
|
||||
print('enabled' if is_enabled else 'disabled')
|
||||
|
||||
|
||||
def is_service_enabled(service):
|
||||
@ -253,19 +253,19 @@ def subcommand_set_service_status(arguments):
|
||||
enable = arguments.enable == 'enable'
|
||||
is_enabled = is_service_enabled(arguments.service)
|
||||
if enable and is_enabled:
|
||||
print 'already enabled'
|
||||
print('already enabled')
|
||||
return
|
||||
|
||||
if not enable and not is_enabled:
|
||||
print 'already disabled'
|
||||
print('already disabled')
|
||||
return
|
||||
|
||||
if enable:
|
||||
service_enable(arguments.service)
|
||||
print 'enabled'
|
||||
print('enabled')
|
||||
else:
|
||||
service_disable(arguments.service)
|
||||
print 'disabled'
|
||||
print('disabled')
|
||||
|
||||
|
||||
def service_enable(service_name):
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# This file is part of Plinth.
|
||||
#
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
from plinth.menu import Menu
|
||||
import configparser
|
||||
import os
|
||||
|
||||
import ConfigParser
|
||||
from ConfigParser import SafeConfigParser
|
||||
from plinth.menu import Menu
|
||||
|
||||
product_name = None
|
||||
box_name = None
|
||||
@ -39,7 +38,7 @@ def read():
|
||||
directory = os.path.join(directory, '..')
|
||||
CONFIG_FILE = os.path.join(directory, 'plinth.config')
|
||||
|
||||
parser = SafeConfigParser(
|
||||
parser = configparser.SafeConfigParser(
|
||||
defaults={
|
||||
'root': os.path.realpath(directory),
|
||||
})
|
||||
@ -63,9 +62,9 @@ def read():
|
||||
try:
|
||||
value = parser.get(section, name)
|
||||
globals()[name] = value
|
||||
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
|
||||
print ('Configuration does not contain the {}.{} option.'
|
||||
.format(section, name))
|
||||
except (configparser.NoSectionError, configparser.NoOptionError):
|
||||
print('Configuration does not contain the {}.{} option.'
|
||||
.format(section, name))
|
||||
raise
|
||||
|
||||
global port # pylint: disable-msg=W0603
|
||||
|
||||
@ -60,7 +60,7 @@ def index(request):
|
||||
return TemplateResponse(
|
||||
request, 'firewall.html',
|
||||
{'title': _('Firewall'),
|
||||
'services': service_module.SERVICES.values(),
|
||||
'services': list(service_module.SERVICES.values()),
|
||||
'internal_enabled_services': internal_enabled_services,
|
||||
'external_enabled_services': external_enabled_services})
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ class Santiago(PagePlugin):
|
||||
admin['santiago']['address'] = "b5wycujkfh2jxfdo.onion"
|
||||
cfg.users['admin'] = admin
|
||||
return cfg.users['admin']['santiago']['address']
|
||||
print "Need to add these two lines to /etc/torrc:\n%s" % hidden_service_config
|
||||
print("Need to add these two lines to /etc/torrc:\n%s" % hidden_service_config)
|
||||
return ""
|
||||
|
||||
def check_for_hidden_service(self):
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# This file is part of Plinth.
|
||||
#
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# -*- mode: python; mode: auto-fill; fill-column: 80 -*-
|
||||
|
||||
import os
|
||||
|
||||
2
run
2
run
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# This file is part of Plinth.
|
||||
#
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user