summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandan Singh <csingh43@bloomberg.net>2019-01-25 13:22:22 +0000
committerChandan Singh <chandan@chandansingh.net>2019-01-25 23:50:49 +0000
commita3e7aee896f753396268be2abbf57066269ddfe2 (patch)
treedccb3f2b4645dcfbdf1fded5ce5cb9f8bc3baef6
parent4edbbd27c295e3f5498d3e721941cb8a91da4fd3 (diff)
downloadbuildstream-chandan/toxic-man.tar.gz
setup.py: Do not error out when man directory is empty/missingchandan/toxic-man
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.
-rwxr-xr-xsetup.py8
1 files 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 []
#####################################################