Commit dc48b744 authored by Brett Cannon's avatar Brett Cannon

Remove the rgbimg module. It has been deprecated since Python 2.5.

parent 8d76cca0
......@@ -201,7 +201,6 @@ LIBFILES= $(MANSTYLES) $(INDEXSTYLES) $(COMMONTEX) \
lib/libimageop.tex \
lib/libaifc.tex \
lib/libjpeg.tex \
lib/librgbimg.tex \
lib/libossaudiodev.tex \
lib/libcrypto.tex \
lib/libhashlib.tex \
......
......@@ -327,7 +327,6 @@ and how to embed it in other applications.
\input{libwave}
\input{libchunk}
\input{libcolorsys}
\input{librgbimg}
\input{libimghdr}
\input{libsndhdr}
\input{libossaudiodev}
......
\section{\module{rgbimg} ---
Read and write ``SGI RGB'' files}
\declaremodule{builtin}{rgbimg}
\modulesynopsis{Read and write image files in ``SGI RGB'' format (the module
is \emph{not} SGI specific though!).}
\deprecated{2.5}{This module is not maintained anymore and seems to be
unused.}
The \module{rgbimg} module allows Python programs to access SGI imglib image
files (also known as \file{.rgb} files). The module is far from
complete, but is provided anyway since the functionality that there is
enough in some cases. Currently, colormap files are not supported.
\note{This module is only built by default for 32-bit platforms; it is
not expected to work properly on other systems.}
The module defines the following variables and functions:
\begin{excdesc}{error}
This exception is raised on all errors, such as unsupported file type, etc.
\end{excdesc}
\begin{funcdesc}{sizeofimage}{file}
This function returns a tuple \code{(\var{x}, \var{y})} where
\var{x} and \var{y} are the size of the image in pixels.
Only 4 byte RGBA pixels, 3 byte RGB pixels, and 1 byte greyscale pixels
are currently supported.
\end{funcdesc}
\begin{funcdesc}{longimagedata}{file}
This function reads and decodes the image on the specified file, and
returns it as a Python string. The string has 4 byte RGBA pixels.
The bottom left pixel is the first in
the string. This format is suitable to pass to \function{gl.lrectwrite()},
for instance.
\end{funcdesc}
\begin{funcdesc}{longstoimage}{data, x, y, z, file}
This function writes the RGBA data in \var{data} to image
file \var{file}. \var{x} and \var{y} give the size of the image.
\var{z} is 1 if the saved image should be 1 byte greyscale, 3 if the
saved image should be 3 byte RGB data, or 4 if the saved images should
be 4 byte RGBA data. The input data always contains 4 bytes per pixel.
These are the formats returned by \function{gl.lrectread()}.
\end{funcdesc}
\begin{funcdesc}{ttob}{flag}
This function sets a global flag which defines whether the scan lines
of the image are read or written from bottom to top (flag is zero,
compatible with SGI GL) or from top to bottom (flag is one,
compatible with X). The default is zero.
\end{funcdesc}
......@@ -1337,7 +1337,6 @@ class _ExpectedSkips:
self.expected.add('test_timeout')
if sys.maxint == 9223372036854775807L:
self.expected.add('test_rgbimg')
self.expected.add('test_imageop')
if not sys.platform in ("mac", "darwin"):
......@@ -1352,6 +1351,11 @@ class _ExpectedSkips:
for skip in WIN_ONLY:
self.expected.add(skip)
if sys.platform != 'irix':
IRIX_ONLY =["test_imageop"]
for skip in IRIX_ONLY:
self.expected.add(skip)
self.valid = True
def isvalid(self):
......
......@@ -10,19 +10,12 @@ from test.test_support import verbose, unlink
import imageop, uu, os
import warnings
warnings.filterwarnings("ignore",
"the rgbimg module is deprecated",
DeprecationWarning,
".*test_imageop")
def main(use_rgbimg=1):
def main():
# Create binary test files
uu.decode(get_qualified_path('testrgb'+os.extsep+'uue'), 'test'+os.extsep+'rgb')
if use_rgbimg:
image, width, height = getrgbimage('test'+os.extsep+'rgb')
else:
image, width, height = getimage('test'+os.extsep+'rgb')
# Return the selected part of image, which should by width by height
......@@ -122,23 +115,6 @@ def main(use_rgbimg=1):
# Cleanup
unlink('test'+os.extsep+'rgb')
def getrgbimage(name):
"""return a tuple consisting of image (in 'imgfile' format but
using rgbimg instead) width and height"""
import rgbimg
try:
sizes = rgbimg.sizeofimage(name)
except rgbimg.error:
name = get_qualified_path(name)
sizes = rgbimg.sizeofimage(name)
if verbose:
print 'rgbimg opening test image: %s, sizes: %s' % (name, str(sizes))
image = rgbimg.longimagedata(name)
return (image, sizes[0], sizes[1])
def getimage(name):
"""return a tuple consisting of
image (in 'imgfile' format) width and height
......@@ -172,6 +148,4 @@ def get_qualified_path(name):
return fullname
return name
# rgbimg (unlike imgfile) is portable to platforms other than SGI.
# So we prefer to use it.
main(use_rgbimg=1)
main()
# Testing rgbimg module
import warnings
warnings.filterwarnings("ignore",
"the rgbimg module is deprecated",
DeprecationWarning,
".*test_rgbimg$")
import rgbimg
import os, uu
from test.test_support import verbose, unlink, findfile
class error(Exception):
pass
print 'RGBimg test suite:'
def testimg(rgb_file, raw_file):
rgb_file = findfile(rgb_file)
raw_file = findfile(raw_file)
width, height = rgbimg.sizeofimage(rgb_file)
rgb = rgbimg.longimagedata(rgb_file)
if len(rgb) != width * height * 4:
raise error, 'bad image length'
raw = open(raw_file, 'rb').read()
if rgb != raw:
raise error, \
'images don\'t match for '+rgb_file+' and '+raw_file
for depth in [1, 3, 4]:
rgbimg.longstoimage(rgb, width, height, depth, '@.rgb')
os.unlink('@.rgb')
table = [
('testrgb'+os.extsep+'uue', 'test'+os.extsep+'rgb'),
('testimg'+os.extsep+'uue', 'test'+os.extsep+'rawimg'),
('testimgr'+os.extsep+'uue', 'test'+os.extsep+'rawimg'+os.extsep+'rev'),
]
for source, target in table:
source = findfile(source)
target = findfile(target)
if verbose:
print "uudecoding", source, "->", target, "..."
uu.decode(source, target)
if verbose:
print "testing..."
ttob = rgbimg.ttob(0)
if ttob != 0:
raise error, 'ttob should start out as zero'
testimg('test'+os.extsep+'rgb', 'test'+os.extsep+'rawimg')
ttob = rgbimg.ttob(1)
if ttob != 0:
raise error, 'ttob should be zero'
testimg('test'+os.extsep+'rgb', 'test'+os.extsep+'rawimg'+os.extsep+'rev')
ttob = rgbimg.ttob(0)
if ttob != 1:
raise error, 'ttob should be one'
ttob = rgbimg.ttob(0)
if ttob != 0:
raise error, 'ttob should be zero'
for source, target in table:
unlink(findfile(target))
......@@ -636,6 +636,8 @@ Library
Extension Modules
-----------------
- Removed the rgbimg module; been deprecated since Python 2.5.
- Bug #1721309: prevent bsddb module from freeing random memory.
- Bug #1686475: Support stat'ing open files on Windows again.
......
......@@ -231,7 +231,6 @@ GLHACK=-Dclear=__GLclear
#audioop audioop.c # Operations on audio samples
#imageop imageop.c # Operations on images
#rgbimg rgbimgmodule.c # Read SGI RGB image files (but coded portably)
# Note that the _md5 and _sha modules are normally only built if the
......
This diff is collapsed.
......@@ -294,7 +294,7 @@ Unix platforms: If your vendor still ships (and you still use) Berkeley DB
XXX I think this next bit is out of date:
64-bit platforms: The modules audioop, imageop and rgbimg don't work.
64-bit platforms: The modules audioop, and imageop don't work.
The setup.py script disables them on 64-bit installations.
Don't try to enable them in the Modules/Setup file. They
contain code that is quite wordsize sensitive. (If you have a
......@@ -466,9 +466,9 @@ QNX: Chris Herborth (chrish@qnx.com) writes:
array, audioop, binascii, cPickle, cStringIO, cmath,
crypt, curses, errno, fcntl, gdbm, grp, imageop,
_locale, math, md5, new, operator, parser, pcre,
posix, pwd, readline, regex, reop, rgbimg, rotor,
posix, pwd, readline, regex, reop, rotor,
select, signal, socket, soundex, strop, struct,
syslog, termios, time, timing, zlib, audioop, imageop, rgbimg
syslog, termios, time, timing, zlib, audioop, imageop
3) make SHELL=/usr/local/bin/bash
......
......@@ -508,10 +508,8 @@ class PyBuildExt(build_ext):
if sys.maxint != 9223372036854775807L:
# Operations on images
exts.append( Extension('imageop', ['imageop.c']) )
# Read SGI RGB image files (but coded portably)
exts.append( Extension('rgbimg', ['rgbimgmodule.c']) )
else:
missing.extend(['imageop', 'rgbimg'])
missing.extend(['imageop'])
# readline
do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
......
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