Skip to content

Commit 68a1dc6

Browse files
committed
setup: Check for rst2man.py as well
This is what docutils from pip installs. Compared to fedora packages which rename it rst2man. This should fix the issue that prompted 80c451e, where we made man page building non-fatal, so undo that to ensure CI is hitting this build path. Signed-off-by: Cole Robinson <crobinso@redhat.com>
1 parent bc4c2ae commit 68a1dc6

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
requests
2+
docutils

setup.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import glob
66
import os
7+
import subprocess
78
import sys
89

910
import distutils.command.build
@@ -87,17 +88,23 @@ def run(self):
8788

8889
class BuildCommand(distutils.command.build.build):
8990
def _make_man_pages(self):
91+
from distutils.spawn import find_executable
92+
rstbin = find_executable("rst2man")
93+
if not rstbin:
94+
rstbin = find_executable("rst2man.py")
95+
if not rstbin:
96+
sys.exit("Didn't find rst2man or rst2man.py")
97+
9098
for path in glob.glob("man/*.rst"):
9199
base = os.path.basename(path)
92100
appname = os.path.splitext(base)[0]
93101
newpath = os.path.join(os.path.dirname(path),
94102
appname + ".1")
95103

96104
print("Generating %s" % newpath)
97-
ret = os.system('rst2man %s > %s' % (path, newpath))
98-
if ret != 0:
99-
print("Generating '%s' failed." % newpath)
100-
continue
105+
out = subprocess.check_output([rstbin, path])
106+
open(newpath, "wb").write(out)
107+
101108
self.distribution.data_files.append(
102109
('share/man/man1', (newpath,)))
103110

0 commit comments

Comments
 (0)