29
29
"""
30
30
31
31
import os
32
- import re
33
32
import shutil
34
33
import sys
35
34
import tempfile
39
38
40
39
import easybuild .tools .options as eboptions
41
40
from easybuild .tools .build_log import EasyBuildError
42
- from easybuild .tools .config import ERROR , IGNORE , WARN , BuildOptions , ConfigurationVariables
43
- from easybuild .tools .config import build_option , build_path , get_build_log_path , get_log_filename , get_repositorypath
44
- from easybuild .tools .config import install_path , log_file_format , log_path , source_paths
45
- from easybuild .tools .config import update_build_option , update_build_options
46
- from easybuild .tools .config import DEFAULT_PATH_SUBDIRS , init_build_options
47
- from easybuild .tools .filetools import copy_dir , mkdir , write_file
48
- from easybuild .tools .options import CONFIG_ENV_VAR_PREFIX
49
- from easybuild .tools .docs import list_easyblocks , list_software , list_toolchains
41
+ from easybuild .tools .filetools import write_file
42
+ from easybuild .tools .docs import list_easyblocks , list_toolchains
50
43
from easybuild .tools .entrypoints import (
51
44
get_group_entrypoints , HOOKS_ENTRYPOINT , EASYBLOCK_ENTRYPOINT , TOOLCHAIN_ENTRYPOINT ,
52
45
HAVE_ENTRY_POINTS
53
46
)
54
47
from easybuild .framework .easyconfig .easyconfig import get_module_path
55
- from easybuild .framework .easyblock import EasyBlock
56
48
57
49
58
50
if HAVE_ENTRY_POINTS :
68
60
MOCK_TOOLCHAIN = "MockTc"
69
61
70
62
71
- MOCK_EP_FILE = f"""
63
+ MOCK_EP_FILE = f"""
72
64
from easybuild.tools.entrypoints import register_entrypoint_hooks
73
65
from easybuild.tools.hooks import CONFIGURE_STEP, START
74
66
@@ -114,7 +106,6 @@ class {MOCK_TOOLCHAIN}(MockCompiler):
114
106
"""
115
107
116
108
117
-
118
109
MOCK_EP_META_FILE = f"""
119
110
[{ HOOKS_ENTRYPOINT } ]
120
111
{ MOCK_HOOK_EP_NAME } = {{module}}:hello_world
@@ -139,6 +130,7 @@ def read_text(self, filename):
139
130
if filename == "METADATA" :
140
131
return "Name: mock_hook\n Version: 0.1.0\n "
141
132
133
+
142
134
class MockDistributionFinder (DistributionFinder ):
143
135
"""Mock distribution finder for testing entry points."""
144
136
def __init__ (self , * args , module , ** kwargs ):
@@ -180,7 +172,7 @@ def tearDown(self):
180
172
if HAVE_ENTRY_POINTS :
181
173
# Remove the entry point from the working set
182
174
torm = []
183
- for idx ,cls in enumerate (sys .meta_path ):
175
+ for idx , cls in enumerate (sys .meta_path ):
184
176
if isinstance (cls , MockDistributionFinder ):
185
177
torm .append (idx )
186
178
for idx in reversed (torm ):
0 commit comments