rpms/python-twisted-core/F-13 changeset_r25457.patch, NONE, 1.1 python-twisted-core.spec, 1.14, 1.15

Thomas Vander Stichele thomasvs at fedoraproject.org
Thu Apr 15 11:35:09 UTC 2010


Author: thomasvs

Update of /cvs/pkgs/rpms/python-twisted-core/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv10506

Modified Files:
	python-twisted-core.spec 
Added Files:
	changeset_r25457.patch 
Log Message:
fix DeprecationWarning

changeset_r25457.patch:
 internet/_sslverify.py        |    7 ++---
 internet/_sslverify.py.orig   |only
 internet/_sslverify.py.rej    |only
 protocols/sip.py              |   12 ++++----
 python/filepath.py            |    4 +-
 python/hashlib.py             |only
 python/otp.py                 |   57 ++++++++++++++++++++++++++----------------
 python/test/test_hashlib.py   |only
 python/test/test_zipstream.py |    6 ++--
 spread/pb.py                  |   12 ++++----
 trial/test/test_loader.py     |    4 +-
 11 files changed, 59 insertions(+), 43 deletions(-)

--- NEW FILE changeset_r25457.patch ---
diff -aur TwistedCore-8.2.0/twisted/internet/_sslverify.py TwistedCore-8.2.0.patched/twisted/internet/_sslverify.py
--- TwistedCore-8.2.0/twisted/internet/_sslverify.py	2008-11-20 19:36:39.000000000 +0100
+++ TwistedCore-8.2.0.patched/twisted/internet/_sslverify.py	2010-04-15 13:03:35.000000000 +0200
@@ -2,10 +2,11 @@
 # Copyright 2005 Divmod, Inc.  See LICENSE file for details
 # Copyright (c) 2005-2008 Twisted Matrix Laboratories.
 
-import itertools, md5
+import itertools
 from OpenSSL import SSL, crypto
 
 from twisted.python import reflect, util
+from twisted.python.hashlib import md5
 from twisted.internet.defer import Deferred
 from twisted.internet.error import VerifyError, CertificateError
 
