@@ -121,7 +121,6 @@ def __init__(
121
121
markers = req .marker
122
122
self .markers = markers
123
123
124
- self ._egg_info_path = None # type: Optional[str]
125
124
# This holds the pkg_resources.Distribution object if this requirement
126
125
# is already available:
127
126
self .satisfied_by = None
@@ -367,29 +366,34 @@ def move_to_correct_build_directory(self):
367
366
return
368
367
assert self .req is not None
369
368
assert self ._temp_build_dir
370
- assert (self ._ideal_build_dir is not None and
371
- self ._ideal_build_dir .path ) # type: ignore
369
+ assert (
370
+ self ._ideal_build_dir is not None and
371
+ self ._ideal_build_dir .path # type: ignore
372
+ )
372
373
old_location = self ._temp_build_dir
373
- self ._temp_build_dir = None
374
+ self ._temp_build_dir = None # checked inside ensure_build_location
374
375
376
+ # Figure out the correct place to put the files.
375
377
new_location = self .ensure_build_location (self ._ideal_build_dir )
376
378
if os .path .exists (new_location ):
377
379
raise InstallationError (
378
380
'A package already exists in %s; please remove it to continue'
379
- % display_path (new_location ))
381
+ % display_path (new_location )
382
+ )
383
+
384
+ # Move the files to the correct location.
380
385
logger .debug (
381
386
'Moving package %s from %s to new location %s' ,
382
387
self , display_path (old_location .path ), display_path (new_location ),
383
388
)
384
389
shutil .move (old_location .path , new_location )
390
+
391
+ # Update directory-tracking variables, to be in line with new_location
392
+ self .source_dir = os .path .normpath (os .path .abspath (new_location ))
385
393
self ._temp_build_dir = TempDirectory (
386
394
path = new_location , kind = "req-install" ,
387
395
)
388
396
389
- self ._ideal_build_dir = None
390
- self .source_dir = os .path .normpath (os .path .abspath (new_location ))
391
- self ._egg_info_path = None
392
-
393
397
# Correct the metadata directory, if it exists
394
398
if self .metadata_directory :
395
399
old_meta = self .metadata_directory
@@ -398,6 +402,11 @@ def move_to_correct_build_directory(self):
398
402
new_meta = os .path .normpath (os .path .abspath (new_meta ))
399
403
self .metadata_directory = new_meta
400
404
405
+ # Done with any "move built files" work, since have moved files to the
406
+ # "ideal" build location. Setting to None allows to clearly flag that
407
+ # no more moves are needed.
408
+ self ._ideal_build_dir = None
409
+
401
410
def remove_temporary_source (self ):
402
411
# type: () -> None
403
412
"""Remove the source files from this requirement, if they are marked
0 commit comments