Skip to content

Commit 666ea68

Browse files
committed
Merge pull request #1629 from rtfd/fix-project-conf-dir-if-conf.py-is-in-the-path
Fix logic in Project.conf_dir
2 parents b893883 + 7342695 commit 666ea68

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

readthedocs/builds/models.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ def get_downloads(self, pretty=False):
184184
return data
185185

186186
def get_conf_py_path(self):
187-
conf_py_path = self.project.conf_file(self.slug)
188-
conf_py_path = conf_py_path.replace(
189-
self.project.checkout_path(self.slug), '')
190-
return conf_py_path.replace('conf.py', '')
187+
conf_py_path = self.project.conf_dir(self.slug)
188+
checkout_prefix = self.project.checkout_path(self.slug)
189+
conf_py_path = os.path.relpath(conf_py_path, checkout_prefix)
190+
return conf_py_path
191191

192192
def get_build_path(self):
193193
'''Return version build path if path exists, otherwise `None`'''

readthedocs/projects/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ def conf_file(self, version=LATEST):
597597
def conf_dir(self, version=LATEST):
598598
conf_file = self.conf_file(version)
599599
if conf_file:
600-
return conf_file.replace('/conf.py', '')
600+
return os.path.dirname(conf_file)
601601

602602
@property
603603
def is_type_sphinx(self):

0 commit comments

Comments
 (0)