Bug 560787 - Review Request: python-mtTkinter - A thread-safe version of Tkinter
Summary: Review Request: python-mtTkinter - A thread-safe version of Tkinter
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Haïkel Guémar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-02-01 20:31 UTC by Paulo Roma Cavalcanti
Modified: 2011-08-31 18:41 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-08-31 18:41:03 UTC
Type: ---
Embargoed:
karlthered: fedora-review+
gwync: fedora-cvs+


Attachments (Terms of Use)

Description Paulo Roma Cavalcanti 2010-02-01 20:31:58 UTC
Spec URL: 

http://orion.lcg.ufrj.br/RPMS/SPECS/python-mtTkinter.spec

SRPM URL: 

http://orion.lcg.ufrj.br/RPMS/src/python-mtTkinter-0.3-1.fc12.src.rpm

Description:

Although Tkinter is technically thread-safe
(assuming Tk is built with --enable-threads),
practically speaking there are still problems when used in multithreaded
Python applications.  The problems stem from the fact that the _tkinter
module attempts to gain control of the main thread via a polling technique
when processing calls from other threads.  If it succeeds, all is well.
If it fails (i.e., after a timeout), the application receives an exception
with the message: "RuntimeError: main thread is not in main loop".
There is no way to tell when this might happen, so calling Tk routines
from multiple threads seems to be problematic at best.

