diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2015-02-17 00:21:15 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2015-02-17 00:21:15 -0800 |
commit | 67db8ddca8ac7ab9adeb827a7dadd34a385b2b6b (patch) | |
tree | 08221a70f67226eeb5e5bead1d6043fb5e24f113 /var | |
parent | 06d6b0b205095f849ace216aa51393b907cf821b (diff) | |
download | spack-67db8ddca8ac7ab9adeb827a7dadd34a385b2b6b.tar.gz spack-67db8ddca8ac7ab9adeb827a7dadd34a385b2b6b.tar.bz2 spack-67db8ddca8ac7ab9adeb827a7dadd34a385b2b6b.tar.xz spack-67db8ddca8ac7ab9adeb827a7dadd34a385b2b6b.zip |
Factor ignore logic into a predicate builder.
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/packages/python/package.py | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/var/spack/packages/python/package.py b/var/spack/packages/python/package.py index 705d002e80..31a12ea653 100644 --- a/var/spack/packages/python/package.py +++ b/var/spack/packages/python/package.py @@ -1,6 +1,7 @@ import os import re from contextlib import closing +from llnl.util.lang import match_predicate from spack import * import spack @@ -85,23 +86,19 @@ class Python(Package): def python_ignore(self, ext_pkg, args): """Add some ignore files to activate/deactivate args.""" - orig_ignore = args.get('ignore', lambda f: False) + ignore_arg = args.get('ignore', lambda f: False) - def ignore(filename): - # Always ignore easy-install.pth, as it needs to be merged. - patterns = [r'easy-install\.pth$'] + # Always ignore easy-install.pth, as it needs to be merged. + patterns = [r'easy-install\.pth$'] - # Ignore pieces of setuptools installed by other packages. - if ext_pkg.name != 'py-setuptools': - patterns.append(r'/site\.pyc?$') - patterns.append(r'setuptools\.pth') - patterns.append(r'bin/easy_install[^/]*$') - patterns.append(r'setuptools.*egg$') + # Ignore pieces of setuptools installed by other packages. + if ext_pkg.name != 'py-setuptools': + patterns.append(r'/site\.pyc?$') + patterns.append(r'setuptools\.pth') + patterns.append(r'bin/easy_install[^/]*$') + patterns.append(r'setuptools.*egg$') - return (any(re.search(p, filename) for p in patterns) or - orig_ignore(filename)) - - return ignore + return match_predicate(ignore_arg, patterns) def write_easy_install_pth(self, exts): |