Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to Python 3 #805

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ lint:

test: lint check-po
PYTHONPATH=$(pkgdatadir)/extensions:$(PYTHONPATH) \
python -m sugar3.test.discover $(top_srcdir)/tests
python3 -m sugar3.test.discover $(top_srcdir)/tests
4 changes: 2 additions & 2 deletions bin/sugar-backlight-setup
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3

# Copyright (C) 2015 Martin Abente Lahaye <tch@sugarlabs.org>
#
Expand Down Expand Up @@ -60,7 +60,7 @@ def _main():
try:
SugarBacklightSetup()
except Exception as err:
print 'Could not create device link: %s' % str(err)
print('Could not create device link: %s' % str(err))
sys.exit(1)

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion bin/sugar-control-panel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# Copyright (C) 2008, Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify
Expand Down
8 changes: 4 additions & 4 deletions bin/sugar-erase-bundle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
import os
import sys

Expand All @@ -8,8 +8,8 @@ DBusGMainLoop(set_as_default=True)
from jarabe.model import bundleregistry

def cmd_help():
print 'Usage: sugar-erase-bundle bundle_id [...] \n\n\
Erase activity bundles\n'
print('Usage: sugar-erase-bundle bundle_id [...] \n\n\
Erase activity bundles\n')

if len(sys.argv) < 2:
cmd_help()
Expand All @@ -19,7 +19,7 @@ for name in sys.argv[1:]:
registry = bundleregistry.get_registry()
bundle = registry.get_bundle(name)
if not bundle:
print 'Cannot find %s bundle.' % name
print('Cannot find %s bundle.' % name)
continue

registry.uninstall(bundle, delete_profile=True)
8 changes: 4 additions & 4 deletions bin/sugar-install-bundle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
import os
import sys

Expand All @@ -9,8 +9,8 @@ DBusGMainLoop(set_as_default=True)


def cmd_help():
print 'Usage: sugar-install-bundle activitybundle.xo [...] \n\n\
Install activity bundles\n'
print('Usage: sugar-install-bundle activitybundle.xo [...] \n\n\
Install activity bundles\n')

if len(sys.argv) < 2:
cmd_help()
Expand All @@ -24,4 +24,4 @@ for name in sys.argv[1:]:
# by triggering a GFileMonitor ATTRIBUTE_CHANGED event.
os.utime(path, None)

print "%s: '%s' installed." % (sys.argv[0], name)
print("%s: '%s' installed." % (sys.argv[0], name))
6 changes: 3 additions & 3 deletions bin/sugar-launch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3

# Copyright (C) 2007, Red Hat, Inc.
#
Expand Down Expand Up @@ -35,12 +35,12 @@ parser.add_argument("-u", "--uri",
help='URI to load')

args = parser.parse_args()
print args.bundle_id
print(args.bundle_id)
bus = dbus.SessionBus()
proxy = bus.get_object('org.laptop.Shell', '/org/laptop/Shell')
path = dbus.Interface(proxy, 'org.laptop.Shell').GetBundlePath(args.bundle_id)
if not path:
print 'Cannot find %s bundle.' % args.bundle_id
print('Cannot find %s bundle.' % args.bundle_id)
sys.exit(1)

activity = ActivityBundle(path)
Expand Down
2 changes: 1 addition & 1 deletion bin/sugar.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ cat > "$debug_file_path" << EOF
EOF
fi

exec python2 -m jarabe.main
exec python3 -m jarabe.main
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AM_INIT_AUTOMAKE([1.9 foreign dist-xz no-dist-gzip])

AM_MAINTAINER_MODE

PYTHON=python2
PYTHON=python3
AM_PATH_PYTHON

PKG_CHECK_MODULES(SHELL, gtk+-3.0)
Expand Down
6 changes: 3 additions & 3 deletions data/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
SUBDIRS = icons

sugar-72.gtkrc: gtkrc.em
$(srcdir)/em.py -D scaling=\'72\' $(srcdir)/gtkrc.em > \
empy3 -D scaling=\'72\' $(srcdir)/gtkrc.em > \
$(top_builddir)/data/sugar-72.gtkrc

sugar-100.gtkrc: gtkrc.em
$(srcdir)/em.py -D scaling=\'100\' $(srcdir)/gtkrc.em > \
empy3 -D scaling=\'100\' $(srcdir)/gtkrc.em > \
$(top_builddir)/data/sugar-100.gtkrc

sugardir = $(pkgdatadir)/data
Expand Down Expand Up @@ -60,5 +60,5 @@ polkit_policydir = $(datadir)/polkit-1/actions
polkit_in_files = org.sugar.brightness.policy.in org.sugar.serial-number.policy.in
polkit_policy_DATA = $(polkit_in_files:.policy.in=.policy)

EXTRA_DIST = $(sugar_DATA) $(xsessions_DATA) $(nmservice_DATA) $(mime_xml_in_files) em.py gtkrc.em $(icon_DATA) $(gsettings_SCHEMAS) $(convert_DATA) $(polkit_in_files)
EXTRA_DIST = $(sugar_DATA) $(xsessions_DATA) $(nmservice_DATA) $(mime_xml_in_files) gtkrc.em $(icon_DATA) $(gsettings_SCHEMAS) $(convert_DATA) $(polkit_in_files)
CLEANFILES = $(GTKRC_FILES) $(mime_xml_files) $(polkit_policy_DATA)
Loading