21
21
"""
22
22
23
23
# Semi-standard module versioning.
24
- __version__ = '0.8.16 '
24
+ __version__ = '0.8.17 '
25
25
26
26
# Standard library modules.
27
27
import logging
@@ -384,16 +384,17 @@ def install_requirements(requirements, install_prefix=ENVIRONMENT):
384
384
if not filename :
385
385
logger .error ("Error: No binary distribution of %s (%s) available!" , name , version )
386
386
return False
387
- install_binary_dist (filename , install_prefix = install_prefix )
387
+ install_binary_dist (name , filename , install_prefix = install_prefix )
388
388
logger .info ("Finished installing all requirements in %s." , install_timer )
389
389
return True
390
390
391
- def install_binary_dist (filename , install_prefix = ENVIRONMENT ):
391
+ def install_binary_dist (package , filename , install_prefix = ENVIRONMENT ):
392
392
"""
393
393
Install a binary distribution created with ``python setup.py bdist`` into
394
394
the given prefix (a directory like ``/usr``, ``/usr/local`` or a virtual
395
395
environment).
396
396
397
+ :param package: The name of the package to install.
397
398
:param filename: The pathname of the tar archive.
398
399
:param install_prefix: The "prefix" under which the requirements should be
399
400
installed. This will be a pathname like ``/usr``,
@@ -408,7 +409,10 @@ def install_binary_dist(filename, install_prefix=ENVIRONMENT):
408
409
# places based on the "seed" environment.
409
410
install_timer = Timer ()
410
411
python = os .path .join (install_prefix , 'bin' , 'python' )
411
- logger .info ("Installing binary distribution %s to %s .." , filename , install_prefix )
412
+ pip = os .path .join (install_prefix , 'bin' , 'pip' )
413
+ if os .system ('"%s" uninstall --yes "%s" >/dev/null 2>&1' % (pip , package )) == 0 :
414
+ logger .info ("Uninstalled previously installed package %s." , package )
415
+ logger .info ("Installing package %s from binary distribution %s to %s .." , package , filename , install_prefix )
412
416
archive = tarfile .open (filename , 'r:gz' )
413
417
for member in archive .getmembers ():
414
418
install_path = os .path .join (install_prefix , member .name )
0 commit comments