@@ -452,7 +453,7 @@
         MD5 hex digest of signature on an empty certificate request with this
         key.
         """
-        return md5.md5(self._emptyReq).hexdigest()
+        return md5(self._emptyReq).hexdigest()
 
 
     def inspect(self):
@@ -736,7 +737,7 @@
             ctx.set_options(self._OP_ALL)
 
         if self.enableSessions:
-            sessionName = md5.md5("%s-%d" % (reflect.qual(self.__class__), _sessionCounter())).hexdigest()
+            sessionName = md5("%s-%d" % (reflect.qual(self.__class__), _sessionCounter())).hexdigest()
             ctx.set_session_id(sessionName)
 
         if not self.enableSessionTickets:
Only in TwistedCore-8.2.0.patched/twisted/internet: _sslverify.py.orig
Only in TwistedCore-8.2.0.patched/twisted/internet: _sslverify.py.rej
diff -aur TwistedCore-8.2.0/twisted/protocols/sip.py TwistedCore-8.2.0.patched/twisted/protocols/sip.py
--- TwistedCore-8.2.0/twisted/protocols/sip.py	2006-07-01 18:08:17.000000000 +0200
+++ TwistedCore-8.2.0.patched/twisted/protocols/sip.py	2010-04-15 13:02:41.000000000 +0200
@@ -1,6 +1,6 @@
 # -*- test-case-name: twisted.test.test_sip -*-
 
-# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
+# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
 # See LICENSE for details.
 
 
@@ -14,12 +14,12 @@
 import socket
 import random
 import time
-import md5
 import sys
 from zope.interface import implements, Interface
 
 # twisted imports
 from twisted.python import log, util
+from twisted.python.hashlib import md5
 from twisted.internet import protocol, defer, reactor
 
 from twisted import cred
@@ -132,7 +132,7 @@
     pszNonce,
     pszCNonce,
 ):
-    m = md5.md5()
+    m = md5()
     m.update(pszUserName)
     m.update(":")
     m.update(pszRealm)
@@ -140,7 +140,7 @@
     m.update(pszPassword)
     HA1 = m.digest()
     if pszAlg == "md5-sess":
-        m = md5.md5()
+        m = md5()
         m.update(HA1)
         m.update(":")
         m.update(pszNonce)
@@ -159,7 +159,7 @@
     pszDigestUri,
     pszHEntity,
 ):
-    m = md5.md5()
+    m = md5()
     m.update(pszMethod)
     m.update(":")
     m.update(pszDigestUri)
@@ -168,7 +168,7 @@
         m.update(pszHEntity)
     HA2 = m.digest().encode('hex')
     
-    m = md5.md5()
+    m = md5()
     m.update(HA1)
     m.update(":")
     m.update(pszNonce)
diff -aur TwistedCore-8.2.0/twisted/python/filepath.py TwistedCore-8.2.0.patched/twisted/python/filepath.py
--- TwistedCore-8.2.0/twisted/python/filepath.py	2008-07-08 14:17:24.000000000 +0200
+++ TwistedCore-8.2.0.patched/twisted/python/filepath.py	2010-04-15 13:02:41.000000000 +0200
@@ -9,7 +9,6 @@
 import os
 import errno
 import random
-import sha
 import base64
 
 from os.path import isabs, exists, normpath, abspath, splitext
@@ -25,6 +24,7 @@
 # modified for inclusion in the standard library.  --glyph
 
 from twisted.python.runtime import platform
+from twisted.python.hashlib import sha1
 
 from twisted.python.win32 import ERROR_FILE_NOT_FOUND, ERROR_PATH_NOT_FOUND
 from twisted.python.win32 import ERROR_INVALID_NAME, ERROR_DIRECTORY
@@ -120,7 +120,7 @@
     """
     Create a pseudorandom, 16-character string for use in secure filenames.
     """
-    return armor(sha.new(randomBytes(64)).digest())[:16]
+    return armor(sha1(randomBytes(64)).digest())[:16]
 
 
 
Only in TwistedCore-8.2.0.patched/twisted/python: hashlib.py
diff -aur TwistedCore-8.2.0/twisted/python/otp.py TwistedCore-8.2.0.patched/twisted/python/otp.py
--- TwistedCore-8.2.0/twisted/python/otp.py	2004-08-25 10:36:30.000000000 +0200
+++ TwistedCore-8.2.0.patched/twisted/python/otp.py	2010-04-15 13:02:41.000000000 +0200
@@ -1,7 +1,9 @@
-# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
+# -*- test-case-name: twisted.python.test.test_otp -*-
+# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
 # See LICENSE for details.
 
-""" A One-Time Password System based on RFC 2289
+"""
+A One-Time Password System based on RFC 2289
 
 The class Authenticator contains the hashing-logic, and the parser for the
 readable output. It also contains challenge which returns a string describing
@@ -17,11 +19,21 @@
 Uses the MD5- and SHA-algorithms for hashing
 
 Todo: RFC2444, SASL (perhaps), parsing hex-responses
+
+This module is deprecated.  Consider using U{another Python OTP
+library<http://labix.org/python-otp>} instead.
 """
 
+import warnings
 import string
 import random
 
+warnings.warn(
+    "twisted.python.otp is deprecated since Twisted 8.3.",
+    category=DeprecationWarning,
+    stacklevel=2)
+
+
 def stringToLong(s):
     """ Convert digest to long """
     result = 0L
@@ -47,33 +59,37 @@
         result = chr(l % 256) + result
         l = l / 256L
     return result
-        
-import md5, sha
-hashid = {md5: 'md5', sha: 'sha1'}
+
+from twisted.python.hashlib import md5, sha1
+hashid = {md5: 'md5', sha1: 'sha1'}
 
 INITIALSEQUENCE = 1000
 MINIMUMSEQUENCE = 50
 
 class Unauthorized(Exception):
     """the Unauthorized exception
-    
+
     This exception is raised when an action is not allowed, or a user is not
     authenticated properly.
     """
 
 class OTPAuthenticator:
-    """A One Time Password System
-    
+    """
+    A One Time Password System
+
     Based on RFC 2289, which is based on a the S/KEY Authentication-scheme.
     It uses the MD5- and SHA-algorithms for hashing
-    
-    The variable OTP is at all times a 64bit string"""
 
+    The variable OTP is at all times a 64bit string.
+
+    @ivar hash: An object which can be used to compute hashes.  This is either
+        L{md5} or L{sha1}.
+    """
     def __init__(self, hash = md5):
         "Set the hash to either md5 or sha1"
         self.hash = hash
-        pass
-    
+
+
     def generateSeed(self):
         "Return a 10 char random seed, with 6 lowercase chars and 4 digits"
         seed = ''
@@ -86,9 +102,9 @@
     def foldDigest(self, otp):
         if self.hash == md5:
             return self.foldDigest128(otp)
-        if self.hash == sha:
+        if self.hash == sha1:
             return self.foldDigest160(otp)
-    
+
     def foldDigest128(self, otp128):
         "Fold a 128 bit digest to 64 bit"
         regs = stringToDWords(otp128)
@@ -120,9 +136,9 @@
 
     def hashUpdate(self, digest):
         "Run through the hash and fold to 64 bit"
-        h = self.hash.new(digest)
+        h = self.hash(digest)
         return self.foldDigest(h.digest())
-    
+
     def generateOTP(self, seed, passwd, sequence):
         """Return a 64 bit OTP based on inputs
         Run through makeReadable to get a 6 word pass-phrase"""
@@ -138,7 +154,7 @@
         for i in xrange(0, 64, 2):
             parity = parity + otp & 0x3
             otp = otp >> 2
-        return parity        
+        return parity
 
     def makeReadable(self, otp):
         "Returns a 6 word pass-phrase from a 64bit OTP"
@@ -151,7 +167,7 @@
         return string.join(list)
 
     def challenge(self, seed, sequence):
-        """Return a challenge in the format otp-<hash> <sequence> <seed>"""  
+        """Return a challenge in the format otp-<hash> <sequence> <seed>"""
         return "otp-%s %i %s" % (hashid[self.hash], sequence, seed)
 
     def parsePhrase(self, phrase):
@@ -178,9 +194,9 @@
     On the next authentication, the stored password is hashed and checked
     up against the one given by the user. If they match, the sequencecounter
     is decreased and the circle is closed.
-    
+
     This object should be glued to each user
-    
+
     Note:
     It does NOT reset the sequence when the combinations left approach zero,
     This has to be done manuelly by instancing a new object
@@ -478,4 +494,3 @@
 "WORM",  "WORN",  "WOVE",  "WRIT",  "WYNN",  "YALE",  "YANG",  "YANK",
 "YARD",  "YARN",  "YAWL",  "YAWN",  "YEAH",  "YEAR",  "YELL",  "YOGA",
 "YOKE"]
-
Only in TwistedCore-8.2.0.patched/twisted/python/test: test_hashlib.py
diff -aur TwistedCore-8.2.0/twisted/python/test/test_zipstream.py TwistedCore-8.2.0.patched/twisted/python/test/test_zipstream.py
--- TwistedCore-8.2.0/twisted/python/test/test_zipstream.py	2008-02-07 09:23:49.000000000 +0100
+++ TwistedCore-8.2.0.patched/twisted/python/test/test_zipstream.py	2010-04-15 13:02:41.000000000 +0200
@@ -6,10 +6,10 @@
 """
 import sys
 import random
-import md5
 import zipfile
 
 from twisted.python import zipstream, filepath
+from twisted.python.hashlib import md5
 from twisted.trial import unittest
 
 class FileEntryMixin:
@@ -347,7 +347,7 @@
         unzipIterChunky should unzip the given number of bytes per iteration.
         """
         junk = ' '.join([str(random.random()) for n in xrange(1000)])
-        junkmd5 = md5.new(junk).hexdigest()
+        junkmd5 = md5(junk).hexdigest()
 
         tempdir = filepath.FilePath(self.mktemp())
         tempdir.makedirs()
@@ -364,7 +364,7 @@
         for r in uziter:
             pass
         self.assertEqual(r, 0)
