Author terry.reedy
Recipients r.david.murray, serhiy.storchaka, terry.reedy, zach.ware
Date 2014-02-28.02:41:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1393555274.96.0.426862268582.issue20035@psf.upfronthosting.co.za>
In-reply-to
Content
The patch works to suppress the message for test_ttk_guionly.  However, unfix_environ does not undo everything that needs to be undone, as evidenced by #20800.

The patch does not fix test_idle. I suspect that this is because test_idle pulls in tests from numerous modules, none of which has the unfix call. However, rather than require a tearDowmnodule for every module that imports tkinter, lets fix the root problem. I thought of having the environment change warning function ignore changes to TCL/TK/TIX_LIBRARY, but even better would be to not change them. Rename _fix to _dirs and redefine its mission as setting and holding three module attributes: tcldir, tkdir, and tixdir. They would be set from either the environment or the alternate search code. Any other modules that need the info should get it from _dirs rather the environment.

I believe this part of _fix is buggy.
+        if "TCL_LIBRARY" not in os.environ:
+            for name in os.listdir(prefix):
+                if name.startswith("tcl"):
+                    tcldir = os.path.join(prefix,name)
+                    if os.path.isdir(tcldir):
+                        os.environ["TCL_LIBRARY"] = tcldir
Both base/tcl and base/../tcktk/lib contain (for 3.4) directories named tcl8 and tcl8.6. Since only tcl8.6 works, the code above depends on listdir presenting it second. The 'if name' clause could be augmented with 'and name[-2] == '.'.
History
Date User Action Args
2014-02-28 02:41:15terry.reedysetrecipients: + terry.reedy, r.david.murray, zach.ware, serhiy.storchaka
2014-02-28 02:41:14terry.reedysetmessageid: <1393555274.96.0.426862268582.issue20035@psf.upfronthosting.co.za>
2014-02-28 02:41:14terry.reedylinkissue20035 messages
2014-02-28 02:41:14terry.reedycreate