Commit 1e8fba72 authored by Brett Cannon's avatar Brett Cannon

Deprecate the sunaudio module for removal in Python 3.0. The sunau module can...

Deprecate the sunaudio module for removal in Python 3.0. The sunau module can provide similar functionality.
parent 56af5fca
...@@ -60,6 +60,8 @@ Multimedia ...@@ -60,6 +60,8 @@ Multimedia
:mod:`sunaudio` :mod:`sunaudio`
--- Interpret Sun audio headers (may become obsolete or a tool/demo). --- Interpret Sun audio headers (may become obsolete or a tool/demo).
.. warning:: The :mod:`sunaudio` module has been removed in Python 3.0.
:mod:`toaiff` :mod:`toaiff`
--- Convert "arbitrary" sound files to AIFF files; should probably become a tool --- Convert "arbitrary" sound files to AIFF files; should probably become a tool
or demo. Requires the external program :program:`sox`. or demo. Requires the external program :program:`sox`.
......
"""Interpret sun audio headers.""" """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' MAGIC = '.snd'
......
...@@ -6,7 +6,7 @@ from test.test_support import findfile, TestSkipped ...@@ -6,7 +6,7 @@ from test.test_support import findfile, TestSkipped
import errno import errno
import ossaudiodev import ossaudiodev
import sys import sys
import sunaudio import sunau
import time import time
import audioop import audioop
import unittest import unittest
...@@ -22,15 +22,16 @@ except ImportError: ...@@ -22,15 +22,16 @@ except ImportError:
AFMT_S16_NE = ossaudiodev.AFMT_S16_BE AFMT_S16_NE = ossaudiodev.AFMT_S16_BE
SND_FORMAT_MULAW_8 = 1
def read_sound_file(path): def read_sound_file(path):
fp = open(path, 'rb') with open(path, 'rb') as fp:
size, enc, rate, nchannels, extra = sunaudio.gethdr(fp) au = sunau.open(fp)
data = fp.read() rate = au.getframerate()
fp.close() nchannels = au.getnchannels()
encoding = au._encoding
if enc != SND_FORMAT_MULAW_8: 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") raise RuntimeError("Expect .au file with 8-bit mu-law samples")
# Convert the data to 16-bit signed. # Convert the data to 16-bit signed.
......
...@@ -173,8 +173,9 @@ class TestStdlibRemovals(unittest.TestCase): ...@@ -173,8 +173,9 @@ class TestStdlibRemovals(unittest.TestCase):
# test.testall not tested as it executes all unit tests as an # test.testall not tested as it executes all unit tests as an
# import side-effect. # import side-effect.
all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new', 'rexec', all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new', 'rexec',
'Bastion', 'compiler', 'dircache', 'mimetools', 'fpformat', 'Bastion', 'compiler', 'dircache', 'mimetools',
'ihooks', 'mhlib', 'statvfs', 'htmllib', 'sgmllib', 'rfc822') 'fpformat', 'ihooks', 'mhlib', 'statvfs', 'htmllib',
'sgmllib', 'rfc822', 'sunaudio')
inclusive_platforms = {'irix' : ('pure', 'AL', 'al', 'CD', 'cd', 'cddb', inclusive_platforms = {'irix' : ('pure', 'AL', 'al', 'CD', 'cd', 'cddb',
'cdplayer', 'CL', 'cl', 'DEVICE', 'GL', 'cdplayer', 'CL', 'cl', 'DEVICE', 'GL',
'gl', 'ERRNO', 'FILE', 'FL', 'flp', 'fl', 'gl', 'ERRNO', 'FILE', 'FL', 'flp', 'fl',
......
...@@ -70,6 +70,8 @@ Library ...@@ -70,6 +70,8 @@ Library
- Issue #3389: Allow resolving dotted names for handlers in logging - Issue #3389: Allow resolving dotted names for handlers in logging
configuration files. configuration files.
- Deprecate the sunaudio module for removal in Python 3.0.
- Issue #3395: fix reference in test_multiprocessing to old debugInfo method - Issue #3395: fix reference in test_multiprocessing to old debugInfo method
- Issue #3312: Fix two crashes in sqlite3. - Issue #3312: Fix two crashes in sqlite3.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment