diff --git a/readthedocs/builds/models.py b/readthedocs/builds/models.py index b53a3e3616b..5214d434045 100644 --- a/readthedocs/builds/models.py +++ b/readthedocs/builds/models.py @@ -184,10 +184,10 @@ def get_downloads(self, pretty=False): return data def get_conf_py_path(self): - conf_py_path = self.project.conf_file(self.slug) - conf_py_path = conf_py_path.replace( - self.project.checkout_path(self.slug), '') - return conf_py_path.replace('conf.py', '') + conf_py_path = self.project.conf_dir(self.slug) + checkout_prefix = self.project.checkout_path(self.slug) + conf_py_path = os.path.relpath(conf_py_path, checkout_prefix) + return conf_py_path def get_build_path(self): '''Return version build path if path exists, otherwise `None`''' diff --git a/readthedocs/projects/models.py b/readthedocs/projects/models.py index 088497783f8..b5957605286 100644 --- a/readthedocs/projects/models.py +++ b/readthedocs/projects/models.py @@ -597,7 +597,7 @@ def conf_file(self, version=LATEST): def conf_dir(self, version=LATEST): conf_file = self.conf_file(version) if conf_file: - return conf_file.replace('/conf.py', '') + return os.path.dirname(conf_file) @property def is_type_sphinx(self):