Merge lp:~manishsinha/filestore/fix-sphinx-hardcoding-in-usrbin into lp:filestore

Status: Merged
Merged at revision: 189
Proposed branch: lp:~manishsinha/filestore/fix-sphinx-hardcoding-in-usrbin
Merge into: lp:filestore
Diff against target: 32 lines (+11/-2)
1 file modified
setup.py (+11/-2)
To merge this branch: bzr merge lp:~manishsinha/filestore/fix-sphinx-hardcoding-in-usrbin
Reviewer Review Type Date Requested Status
Jason Gerard DeRose Approve
Review via email: mp+74921@code.launchpad.net

Description of the change

Fixed bugs #847044 where sphinx-build was hardcoded at /usr/bin/sphinx-build

Read the $PATH environment variable. Split it by : character. For every entry append
'sphinx-build' and check whether the file exists. If the file exists, check if it
is executable. If yes, then return the path. If none is found then return None.
The method calling this search method has to handle None return by showing a WARNING

To post a comment you must log in.
190. By Manish Sinha (मनीष सिन्हा)

Fix the stupid mistake where I changed sphinx-build to fallocate

191. By Manish Sinha (मनीष सिन्हा)

Replace os.path.isfile to path.isfile

192. By Manish Sinha (मनीष सिन्हा)

Fixed the name clash. Renamed variable path to file_path

Revision history for this message
Jason Gerard DeRose (jderose) wrote :

Rock on, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'setup.py'
2--- setup.py 2011-09-11 17:43:04 +0000
3+++ setup.py 2011-09-11 20:12:24 +0000
4@@ -25,6 +25,7 @@
5 Install `filestore`.
6 """
7
8+import os
9 from os import path
10 import subprocess
11 from distutils.core import setup
12@@ -67,10 +68,18 @@
13
14 class build_with_docs(build):
15
16+ def find_sphinx_path(self):
17+ for prefix in os.environ['PATH'].split(':'):
18+ file_path = os.path.join(prefix, 'sphinx-build')
19+ if path.isfile(file_path) and os.access(file_path, os.X_OK):
20+ return file_path
21+
22+ return None
23+
24 def run(self):
25 build.run(self)
26- sphinx = '/usr/bin/sphinx-build'
27- if not path.isfile(sphinx):
28+ sphinx = self.find_sphinx_path()
29+ if sphinx is None:
30 print("WARNING: Documentation not generated. python-sphinx missing")
31 return
32 tree = path.dirname(path.abspath(__file__))

Subscribers

People subscribed via source and target branches