From 5e70843a736134e772414da0ecf9ab6620b12f10 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 31 May 2016 08:49:34 -0700 Subject: [PATCH] Don't fail if a package was not found --- doc/build.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/build.py b/doc/build.py index f08d570d..b46ac729 100755 --- a/doc/build.py +++ b/doc/build.py @@ -10,11 +10,14 @@ def pip_install(package, commit=None, **kwargs): "Install package using pip." min_version = kwargs.get('min_version') if min_version: - from pkg_resources import get_distribution - installed_version = get_distribution(os.path.basename(package)).version - if LooseVersion(installed_version) >= min_version: - print('{} {} already installed'.format(package, min_version)) - return + from pkg_resources import get_distribution, DistributionNotFound + try: + installed_version = get_distribution(os.path.basename(package)).version + if LooseVersion(installed_version) >= min_version: + print('{} {} already installed'.format(package, min_version)) + return + except DistributionNotFound: + pass if commit: package = 'git+git://github.com/{0}.git@{1}'.format(package, commit) print('Installing {}'.format(package))