The mtTkinter module solves this problem by modifying some Tkinter
module definitions (in memory). The modified code intercepts
out-of-thread Tkinter calls and marshals them through a queue which
is read by an 'after' event running periodically in the main loop.
This is similar to the technique used in many other platforms
(e.g., .NET's InvokeRequired/Invoke mechanism).
The technique used in mtTkinter is exception-safe as well,
marshaling exceptions through a response queue back to the caller's thread.

Comment 1 Thomas Kowaliczek 2010-03-29 00:01:02 UTC
I will review it this week.

Comment 2 Thomas Kowaliczek 2010-07-26 00:48:54 UTC
Sorry for the long delay. But you think you will have this package in Fedora because upstream seams to be dead?

Comment 3 Paulo Roma Cavalcanti 2010-07-26 01:20:41 UTC
The only reason I am bringing this package to Fedora is because
Fedora is the only distro I know, which ships TCL without thread support.
The reason was some three year old bug in an obscure application, but I could never make the maintainers review this decision...

This makes very difficult to write any python multi threaded application using tk, for instance. In other words, either Fedora enables threads in TCL or gives us some alternative, such as mtTkInter. 

This package is a one file only python script, but it does its job and does not need to be an "active" project to be useful, in this particular case.

Comment 4 Jason Tibbitts 2010-12-29 16:57:58 UTC
This just reappeared in the review queue.  Does it still need a review?  I thought that something related to TCL and threads in Fedora was changing but I may have misunderstood.  Have you communicated with the TCL maintainer about this issue?

Comment 5 Paulo Roma Cavalcanti 2010-12-29 22:10:58 UTC
Hi,

if you run 

/usr/lib/python2.7/site-packages/mtTkinter.py

a window will be open, stating whether tcl was built with threads enabled.

In the case of F14, it prints: Tcl is NOT built with thread support

This package does not interfere with anything. One just needs to use:

from mtTkinter import *

instead of 

from Tkinter import *

on a python code. It is simple like that ...

Comment 6 Jason Tibbitts 2011-01-06 20:06:56 UTC
Unfortunately the srpm link above is invalid.  The directory is browsable but I do not see anything applicable.

Please clear the whiteboard if providing a package for review.

Comment 8 Jason Tibbitts 2011-01-08 23:54:36 UTC
A few comments:

%python_sitearch doesn't seem to be used anywhere; you should remove it if it's not needed.

I don't know what releases you're targeting, but you can remove BuildRoot, the first line of %install and the %clean section on Fedora and EL6.

I see no license information at all on either the mtTkinter.py file or the 08-clock-bezier.py file.  Where do you see that those files are under the Python license?  Also, does the latter file not have an upstream?  It doesn't seem like it belongs in the package.

/usr/lib/python2.7/site-packages/mtTkinter.py should not be executable, and should not have the shebang line you patch onto it.  You also should not patch in copyright information like that.

Comment 9 Paulo Roma Cavalcanti 2011-01-09 00:30:38 UTC
(In reply to comment #8)
> A few comments:
> 
> %python_sitearch doesn't seem to be used anywhere; you should remove it if it's
> not needed.

No problem.

> 
> I don't know what releases you're targeting, but you can remove BuildRoot, the
> first line of %install and the %clean section on Fedora and EL6.

It works with python 2.4 (RHEL5) too.

> 
> I see no license information at all on either the mtTkinter.py file or the
> 08-clock-bezier.py file.  Where do you see that those files are under the
> Python license?  Also, does the latter file not have an upstream?  It doesn't
> seem like it belongs in the package.
> 

08-clock-bezier.py is an example written by me. It is the smallest
script I could think of where the problem shows up, and it is based on an old 
tcl script.

I did not find any license file for mtTkinter.py, but since it is
a modification of tkinter, doesn't it have the same license?


> /usr/lib/python2.7/site-packages/mtTkinter.py should not be executable, and
> should not have the shebang line you patch onto it.  You also should not patch
> in copyright information like that.

I agree with you. The patch should be removed, because it does not add anything
useful.

Comment 10 Jason Tibbitts 2011-01-09 03:27:04 UTC
I can't say what the license would be.  Does the original source not have license text either?  It doesn't look like it does.

In any case, if it's just a simple modification of the original file, I have to wonder why our python package doesn't just carry the modifications.  I went ahead and diffed the two files, but they seem to differ rather significantly.  So much, in fact, that I have to question your statement that it's simply a modification of the original file.  It looks to me more like it merely wraps the original classes and is a separate work which would carry its own license.

I'll go ahead and block FE-Legal; if you can get clarification from upstream then this can certainly proceed; otherwise perhaps the legal folks will see something indicating a license that I'm missing.

Comment 11 Paulo Roma Cavalcanti 2011-01-09 03:38:28 UTC
I did not say it is a simple modification.

In the source it is written:


"This module modifies the original Tkinter module in memory, making all
functionality thread-safe. It does this by wrapping the Tk class' tk
instance with an object that diverts calls through an event queue when
the call is issued from a thread other than the thread in which the Tk
instance was created. The events are processed in the creation thread
via an 'after' event."

Comment 12 Jason Tibbitts 2011-01-09 04:14:59 UTC
You said it was a modification.  It does not appear to be.  It appears to be an original work.  As such you cannot say that the license somehow derives from that of the Tkinter source.

Comment 13 Paulo Roma Cavalcanti 2011-01-14 22:29:58 UTC
The license is officially GPLv3+ now.

http://roma.fedorapeople.org/specs/python-mtTkinter.spec

http://roma.fedorapeople.org/srpms/python-mtTkinter-0.4-1.fc14.src.rpm

Thanks.

Comment 14 Tom "spot" Callaway 2011-06-30 16:59:56 UTC
Your license tag is wrong. It should be LGPLv3+. Nevertheless, I'm lifting FE-Legal here, please fix before finalizing review.

Comment 15 Paulo Roma Cavalcanti 2011-08-14 11:21:31 UTC
The license has been fixed to LGPLv3+.

http://roma.fedorapeople.org/specs/python-mtTkinter.spec

http://roma.fedorapeople.org/srpms/python-mtTkinter-0.4-2.fc14.src.rpm

Thanks.

Comment 16 Haïkel Guémar 2011-08-28 11:34:31 UTC
My review took into consideration previous comments from Jason and Spot.
Licensing issues should have been cleared, and though not actively maintained (it has no need to be), upstream maintainer still answers.

Package Review: python-mtTkinter (noarch)
=========================================

Key:
- = N/A
x = Check
! = Problem
? = Not evaluated

=== REQUIRED ITEMS ===
[x]  Package is named according to the Package Naming Guidelines. [1]
[x]  Spec file name must match the base package %{name}, in the format %{name}.spec.
[x]  Spec file is legible and written in American English.
[x]  Spec uses macros instead of hard-coded directory names.
[x]  Package consistently uses macros.
[x]  Requires correct
[-]  All build dependencies are listed in BuildRequires, except for any that are listed in the exceptions section of Packaging Guidelines. [2]
[x]  Package run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) and the beginning of %install.
[x]  Package has a %clean section, which contains rm -rf %{buildroot} (or $RPM_BUILD_ROOT).
[-]  The spec file handles locales properly.
[x]  Changelog in prescribed format.
[!]  Rpmlint output is silent.
$ rpmlint -iv python-mtTkinter-0.4-2.fc15.src.rpm 
python-mtTkinter.src: I: checking
python-mtTkinter.src: W: spelling-error %description -l en_US multithreaded -> multicolored
The value of this tag appears to be misspelled. Please double-check.

python-mtTkinter.src: W: spelling-error %description -l en_US tkinter -> interlink, inter
The value of this tag appears to be misspelled. Please double-check.

python-mtTkinter.src: W: spelling-error %description -l en_US NET's -> Net's, NE's, PET's
The value of this tag appears to be misspelled. Please double-check.

python-mtTkinter.src: I: checking-url http://tkinter.unpythonic.net/wiki/mtTkinter (timeout 10 seconds)
python-mtTkinter.src: I: checking-url http://tkinter.unpythonic.net/attach/mtTkinter/attachments/mtTkinter-0.4.tar.gz (timeout 10 seconds)
python-mtTkinter.src: W: invalid-url Source0: http://tkinter.unpythonic.net/attach/mtTkinter/attachments/mtTkinter-0.4.tar.gz HTTP Error 404: Not Found
The value should be a valid, public HTTP, HTTPS, or FTP URL.

1 packages and 0 specfiles checked; 0 errors, 4 warnings.

$ rpmlint -iv /home/haikel/rpmbuild/RPMS/noarch/python-mtTkinter-0.4-2.fc15.noarch.rpm 
python-mtTkinter.noarch: I: checking
python-mtTkinter.noarch: W: spelling-error %description -l en_US multithreaded -> multicolored
The value of this tag appears to be misspelled. Please double-check.

python-mtTkinter.noarch: W: spelling-error %description -l en_US NET's -> Net's, NE's, PET's
The value of this tag appears to be misspelled. Please double-check.

python-mtTkinter.noarch: I: checking-url http://tkinter.unpythonic.net/wiki/mtTkinter (timeout 10 seconds)
python-mtTkinter.noarch: E: script-without-shebang /usr/lib/python2.7/site-packages/mtTkinter.py
This text file has executable bits set or is located in a path dedicated for
executables, but lacks a shebang and cannot thus be executed.  If the file is
meant to be an executable script, add the shebang, otherwise remove the
executable bits or move the file elsewhere.

1 packages and 0 specfiles checked; 1 errors, 2 warnings.

===> you should not install mtTkinter.py with executable bits set
Some python modules provide a __main__ entry point for testing purpose (for instance, httplib.py from stdlib) but they should not be installed with a 0755 mask.

[x]  License field in the package spec file matches the actual license.
LGPLv3+
[x]  If (and only if) the source package includes the text of the license(s) in its own file, then that file, containing the text of the license(s) for the package is included in %doc.
[-]  License file installed when any subpackage combination is installed.
[x]  Package is licensed with an open-source compatible license and meets other legal requirements as defined in the legal section of Packaging Guidelines. [3,4]
[x]  Sources contain only permissible code or content.
[!]  Sources used to build the package matches the upstream source, as provided in the spec URL.
     sha1sum provided sources: 87be4bc80ac0bfa77ea07a91ff65c3ec9e6b94a2
     sha1sum upstream sources: 461bfe1d3e9cf5df12fb6edad3c332397b6d101a
     
     Though diff had shown me no difference, please use upstream sources (they're definitively not the same, since upstream sources properly uncompress inside a subdirectory)

[-]  Compiler flags are appropriate.
[-]  ldconfig called in %post and %postun if required.
[x]  Package must own all directories that it creates.
[x]  Package does not own files or directories owned by other packages.
[-]  Package requires other packages for directories it uses.
[x]  Package does not contain duplicates in %files.
[!]  Permissions on files are set properly.
fix the mtTkinter.py permissions as seen above
[x]  Each %files section contains %defattr.
[-]  No %config files under /usr.
[-]  %config files are marked noreplace or the reason is justified.
[-]  Package contains a properly installed %{name}.desktop using desktop-file-install file if it is a GUI application. [5]
[-]  Package contains a valid .desktop file.
[x]  Package contains code, or permissable content.
[-]  Package contains a SysV-style init script if in need of one.
[x]  File names are valid UTF-8.
[-]  Large documentation files are in a -doc subpackage, if required.
[x]  Package uses nothing in %doc for runtime.
[x]  Package contains no bundled libraries.
[-]  Header files in -devel subpackage, if present.
[-]  Static libraries in -static subpackage, if present.
[-]  Package contains no static executables.
[-]  Package requires pkgconfig, if .pc files are present.
[-]  Development .so files in -devel subpackage, if present.
[x]  Fully versioned dependency in subpackages, if present.
[-]  Package does not contain any libtool archives (.la).
[-]  Useful -debuginfo package or justification otherwise.
[-]  Rpath absent or only used for internal libs.
[x]  Package does not generate any conflict.
[x]  Package successfully compiles and builds into binary rpms on at least one supported architecture.
[-]  Package is not known to require ExcludeArch.
[x]  Package installs properly.
[x]  Package obeys FHS, except libexecdir and /usr/target.
[-]  Package meets the Packaging Guidelines. [6]

=== SUGGESTED ITEMS ===
[x]  Package functions as described.
[x]  Latest version is packaged.
[x]  Package does not include license text files separate from upstream.
[x]  If the source package does not include license text(s) as a separate file from upstream, the packager SHOULD query upstream to include it.
[-]  Description and summary sections in the package spec file contains translations for supported Non-English languages, if available.
[x]  SourceX is a working URL.
[-]  SourceX / PatchY prefixed with %{name}.
[x]  Final provides and requires are sane (rpm -q --provides and rpm -q --requires).
[-]  %check is present and all tests pass.
[-]  Usually, subpackages other than devel should require the base package using a fully versioned dependency.
[x]  Reviewer should test that the package builds in mock.
tested local build mock for f16 and rawhide (x86_64)
[x]  Package should compile and build into binary rpms on all supported architectures.
[x]  Dist tag is present.
[x]  Spec use %global instead of %define.
[-]  Scriptlets must be sane, if used.
[-]  The placement of pkgconfig(.pc) files are correct.
[-]  No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]  Packages should try to preserve timestamps of original installed files.
[-]  File based requires are sane.
[-]  Man pages included for all executables.
[-]  Uses parallel make.
[-]  Patches link to upstream bugs/comments/lists or are otherwise justified.

=== Issues ===
1. use upstream sources
2. install mtTkinter.py module with permissions set to 0644

=== Final Notes ===

As soon as the two issues above are fixed, i'll approve this package.

================
*** PENDING  ***
================

[1] https://fedoraproject.org/wiki/Packaging:NamingGuidelines
[2] https://fedoraproject.org/wiki/Packaging/Guidelines#Exceptions_2 
[3] https://fedoraproject.org/wiki/Packaging:LicensingGuidelines
[4] https://fedoraproject.org/wiki/Licensing:Main
[5] https://fedoraproject.org/wiki/Packaging:Guidelines#Desktop_files
[6] https://fedoraproject.org/wiki/Packaging:Guidelines

Comment 17 Paulo Roma Cavalcanti 2011-08-29 03:18:59 UTC
Hi,

I think the developer just used a directory to hold the sources and did
not changed the release. I was just using the previous .tar.gz initially posted on the site ...

I also fixed the file permission to 0644:

SPEC: http://roma.fedorapeople.org/specs/python-mtTkinter.spec 

SRPM: http://roma.fedorapeople.org/srpms/python-mtTkinter-0.4-3.fc14.src.rpm

Thanks.

Comment 18 Haïkel Guémar 2011-08-29 12:37:11 UTC
No problem, i checked again and all OK points are still valid.
* sources sha1sum
provided sources: 461bfe1d3e9cf5df12fb6edad3c332397b6d101a
upstream sources: 461bfe1d3e9cf5df12fb6edad3c332397b6d101a
* rawhide scratch build: http://koji.fedoraproject.org/koji/taskinfo?taskID=3308609
* rpmlint output:
$ rpmlint -iv python-mtTkinter-0.4-3.fc17.src.rpm 
python-mtTkinter.src: I: checking
python-mtTkinter.src: W: spelling-error %description -l en_US multithreaded -> multicolored
The value of this tag appears to be misspelled. Please double-check.

python-mtTkinter.src: W: spelling-error %description -l en_US tkinter -> interlink, inter
The value of this tag appears to be misspelled. Please double-check.

python-mtTkinter.src: W: spelling-error %description -l en_US NET's -> Net's, NE's, PET's
The value of this tag appears to be misspelled. Please double-check.

python-mtTkinter.src: I: checking-url http://tkinter.unpythonic.net/wiki/mtTkinter (timeout 10 seconds)
python-mtTkinter.src: I: checking-url http://tkinter.unpythonic.net/attach/mtTkinter/attachments/mtTkinter-0.4.tar.gz (timeout 10 seconds)
python-mtTkinter.src: W: invalid-url Source0: http://tkinter.unpythonic.net/attach/mtTkinter/attachments/mtTkinter-0.4.tar.gz HTTP Error 404: Not Found
The value should be a valid, public HTTP, HTTPS, or FTP URL.

1 packages and 0 specfiles checked; 0 errors, 4 warnings.

$ rpmlint -iv python-mtTkinter-0.4-3.fc17.noarch.rpm
python-mtTkinter.noarch: I: checking
python-mtTkinter.noarch: W: spelling-error %description -l en_US multithreaded -> multicolored
The value of this tag appears to be misspelled. Please double-check.

python-mtTkinter.noarch: W: spelling-error %description -l en_US NET's -> Net's, NE's, PET's
The value of this tag appears to be misspelled. Please double-check.

python-mtTkinter.noarch: I: checking-url http://tkinter.unpythonic.net/wiki/mtTkinter (timeout 10 seconds)
1 packages and 0 specfiles checked; 0 errors, 2 warnings.

It's all green, and you get my blessing to import this into Fedora Packages collection. Please remember to close this ticket once you import and rebuild it.

================
*** APPROVED ***
================

Comment 19 Paulo Roma Cavalcanti 2011-08-29 15:34:53 UTC
Thanks.

New Package SCM Request
=======================
Package Name: python-mtTkinter
Short Description: A thread-safe version of Tkinter
Owners: roma
Branches: f14 f15 el5 el6
InitialCC:roma

Comment 20 Gwyn Ciesla 2011-08-29 15:42:59 UTC
Git done (by process-git-requests).

Added f16 branch.


Note You need to log in before you can comment on or make changes to this bug.