Fix package removing when it is symbolically linked

This commit is contained in:
Ivan Kravets
2016-05-27 15:50:57 +03:00
parent 825c60e2bd
commit 426389b255

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
import os import os
from os.path import dirname, isdir, isfile, join from os.path import dirname, isdir, isfile, islink, join
from shutil import copyfile, copytree, rmtree from shutil import copyfile, copytree, rmtree
import click import click
@ -246,7 +246,11 @@ class PackageManager(object):
continue continue
found = True found = True
if isfile(manifest['_manifest_path']): if isfile(manifest['_manifest_path']):
rmtree(dirname(manifest['_manifest_path'])) pkg_dir = dirname(manifest['_manifest_path'])
if islink(pkg_dir):
os.unlink(pkg_dir)
else:
rmtree(pkg_dir)
if not found: if not found:
click.secho("Not installed", fg="yellow") click.secho("Not installed", fg="yellow")