Commit a3e7aee8 authored by Chandan Singh's avatar Chandan Singh Committed by Chandan Singh
Browse files

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.
parent 4edbbd27
Loading
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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')
    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 []


#####################################################