Ability to ignore files in activate/deactivate for extensions.
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
from spack import *
|
||||
|
||||
class PyNose(Package):
|
||||
"""nose extends the test loading and running features of unittest, making it easier to write, find and run tests."""
|
||||
"""nose extends the test loading and running features of unittest,
|
||||
making it easier to write, find and run tests."""
|
||||
|
||||
homepage = "https://pypi.python.org/pypi/nose"
|
||||
url = "https://pypi.python.org/packages/source/n/nose/nose-1.3.4.tar.gz"
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
from spack import *
|
||||
import os
|
||||
import re
|
||||
|
||||
class Python(Package):
|
||||
"""The Python programming language."""
|
||||
@@ -59,19 +60,21 @@ def setup_extension_environment(self, module, spec, ext_spec):
|
||||
mkdirp(module.site_packages_dir)
|
||||
|
||||
|
||||
def add_ignore_files(self, args):
|
||||
def make_ignore(self, args):
|
||||
"""Add some ignore files to activate/deactivate args."""
|
||||
ignore = set(args.get('ignore', ()))
|
||||
ignore.add(os.path.join(self.site_packages_dir, 'site.py'))
|
||||
ignore.add(os.path.join(self.site_packages_dir, 'site.pyc'))
|
||||
args.update(ignore=ignore)
|
||||
orig_ignore = args.get('ignore', lambda f: False)
|
||||
def ignore(filename):
|
||||
return (re.search(r'/site\.pyc?$', filename) or
|
||||
re.search(r'\.pth$', filename) or
|
||||
orig_ignore(filename))
|
||||
return ignore
|
||||
|
||||
|
||||
def activate(self, ext_pkg, **args):
|
||||
self.add_ignore_files(args)
|
||||
args.update(ignore=self.make_ignore(args))
|
||||
super(Python, self).activate(ext_pkg, **args)
|
||||
|
||||
|
||||
def deactivate(self, ext_pkg, **args):
|
||||
self.add_ignore_files(args)
|
||||
args.update(ignore=self.make_ignore(args))
|
||||
super(Python, self).deactivate(ext_pkg, **args)
|
||||
|
Reference in New Issue
Block a user