#5747 closed defect (fixed)
[Patch] Uses deprecated sha module in graphviz.py
Reported by: | Dmitry Shurupov | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Component: | GraphvizPlugin |
Severity: | normal | Keywords: | patch |
Cc: | py.hieroglyph@…, Sigurd Hogsbro, Christian Boos, Steffen Hoffmann | Trac Release: | 1.0 |
Description
We've updated Python from 2.5 to 2.6 on our server with Trac installation. After that, we're getting Python warnings every single time graphviz plugin is used. The warning is as follows:
/usr/lib64/python2.6/site-packages/graphviz-0.7.4-py2.6.egg/graphviz/graphviz.py:23: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
The problem exists in 0.7.6dev version as well. I guess, this should be fixed.
Attachments (2)
Change History (28)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
Cc: | py.hieroglyph@… added; anonymous removed |
---|
Added cc for fix updates...
comment:3 Changed 15 years ago by
Summary: | Using of deprecated sha module in graphviz.py → [Patch] Using of deprecated sha module in graphviz.py |
---|
comment:4 Changed 15 years ago by
Keywords: | patch added |
---|
comment:6 Changed 14 years ago by
It would be nice to get some of these trivial updates applied to the SVN tree.
comment:7 Changed 14 years ago by
Cc: | Sigurd Hogsbro added |
---|
comment:8 Changed 14 years ago by
It looks like cboos is maintaining this plugin, so you might need to talk with him.
Changed 14 years ago by
Attachment: | GraphViz-fix-py26-sha.patch added |
---|
Patch to fix sha module deprecation in Python 2.6 while maintaining compatability
comment:9 Changed 14 years ago by
Priority: | low → normal |
---|
I have attached a GraphViz-fix-py26-sha.patch that fixes the deprecation warning in Python 2.6 without breaking compatibility (since hashlib does not exist in pre-2.5).
Basically, I simply reused the fix that was made in Trac core via the trac.util.compat module.
Hope this gets in soon...
Changed 14 years ago by
Attachment: | GraphViz-fix-py26-sha.2.patch added |
---|
same patch, fixed mistake in import
comment:11 Changed 13 years ago by
Cc: | Christian Boos added |
---|
I'd like to finally get this fixed too and get rid of the warnings in my log file. I'll go ahead and take care of committing this to the repos if cboos has no objections (or if we don't hear anything back in the standard 2 week time period).
comment:13 Changed 13 years ago by
Another suggestion, only replace module sha with hashlib.sha1 works for me. My environment pyton 2.6.7.
comment:14 Changed 13 years ago by
Owner: | changed from Peter Kropf to Ryan J Ollos |
---|
I'd like to go ahead and fix this if the maintainer has no objections.
comment:15 follow-up: 19 Changed 13 years ago by
Status: | new → assigned |
---|
I've issued sufficient warning in comment:11 and comment:14 ... time to apply this ;)
The patch by itamarost is great, except sha1
doesn't exist doesn't exist in trac.util.compat
in 0.11, and we are trying to maintain compatibility on plugins back to 0.11.
hasienda, this is a perfect candidate for the trachacks-compat
class, or whatever we end up calling it. From trac-0.11-stable:
try: from hashlib import md5, sha1 except ImportError: from md5 import md5 from sha import new as sha1
comment:16 Changed 13 years ago by
(In [11263]) Refs #5747: (0.11 branch) Replaced import of deprecated sha
with import of sha1
from the hashlib
library. Falls back to still use sha
if hashlib
(since Python 2.5) is not available.
Thank you to bobbysmith007 and itamarost for useful suggestions on a solution.
This has been tested with trac0.11 and trac0.13dev [t 10966] with Python 2.6.
comment:17 Changed 13 years ago by
Cc: | Steffen Hoffmann added |
---|
I'll leave this ticket open for a while to see if there are any issues.
hasienda, I had meant to cc you on comment:15, which you might find interesting.
comment:18 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:19 Changed 13 years ago by
Replying to rjollos:
hasienda, this is a perfect candidate for the
trachacks-compat
class, or whatever we end up calling it. Fromtrac-0.11-stable:
There is a similar issue for the WorkLogPlugin in #9990.
comment:20 Changed 12 years ago by
It looks like the fix in [11263] will need to be merged over to the 1.0 branch, depending on what you decide to do with trunk
going forward.
comment:21 Changed 11 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Trac Release: | 0.11 → 1.0 |
Reopening for Trac 1.0, since the problem hasn't been fixed yet in the 1.0 branch.
comment:22 Changed 11 years ago by
If no one objects (or has a better idea), we could merge recent changes on the graphvizplugin/branches/1.0 branch back to graphvizplugin/trunk. Future development would then presumably follow the Trac's practice of making bugfixes on the branch and merging them to trunk. For [11263], we could make the change on the branch and do a record-only merge so that we don't get a conflict when merging 1.0 to the trunk.
comment:23 Changed 11 years ago by
Summary: | [Patch] Using of deprecated sha module in graphviz.py → [Patch] Uses deprecated sha module in graphviz.py |
---|
comment:24 Changed 5 years ago by
Owner: | Ryan J Ollos deleted |
---|---|
Status: | reopened → new |
comment:26 Changed 20 months ago by
Owner: | set to Jun Omae |
---|
graphviz/graphviz.py
shasha.new(encoded_cmd + encoded_content).hexdigest()I made the change earlier today, and this seems to work.