Skip to content

Commit 4489d99

Browse files
kinowmr-c
authored andcommitted
Handle RTD paths
1 parent 39f2c0c commit 4489d99

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cwl/sphinx/runcmd.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,16 @@ def run(self):
118118
# change to that working directory before running the desired command.
119119
# The working directory is omitted from the final output.
120120
# TODO: PATCHED
121-
includes_dir = Path('src/_includes/cwl/')
122-
if not includes_dir.exists():
123-
# You can run Sphinx from the root directory, with `make watch`
124-
# for instance, or from the src directory (RTD does that).
125-
includes_dir = Path('_includes/cwl')
126-
working_directory = self.options.get('working-directory', includes_dir)
121+
working_directory = self.options.get('working-directory', 'src/_includes/cwl/')
127122
if working_directory == '':
128123
# subprocess default value, so that we can disable it if needed.
129124
working_directory = None
125+
else:
126+
# You can run Sphinx from the root directory, with `make watch`
127+
# for instance, or from the src directory (RTD does that).
128+
working_directory_path = Path(working_directory)
129+
if not working_directory_path.exists() and str(working_directory_path).startswith('src/'):
130+
working_directory = Path(working_directory[4:])
130131

131132
# Get the command output
132133
command = " ".join(self.arguments)

0 commit comments

Comments
 (0)