Make subcommands importable, '-' -> '_', fixes #1642
This commit is contained in:
parent
8d1a753a1b
commit
ae2a803496
5 changed files with 10 additions and 7 deletions
11
bin/spack
11
bin/spack
|
@ -56,8 +56,15 @@ with warnings.catch_warnings():
|
|||
# Spack, were removed, but shadow system modules that Spack still
|
||||
# imports. If we leave them, Spack will fail in mysterious ways.
|
||||
# TODO: more elegant solution for orphaned pyc files.
|
||||
orphaned_pyc_files = [os.path.join(SPACK_EXTERNAL_LIBS, n)
|
||||
for n in ('functools.pyc', 'ordereddict.pyc')]
|
||||
orphaned_pyc_files = [
|
||||
os.path.join(SPACK_EXTERNAL_LIBS, 'functools.pyc'),
|
||||
os.path.join(SPACK_EXTERNAL_LIBS, 'ordereddict.pyc'),
|
||||
os.path.join(SPACK_LIB_PATH, 'spack', 'platforms', 'cray_xc.pyc'),
|
||||
os.path.join(SPACK_LIB_PATH, 'spack', 'cmd', 'package-list.pyc'),
|
||||
os.path.join(SPACK_LIB_PATH, 'spack', 'cmd', 'test-install.pyc'),
|
||||
os.path.join(SPACK_LIB_PATH, 'spack', 'cmd', 'url-parse.pyc')
|
||||
]
|
||||
|
||||
for pyc_file in orphaned_pyc_files:
|
||||
if not os.path.exists(pyc_file):
|
||||
continue
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
import spack
|
||||
import spack.cmd
|
||||
from spack.cmd import test_install
|
||||
|
||||
FILE_REGISTRY = collections.defaultdict(StringIO.StringIO)
|
||||
|
||||
|
@ -51,11 +52,6 @@ def mock_open(filename, mode):
|
|||
handle.close()
|
||||
|
||||
|
||||
# The use of __import__ is necessary to maintain a name with hyphen (which
|
||||
# cannot be an identifier in python)
|
||||
test_install = __import__("spack.cmd.test-install", fromlist=['test_install'])
|
||||
|
||||
|
||||
class MockSpec(object):
|
||||
|
||||
def __init__(self, name, version, hashStr=None):
|
||||
|
|
Loading…
Reference in a new issue