From a3e7aee896f753396268be2abbf57066269ddfe2 Mon Sep 17 00:00:00 2001 From: Chandan Singh Date: Fri, 25 Jan 2019 13:22:22 +0000 Subject: setup.py: Do not error out when man directory is empty/missing If the `man` directory is empty, then it won't be copied in the source distribution, and `list_man_pages()` will throw an exception when trying to list files in a non-existent directory. This prevents us from installing the BuildStream package when the man pages are not there. The most common use-case for this is when we want to re-generate the man pages but want to install the package before re-generating them. --- setup.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 8038cd26f..49b115453 100755 --- a/setup.py +++ b/setup.py @@ -109,8 +109,12 @@ def check_for_bwrap(): def list_man_pages(): bst_dir = os.path.dirname(os.path.abspath(__file__)) man_dir = os.path.join(bst_dir, 'man') - man_pages = os.listdir(man_dir) - return [os.path.join('man', page) for page in man_pages] + try: + man_pages = os.listdir(man_dir) + return [os.path.join('man', page) for page in man_pages] + except FileNotFoundError: + # Do not error out when 'man' directory does not exist + return [] ##################################################### -- cgit v1.2.1