summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/extension.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2002-11-13 20:54:21 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2002-11-13 20:54:21 (GMT)
commit3f1c9a916f87cb35cbf9a164dc6e84606e97e48c (patch)
tree6dadd6fbec83e8706d0b29acd44b0a9c79c9f5a9 /Lib/distutils/extension.py
parentcd58b8f532e7d0337b250e60f5d3d5b073f0479c (diff)
downloadcpython-3f1c9a916f87cb35cbf9a164dc6e84606e97e48c.zip
cpython-3f1c9a916f87cb35cbf9a164dc6e84606e97e48c.tar.gz
cpython-3f1c9a916f87cb35cbf9a164dc6e84606e97e48c.tar.bz2
Allow unknown keyword arguments to the Extension class, and warn about them.
Diffstat (limited to 'Lib/distutils/extension.py')
-rw-r--r--Lib/distutils/extension.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/distutils/extension.py b/Lib/distutils/extension.py
index 7fbeb4e..9dc316a 100644
--- a/Lib/distutils/extension.py
+++ b/Lib/distutils/extension.py
@@ -10,6 +10,10 @@ __revision__ = "$Id$"
import os, string
from types import *
+try:
+ import warnings
+except ImportError:
+ warnings = None
# This class is really only used by the "build_ext" command, so it might
# make sense to put it in distutils.command.build_ext. However, that
@@ -93,8 +97,8 @@ class Extension:
export_symbols=None,
depends=None,
language=None,
+ **kw # To catch unknown keywords
):
-
assert type(name) is StringType, "'name' must be a string"
assert (type(sources) is ListType and
map(type, sources) == [StringType]*len(sources)), \
@@ -115,6 +119,15 @@ class Extension:
self.depends = depends or []
self.language = language
+ # If there are unknown keyword options, warn about them
+ if len(kw):
+ L = kw.keys() ; L.sort()
+ L = map(repr, L)
+ msg = "Unknown Extension options: " + string.join(L, ', ')
+ if warnings is not None:
+ warnings.warn(msg)
+ else:
+ sys.stderr.write(msg + '\n')
# class Extension