-
Notifications
You must be signed in to change notification settings - Fork 81
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 Six #383
Port to Six #383
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
It will be hard to test the individual files stand-alone and I don't think our build system tests will be of much use. I will think about it. Re telepathy, we'll have to do extensive testing of the Python 3 port as well. But maybe we can also ping Collabora to see if they have a Python3 equivalent (more likely to be maintained) toolkit we can begin migrating towards. |
This comment has been minimized.
This comment has been minimized.
I don't know how to fix the reference to Who is pinging Collabora? I don't know which |
Reviewed up to 743742d. |
Reviewed to 53f6a20. |
This comment has been minimized.
This comment has been minimized.
Reviewed to 89dc9ed. |
This comment has been minimized.
This comment has been minimized.
Reviewed to 9699941. I do not think there will be a port of all activities. It would be nice, but I'm a realist. 😁 Perhaps a better alternative is to use in activity.info;
Also consider;
Now that you have a ported activity, please also contribute to sugarlabs/sugar-docs#145. |
Reviewed to a50e843. |
Reviewed to f833bff. |
Reviewed to 1730e21. |
doc/index.rst
Outdated
@@ -2,7 +2,7 @@ Sugar Toolkit GTK3 | |||
================== | |||
|
|||
Sugar Toolkit GTK3, or `sugar3`, is a toolkit for writing Sugar | |||
activities in Python: | |||
activities in Python 3: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also in Python 2, so I suggest removing this change.
bin/sugar-activity
Outdated
instance.run_main_loop() | ||
|
||
main() | ||
activityinstance.main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing new line mark at end of file.
bin/sugar-activity3
Outdated
|
||
from sugar3.activity import activityinstance | ||
|
||
activityinstance.main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing new line mark at end of file.
src/sugar3/bundle/__init__.py
Outdated
* `exec` - how to execute the activity, e.g. `sugar-activity module.Class`, | ||
* `exec` - how to execute the activity, e.g. | ||
`sugar-activity3 module.Class` (For activities written in Python 3), | ||
`sugar-activity module.Class` (For activities written in Python 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both lines, should be "activities written for" rather than in. An activity could potentially instantiate both Python 2 and Python 3 interpreters in separate processes.
@Pro-Panda, do you have Debian styled packages for this branch yet? |
@@ -15,7 +15,7 @@ GNOME_COMPILE_WARNINGS(maximum) | |||
|
|||
AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal]) | |||
|
|||
PYTHON=python2 | |||
PYTHON=python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It specifically installs for python3
We need toolkit to be 2&3 compatible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I know. I don't yet have a fix for installing for both Python 2 and Python 3.
I am leaving this change as is for now, since LEM doesn't hold here.
Reference: https://en.wikipedia.org/wiki/Law_of_excluded_middle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pro-panda so the sugar toolkit is not yet completely 2 & 3 compatible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is compatible. You can override PYTHON when you call configure.ac, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes @quozl , as per my undersatnding in that case it will install either python 2 or python 3 and it totally depends upon user how they want to install the toolkit.
@quozl, no. |
We need the source package (the .tar.xz) to be capable of being installed for both python2 and python3, but not at the same time. The duty to do both is given to the user of the source package; such as the Fedora or Debian packager, or an end-user doing a native install by hand. So I'll consider the changes for sugar-toolkit-gtk3 to be complete in this respect once PYTHON can be set to either, at the shell prompt. At the moment, we're overriding PYTHON rather than using a default. |
@quozl |
Yes, the OLPC bug tracker; e.g. http://dev.laptop.org/ticket/2855 |
Rebased on master. @Pro-Panda, please save your local branch and check against your GitHub branch. |
Reviewed to cc3050f. |
Reviewed to bd386f7. |
Reviewed to 0ec673f. |
@pro-panda, I'm unable to Here's what I've done;
Here's what I've found since;
So it would seem that our |
Thanks for testing. I agree. Reproduced on Ubuntu 16.04. |
On Sun, Sep 23, 2018 at 08:11:36PM -0700, James Cameron wrote:
@pro-panda, I'm unable to import sugar3 in Python 3. Have you any idea why?
Here's what I've done;
• installed a Debian Stretch VM, using Sugar Live Build,
• checked out this branch, autogen.sh, configure, make, make install,
• tried import sugar3 within Python, which gives ImportError: No module named
'sugar3',
Here's what I've found since;
• the make install has copied files to /usr/lib/python3.5/site-packages/
sugar3,
• installing python3-serial package has placed files in /usr/lib/python3/
dist-packages,
• renaming site-packages to dist-packages fixes the import fail,
• moving the sugar3 directory from the first to the second directory fixes
the import fail.
So it would seem that our make install uses the wrong place.
This is just a start as to how to understand how to reconcile the two locations:
https://stackoverflow.com/questions/9387928/whats-the-difference-between-dist-packages-and-site-packages#9388115
but from that it looks like each method of installing was doing what it was supposed to do, under Debian policy.
The question is how to reconcile the different uses of the two?
Rather than trying to make one or the other work, perhaps configuring path variables to check both types of locations is the way forward?
|
I'm guessing from the policy Debian just doesn't support user-installed system-wide Python packages without the user also changing the path. Best ways forward seem to depend on target;
I've not evaluated Fedora. |
I agree. I couldn't find an alternate as well |
* Embedded the single used instance in itself
* avoid name clashing with the name of the module imported
Activities could not be started, shell.log contained Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 604, in msg_reply_handler reply_handler(*message.get_args_list(**get_args_opts)) File "/usr/lib/python2.7/sugar3/activity/activityfactory.py", line 251, in _activate_reply_handler self._create_activity() File "/usr/lib/python2.7/sugar3/activity/activityfactory.py", line 222, in _create_activity (log_path, log_file) = open_log_file(self._bundle) File "/usr/lib/python2.7/sugar3/activity/activityfactory.py", line 140, in open_log_file f = open(fd, 'w') TypeError: coercing to Unicode: need string or buffer, int found
Merged as aa8a5e7, thanks! |
Any further work required to be done on this pr? It is still a part of Project Task Checklist for port to python3 project. Thanks! |
See #382 for the work remaining to be done. |
I think there is a need to include this in the Native build documentation. Suggestions? |
Sure. It's a mess. Debian and Fedora both seem to have problems dealing with installing Python programs using Sub task make local Fedora and Debian packages for testing by others in each of our Port to Python 3 issues should help to ensure our release, when made, will build and run on Fedora and Debian. |
Changes made/being made in this PR: #382