Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e6ed2f9

Browse files
author
Tarek Ziadé
committed
Merged revisions 73166 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r73166 | tarek.ziade | 2009-06-03 12:26:26 +0200 (Wed, 03 Jun 2009) | 1 line added some tests for distutils.extension + code cleanup ........
1 parent 8d6e26d commit e6ed2f9

3 files changed

Lines changed: 107 additions & 13 deletions

File tree

Lib/distutils/extension.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,10 @@ def __init__(self, name, sources,
139139

140140

141141
def read_setup_file(filename):
142-
from distutils.sysconfig import \
143-
parse_makefile, expand_makefile_vars, _variable_rx
142+
"""Reads a Setup file and returns Extension instances."""
143+
from distutils.sysconfig import (parse_makefile, expand_makefile_vars,
144+
_variable_rx)
145+
144146
from distutils.text_file import TextFile
145147
from distutils.util import split_quoted
146148

@@ -165,10 +167,8 @@ def read_setup_file(filename):
165167
file.warn("'%s' lines not handled yet" % line)
166168
continue
167169

168-
#print "original line: " + line
169170
line = expand_makefile_vars(line, vars)
170171
words = split_quoted(line)
171-
#print "expanded line: " + line
172172

173173
# NB. this parses a slightly different syntax than the old
174174
# makesetup script: here, there must be exactly one extension per
@@ -234,13 +234,4 @@ def read_setup_file(filename):
234234

235235
extensions.append(ext)
236236

237-
#print "module:", module
238-
#print "source files:", source_files
239-
#print "cpp args:", cpp_args
240-
#print "lib args:", library_args
241-
242-
#extensions[module] = { 'sources': source_files,
243-
# 'cpp_args': cpp_args,
244-
# 'lib_args': library_args }
245-
246237
return extensions

Lib/distutils/tests/Setup.sample

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Setup file from the pygame project
2+
3+
#--StartConfig
4+
SDL = -I/usr/include/SDL -D_REENTRANT -lSDL
5+
FONT = -lSDL_ttf
6+
IMAGE = -lSDL_image
7+
MIXER = -lSDL_mixer
8+
SMPEG = -lsmpeg
9+
PNG = -lpng
10+
JPEG = -ljpeg
11+
SCRAP = -lX11
12+
PORTMIDI = -lportmidi
13+
PORTTIME = -lporttime
14+
#--EndConfig
15+
16+
#DEBUG = -C-W -C-Wall
17+
DEBUG =
18+
19+
#the following modules are optional. you will want to compile
20+
#everything you can, but you can ignore ones you don't have
21+
#dependencies for, just comment them out
22+
23+
imageext src/imageext.c $(SDL) $(IMAGE) $(PNG) $(JPEG) $(DEBUG)
24+
font src/font.c $(SDL) $(FONT) $(DEBUG)
25+
mixer src/mixer.c $(SDL) $(MIXER) $(DEBUG)
26+
mixer_music src/music.c $(SDL) $(MIXER) $(DEBUG)
27+
_numericsurfarray src/_numericsurfarray.c $(SDL) $(DEBUG)
28+
_numericsndarray src/_numericsndarray.c $(SDL) $(MIXER) $(DEBUG)
29+
movie src/movie.c $(SDL) $(SMPEG) $(DEBUG)
30+
scrap src/scrap.c $(SDL) $(SCRAP) $(DEBUG)
31+
_camera src/_camera.c src/camera_v4l2.c src/camera_v4l.c $(SDL) $(DEBUG)
32+
pypm src/pypm.c $(SDL) $(PORTMIDI) $(PORTTIME) $(DEBUG)
33+
34+
GFX = src/SDL_gfx/SDL_gfxPrimitives.c
35+
#GFX = src/SDL_gfx/SDL_gfxBlitFunc.c src/SDL_gfx/SDL_gfxPrimitives.c
36+
gfxdraw src/gfxdraw.c $(SDL) $(GFX) $(DEBUG)
37+
38+
39+
40+
#these modules are required for pygame to run. they only require
41+
#SDL as a dependency. these should not be altered
42+
43+
base src/base.c $(SDL) $(DEBUG)
44+
cdrom src/cdrom.c $(SDL) $(DEBUG)
45+
color src/color.c $(SDL) $(DEBUG)
46+
constants src/constants.c $(SDL) $(DEBUG)
47+
display src/display.c $(SDL) $(DEBUG)
48+
event src/event.c $(SDL) $(DEBUG)
49+
fastevent src/fastevent.c src/fastevents.c $(SDL) $(DEBUG)
50+
key src/key.c $(SDL) $(DEBUG)
51+
mouse src/mouse.c $(SDL) $(DEBUG)
52+
rect src/rect.c $(SDL) $(DEBUG)
53+
rwobject src/rwobject.c $(SDL) $(DEBUG)
54+
surface src/surface.c src/alphablit.c src/surface_fill.c $(SDL) $(DEBUG)
55+
surflock src/surflock.c $(SDL) $(DEBUG)
56+
time src/time.c $(SDL) $(DEBUG)
57+
joystick src/joystick.c $(SDL) $(DEBUG)
58+
draw src/draw.c $(SDL) $(DEBUG)
59+
image src/image.c $(SDL) $(DEBUG)
60+
overlay src/overlay.c $(SDL) $(DEBUG)
61+
transform src/transform.c src/rotozoom.c src/scale2x.c src/scale_mmx.c $(SDL) $(DEBUG)
62+
mask src/mask.c src/bitmask.c $(SDL) $(DEBUG)
63+
bufferproxy src/bufferproxy.c $(SDL) $(DEBUG)
64+
pixelarray src/pixelarray.c $(SDL) $(DEBUG)
65+
_arraysurfarray src/_arraysurfarray.c $(SDL) $(DEBUG)
66+
67+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""Tests for distutils.extension."""
2+
import unittest
3+
import os
4+
5+
from distutils.extension import read_setup_file
6+
7+
class ExtensionTestCase(unittest.TestCase):
8+
9+
def test_read_setup_file(self):
10+
# trying to read a Setup file
11+
# (sample extracted from the PyGame project)
12+
setup = os.path.join(os.path.dirname(__file__), 'Setup.sample')
13+
14+
exts = read_setup_file(setup)
15+
names = [ext.name for ext in exts]
16+
names.sort()
17+
18+
# here are the extensions read_setup_file should have created
19+
# out of the file
20+
wanted = ['_arraysurfarray', '_camera', '_numericsndarray',
21+
'_numericsurfarray', 'base', 'bufferproxy', 'cdrom',
22+
'color', 'constants', 'display', 'draw', 'event',
23+
'fastevent', 'font', 'gfxdraw', 'image', 'imageext',
24+
'joystick', 'key', 'mask', 'mixer', 'mixer_music',
25+
'mouse', 'movie', 'overlay', 'pixelarray', 'pypm',
26+
'rect', 'rwobject', 'scrap', 'surface', 'surflock',
27+
'time', 'transform']
28+
29+
self.assertEquals(names, wanted)
30+
31+
32+
def test_suite():
33+
return unittest.makeSuite(ExtensionTestCase)
34+
35+
if __name__ == "__main__":
36+
unittest.main(defaultTest="test_suite")

0 commit comments

Comments
 (0)