[Python-checkins] r65112 - in python/trunk: Doc/library/undoc.rst Lib/sunaudio.py Lib/test/test_ossaudiodev.py Lib/test/test_py3kwarn.py Misc/NEWS
brett.cannon
python-checkins at python.org
Fri Jul 18 21:30:22 CEST 2008
Author: brett.cannon
Date: Fri Jul 18 21:30:22 2008
New Revision: 65112
Log:
Deprecate the sunaudio module for removal in Python 3.0. The sunau module can provide similar functionality.
Modified:
python/trunk/Doc/library/undoc.rst
python/trunk/Lib/sunaudio.py
python/trunk/Lib/test/test_ossaudiodev.py
python/trunk/Lib/test/test_py3kwarn.py
python/trunk/Misc/NEWS
Modified: python/trunk/Doc/library/undoc.rst
==============================================================================
--- python/trunk/Doc/library/undoc.rst (original)
+++ python/trunk/Doc/library/undoc.rst Fri Jul 18 21:30:22 2008
@@ -60,6 +60,8 @@
:mod:`sunaudio`
--- 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`
--- Convert "arbitrary" sound files to AIFF files; should probably become a tool
or demo. Requires the external program :program:`sox`.
Modified: python/trunk/Lib/sunaudio.py
==============================================================================
--- python/trunk/Lib/sunaudio.py (original)
+++ python/trunk/Lib/sunaudio.py Fri Jul 18 21:30:22 2008
@@ -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'
Modified: python/trunk/Lib/test/test_ossaudiodev.py
==============================================================================
--- python/trunk/Lib/test/test_ossaudiodev.py (original)
+++ python/trunk/Lib/test/test_ossaudiodev.py Fri Jul 18 21:30:22 2008
@@ -6,7 +6,7 @@
import errno
import ossaudiodev
import sys
-import sunaudio
+import sunau
import time
import audioop
import unittest
@@ -22,15 +22,16 @@
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()
+ 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 enc != SND_FORMAT_MULAW_8:
+ 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.
Modified: python/trunk/Lib/test/test_py3kwarn.py
==============================================================================
--- python/trunk/Lib/test/test_py3kwarn.py (original)
+++ python/trunk/Lib/test/test_py3kwarn.py Fri Jul 18 21:30:22 2008
@@ -173,8 +173,9 @@
# 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',
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Fri Jul 18 21:30:22 2008
@@ -70,6 +70,8 @@
- Issue #3389: Allow resolving dotted names for handlers in logging
configuration files.
+- Deprecate the sunaudio module for removal in Python 3.0.
+
- Issue #3395: fix reference in test_multiprocessing to old debugInfo method
- Issue #3312: Fix two crashes in sqlite3.
More information about the Python-checkins
mailing list