-        newmd5 = md5.new(
+        newmd5 = md5(
             tempdir.child("zipstreamjunk").open().read()).hexdigest()
         self.assertEqual(newmd5, junkmd5)
 
diff -aur TwistedCore-8.2.0/twisted/spread/pb.py TwistedCore-8.2.0.patched/twisted/spread/pb.py
--- TwistedCore-8.2.0/twisted/spread/pb.py	2008-07-29 22:13:54.000000000 +0200
+++ TwistedCore-8.2.0.patched/twisted/spread/pb.py	2010-04-15 13:02:41.000000000 +0200
@@ -27,7 +27,6 @@
 @author: Glyph Lefkowitz
 """
 
-import md5
 import random
 import new
 import types
@@ -38,6 +37,7 @@
 from twisted.python import log, failure, reflect
 from twisted.python.versions import Version
 from twisted.python.deprecate import deprecated
+from twisted.python.hashlib import md5
 from twisted.internet import defer, protocol
 from twisted.cred.portal import Portal
 from twisted.cred.credentials import IAnonymous, ICredentials
@@ -997,10 +997,10 @@
 
     This is useful for challenge/response authentication.
     """
-    m = md5.new()
+    m = md5()
     m.update(password)
     hashedPassword = m.digest()
-    m = md5.new()
+    m = md5()
     m.update(hashedPassword)
     m.update(challenge)
     doubleHashedPassword = m.digest()
@@ -1011,7 +1011,7 @@
     crap = ''
     for x in range(random.randrange(15,25)):
         crap = crap + chr(random.randint(65,90))
-    crap = md5.new(crap).digest()
+    crap = md5(crap).digest()
     return crap
 
 
@@ -1340,12 +1340,12 @@
 
     # IUsernameHashedPassword:
     def checkPassword(self, password):
-        return self.checkMD5Password(md5.md5(password).digest())
+        return self.checkMD5Password(md5(password).digest())
 
 
     # IUsernameMD5Password
     def checkMD5Password(self, md5Password):
-        md = md5.new()
+        md = md5()
         md.update(md5Password)
         md.update(self.challenge)
         correct = md.digest()
diff -aur TwistedCore-8.2.0/twisted/trial/test/test_loader.py TwistedCore-8.2.0.patched/twisted/trial/test/test_loader.py
--- TwistedCore-8.2.0/twisted/trial/test/test_loader.py	2008-09-01 18:42:51.000000000 +0200
+++ TwistedCore-8.2.0.patched/twisted/trial/test/test_loader.py	2010-04-15 13:02:41.000000000 +0200
@@ -5,12 +5,12 @@
 Tests for loading tests by name.
 """
 
-import md5
 import os
 import shutil
 import sys
 
 from twisted.python import util
+from twisted.python.hashlib import md5
 from twisted.trial.test import packages
 from twisted.trial import runner, reporter, unittest
 from twisted.trial.itrial import ITestCase
@@ -484,7 +484,7 @@
 #             if isinstance(s, type) or isinstance(s, types.ClassType):
 #                 return s.__module__+'.'+s.__name__
             n = runner.name(s)
-            d = md5.new(n).hexdigest()
+            d = md5(n).hexdigest()
             return d
         self.loadSortedPackages(sillySorter)
 


Index: python-twisted-core.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python-twisted-core/F-13/python-twisted-core.spec,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -p -r1.14 -r1.15
--- python-twisted-core.spec	27 Jul 2009 01:21:20 -0000	1.14
+++ python-twisted-core.spec	15 Apr 2010 11:35:09 -0000	1.15
@@ -3,7 +3,7 @@
 
 Name:           %{python}-twisted-core
 Version:        8.2.0
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Asynchronous networking framework written in Python
 Group:          Development/Libraries
 License:        MIT
@@ -12,6 +12,7 @@ Source0:        http://tmrc.mit.edu/mirr
 # Available here:
 # https://apestaart.org/thomas/trac/browser/pkg/fedora.extras/python-twisted-core/twisted-dropin-cache?format=raw
 Source1:        twisted-dropin-cache
+Patch1:         changeset_r25457.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  %{python}-devel
 BuildRequires:  %{python}-zope-interface >= 3.0.1
@@ -51,6 +52,7 @@ Tab completions for Zsh and Twisted Core
 
 %prep
 %setup -q -n TwistedCore-%{version}
+%patch1 -p1
 
 # Turn off exec bits on docs to avoid spurious dependencies
 find doc -type f | xargs chmod 644
@@ -192,6 +194,10 @@ fi
 %{_datadir}/zsh/site-functions/_twisted_zsh_stub
 
 %changelog
+* Thu Apr 15 2010 Thomas Vander Stichele <thomas at apestaart dot org>
+- 8.2.0-4
+- fix python 2.6 DeprecationWarning's
+
 * Sun Jul 26 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 8.2.0-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
 



More information about the scm-commits mailing list