Commit b4b74e36 authored by Tarek Ziadé's avatar Tarek Ziadé

added a test for finalize_options

parent 343e5f79
......@@ -12,7 +12,7 @@ this header file lives".
__revision__ = "$Id$"
import sys, os, string, re
from types import *
from distutils.core import Command
from distutils.errors import DistutilsExecError
from distutils.sysconfig import customize_compiler
......@@ -68,19 +68,18 @@ class config(Command):
def finalize_options(self):
if self.include_dirs is None:
self.include_dirs = self.distribution.include_dirs or []
elif type(self.include_dirs) is StringType:
self.include_dirs = string.split(self.include_dirs, os.pathsep)
elif isinstance(self.include_dirs, str):
self.include_dirs = self.include_dirs.split(os.pathsep)
if self.libraries is None:
self.libraries = []
elif type(self.libraries) is StringType:
elif isinstance(self.libraries, str):
self.libraries = [self.libraries]
if self.library_dirs is None:
self.library_dirs = []
elif type(self.library_dirs) is StringType:
self.library_dirs = string.split(self.library_dirs, os.pathsep)
elif isinstance(self.library_dirs, str):
self.library_dirs = self.library_dirs.split(os.pathsep)
def run (self):
pass
......
......@@ -46,6 +46,21 @@ class ConfigTestCase(support.LoggingSilencer,
match = cmd.search_cpp(pattern='command', body='// xxx')
self.assertEquals(match, 1)
def test_finalize_options(self):
# finalize_options does a bit of transformation
# on options
pkg_dir, dist = self.create_dist()
cmd = config(dist)
cmd.include_dirs = 'one%stwo' % os.pathsep
cmd.libraries = 'one'
cmd.library_dirs = 'three%sfour' % os.pathsep
cmd.ensure_finalized()
self.assertEquals(cmd.include_dirs, ['one', 'two'])
self.assertEquals(cmd.libraries, ['one'])
self.assertEquals(cmd.library_dirs, ['three', 'four'])
def test_suite():
return unittest.makeSuite(ConfigTestCase)
......
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