summaryrefslogtreecommitdiff
path: root/numpy/distutils/npy_pkg_config.py
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-07-26 11:15:00 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-07-26 11:15:00 +0000
commitdf57d7c9cd1e6d05913093648198bd8df3c08a04 (patch)
tree4f29c60e8958001afd2cf772b8ec5e0ab73ddda1 /numpy/distutils/npy_pkg_config.py
parent681db2650f201bbfabf67f022b41021e749c8945 (diff)
downloadnumpy-df57d7c9cd1e6d05913093648198bd8df3c08a04.tar.gz
Raise a PkgNotFound exception in get_info if the package is not found.
Diffstat (limited to 'numpy/distutils/npy_pkg_config.py')
-rw-r--r--numpy/distutils/npy_pkg_config.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/numpy/distutils/npy_pkg_config.py b/numpy/distutils/npy_pkg_config.py
index 70084ecff..2e4585e06 100644
--- a/numpy/distutils/npy_pkg_config.py
+++ b/numpy/distutils/npy_pkg_config.py
@@ -3,7 +3,8 @@ import re
import os
import shlex
-__all__ = ['FormatError', 'LibraryInfo', 'VariablesSet', 'get_info', 'parse_flags']
+__all__ = ['FormatError', 'PkgNotFound', 'LibraryInfo', 'VariableSet',
+ 'get_info', 'parse_flags']
_VAR = re.compile('\$\{([a-zA-Z0-9_-]+)\}')
@@ -14,6 +15,13 @@ class FormatError(IOError):
def __str__(self):
return self.msg
+class PkgNotFound(IOError):
+ def __init__(self, msg):
+ self.msg = msg
+
+ def __str__(self):
+ return self.msg
+
def parse_flags(line):
lexer = shlex.shlex(line)
lexer.whitespace_split = True
@@ -166,7 +174,7 @@ def parse_config(filename, dirs=None):
config = SafeConfigParser()
n = config.read(filenames)
if not len(n) >= 1:
- raise IOError("Could not find file(s) %s" % str(filenames))
+ raise PkgNotFound("Could not find file(s) %s" % str(filenames))
# Parse meta and variables sections
meta = parse_meta(config)