diff options
author | Brett Cannon <bcannon@gmail.com> | 2008-07-18 19:30:22 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2008-07-18 19:30:22 (GMT) |
commit | 1e8fba729e218bc4b2e1ed3104f8cdbd88fdb21a (patch) | |
tree | d32c0ecfc04547cc703f981e60b106b28e8059bb /Lib | |
parent | 56af5fcab7e2ad370a1ac8985769108d281b8658 (diff) | |
download | cpython-1e8fba729e218bc4b2e1ed3104f8cdbd88fdb21a.zip cpython-1e8fba729e218bc4b2e1ed3104f8cdbd88fdb21a.tar.gz cpython-1e8fba729e218bc4b2e1ed3104f8cdbd88fdb21a.tar.bz2 |
Deprecate the sunaudio module for removal in Python 3.0. The sunau module can provide similar functionality.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/sunaudio.py | 5 | ||||
-rw-r--r-- | Lib/test/test_ossaudiodev.py | 19 | ||||
-rw-r--r-- | Lib/test/test_py3kwarn.py | 5 |
3 files changed, 18 insertions, 11 deletions
diff --git a/Lib/sunaudio.py b/Lib/sunaudio.py index 3b0ee27..97d7332 100644 --- a/Lib/sunaudio.py +++ b/Lib/sunaudio.py @@ -1,4 +1,9 @@ """Interpret sun audio headers.""" +from warnings import warnpy3k +warnpy3k("the sunaudio module has been removed in Python 3.0; " + "use the sunau module instead", stacklevel=2) +del warnpy3k + MAGIC = '.snd' diff --git a/Lib/test/test_ossaudiodev.py b/Lib/test/test_ossaudiodev.py index f2ce67b..eb4dd02 100644 --- a/Lib/test/test_ossaudiodev.py +++ b/Lib/test/test_ossaudiodev.py @@ -6,7 +6,7 @@ from test.test_support import findfile, TestSkipped import errno import ossaudiodev import sys -import sunaudio +import sunau import time import audioop import unittest @@ -22,15 +22,16 @@ except ImportError: AFMT_S16_NE = ossaudiodev.AFMT_S16_BE -SND_FORMAT_MULAW_8 = 1 - def read_sound_file(path): - fp = open(path, 'rb') - size, enc, rate, nchannels, extra = sunaudio.gethdr(fp) - data = fp.read() - fp.close() - - if enc != SND_FORMAT_MULAW_8: + with open(path, 'rb') as fp: + au = sunau.open(fp) + rate = au.getframerate() + nchannels = au.getnchannels() + encoding = au._encoding + fp.seek(0) + data = fp.read() + + if encoding != sunau.AUDIO_FILE_ENCODING_MULAW_8: raise RuntimeError("Expect .au file with 8-bit mu-law samples") # Convert the data to 16-bit signed. diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index 0ddc979..67b2538 100644 --- a/Lib/test/test_py3kwarn.py +++ b/Lib/test/test_py3kwarn.py @@ -173,8 +173,9 @@ class TestStdlibRemovals(unittest.TestCase): # test.testall not tested as it executes all unit tests as an # import side-effect. all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new', 'rexec', - 'Bastion', 'compiler', 'dircache', 'mimetools', 'fpformat', - 'ihooks', 'mhlib', 'statvfs', 'htmllib', 'sgmllib', 'rfc822') + 'Bastion', 'compiler', 'dircache', 'mimetools', + 'fpformat', 'ihooks', 'mhlib', 'statvfs', 'htmllib', + 'sgmllib', 'rfc822', 'sunaudio') inclusive_platforms = {'irix' : ('pure', 'AL', 'al', 'CD', 'cd', 'cddb', 'cdplayer', 'CL', 'cl', 'DEVICE', 'GL', 'gl', 'ERRNO', 'FILE', 'FL', 'flp', 'fl', |