Skip to content

Commit 5a511d9

Browse files
committed
Let user passes in the prepared directory manually
1 parent 8ffa855 commit 5a511d9

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/build/__init__.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ def __init__(self, srcdir, config_settings=None, python_executable=sys.executabl
165165
backend_path=self._build_system.get('backend-path'),
166166
python_executable=python_executable,
167167
)
168-
self._prepared_metadata_directories = {} # type: Dict[str, str]
169168

170169
@property
171170
def python_executable(self): # type: () -> Union[bytes, Text]
@@ -239,7 +238,7 @@ def prepare(self, distribution, outdir): # type: (str, str) -> Optional[str]
239238
try:
240239
with _working_directory(self.srcdir):
241240
basename = prepare(outdir, self.config_settings, _allow_fallback=False) # type: str
242-
self._prepared_metadata_directories[distribution] = path = os.path.join(outdir, basename)
241+
path = os.path.join(outdir, basename)
243242
except pep517.wrappers.BackendUnavailable:
244243
raise BuildException("Backend '{}' is not available.".format(self._backend))
245244
except pep517.wrappers.HookMissing:
@@ -248,7 +247,7 @@ def prepare(self, distribution, outdir): # type: (str, str) -> Optional[str]
248247
raise BuildBackendException('Backend operation failed: {!r}'.format(e))
249248
return path
250249

251-
def build(self, distribution, outdir): # type: (str, str) -> str
250+
def build(self, distribution, outdir, metadata=None): # type: (str, str, Optional[str]) -> str
252251
"""
253252
Build a distribution.
254253
@@ -265,12 +264,9 @@ def build(self, distribution, outdir): # type: (str, str) -> str
265264
else:
266265
os.mkdir(outdir)
267266

268-
try:
269-
metadata_directory = self._prepared_metadata_directories.pop(distribution)
270-
except KeyError:
271-
kwargs = {} # type: Dict[str, str]
272-
else:
273-
kwargs = {'metadata_directory': metadata_directory}
267+
kwargs = {}
268+
if metadata is not None:
269+
kwargs['metadata_directory'] = metadata
274270

275271
try:
276272
with _working_directory(self.srcdir):

0 commit comments

Comments
 (0)