Permalink
Browse files

Don't die when pod2man can't be found.

  • Loading branch information...
1 parent 69531be commit f483db2680d5a178dbb38d26dc28c258466256ec @foucault committed Aug 26, 2011
Showing with 16 additions and 9 deletions.
  1. +16 −9 setup.py
View
@@ -2,6 +2,7 @@
import subprocess
import shutil
import re
+import errno
from distutils.core import setup, Extension, Distribution
from distutils.command.install import install
from distutils.command.build import build
@@ -20,15 +21,21 @@ def make_install_pod_manpages(self, directory, target=os.path.join("share","man"
(name, section, pod) = basef.split(".")
fullname = "%s.%s"%(os.path.join(directory,name), section)
print("Generating man page %s"%os.path.basename(fullname))
- podret = subprocess.call(["pod2man",\
- "--utf8", "-c", '', "-r", '',\
- '-n', name.upper(), '-s', section,\
- f, fullname
- ])
- if int(podret) != 0:
- print("*** Could not generate %s, skipping."\
- %os.path.basename(fullname))
- continue
+ try:
+ podret = subprocess.call(["pod2man",\
+ "--utf8", "-c", '', "-r", '',\
+ '-n', name.upper(), '-s', section,\
+ f, fullname
+ ])
+ if int(podret) != 0:
+ print("*** Could not generate %s, skipping."\
+ %os.path.basename(fullname))
+ continue
+ except OSError as err:
+ if err.errno == errno.ENOENT:
+ print("\033[1;31m***Could not find pod2man. "
+ "Skipping manpages***\033[0m")
+ return
gzret = subprocess.call(["gzip",fullname])
if int(gzret) != 0:
print("*** Could not gzip %s, skipping."\

0 comments on commit f483db2

Please sign in to comment.