Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename
Browse files Browse the repository at this point in the history
stsewd committed Sep 22, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent b054218 commit 557f1b3
Showing 3 changed files with 23 additions and 20 deletions.
12 changes: 6 additions & 6 deletions readthedocs/doc_builder/backends/mkdocs.py
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ def get_yaml_config(self):
if not mkdocs_path:
mkdocs_path = 'mkdocs.yml'
return os.path.join(
self.cwd,
self.project_path,
mkdocs_path,
)

@@ -197,7 +197,7 @@ def append_conf(self):

# RTD javascript writing
rtd_data = self.generate_rtd_data(
docs_dir=os.path.relpath(docs_path, self.cwd),
docs_dir=os.path.relpath(docs_path, self.project_path),
mkdocs_config=user_config,
)
with open(os.path.join(docs_path, 'readthedocs-data.js'), 'w') as f:
@@ -223,8 +223,8 @@ def append_conf(self):
# Write the mkdocs.yml to the build logs
self.run(
'cat',
os.path.relpath(self.yaml_file, self.cwd),
cwd=self.cwd,
os.path.relpath(self.yaml_file, self.project_path),
cwd=self.project_path,
)

def generate_rtd_data(self, docs_dir, mkdocs_config):
@@ -282,13 +282,13 @@ def build(self):
'--site-dir',
self.build_dir,
'--config-file',
os.path.relpath(self.yaml_file, self.cwd),
os.path.relpath(self.yaml_file, self.project_path),
]
if self.config.mkdocs.fail_on_warning:
build_command.append('--strict')
cmd_ret = self.run(
*build_command,
cwd=self.cwd,
cwd=self.project_path,
bin_path=self.python_env.venv_bin(),
)
return cmd_ret.successful
14 changes: 7 additions & 7 deletions readthedocs/doc_builder/backends/sphinx.py
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ def __init__(self, *args, **kwargs):
self.config_file = self.project.conf_file(self.version.slug)
else:
self.config_file = os.path.join(
self.cwd,
self.project_path,
self.config_file,
)
self.old_artifact_path = os.path.join(
@@ -86,7 +86,7 @@ def get_config_params(self):
os.path.dirname(
os.path.relpath(
self.config_file,
self.cwd,
self.project_path,
),
),
'',
@@ -224,9 +224,9 @@ def append_conf(self):
'cat',
os.path.relpath(
self.config_file,
self.cwd,
self.project_path,
),
cwd=self.cwd,
cwd=self.project_path,
)

def build(self):
@@ -303,7 +303,7 @@ def venv_sphinx_supports_latexmk(self):
cmd_ret = self.run(
*command,
bin_path=self.python_env.venv_bin(),
cwd=self.cwd,
cwd=self.project_path,
escape_command=False, # used on DockerBuildCommand
shell=True, # used on BuildCommand
record=False,
@@ -418,7 +418,7 @@ def move(self, **__):
'-f',
from_file,
to_file,
cwd=self.cwd,
cwd=self.project_path,
)


@@ -638,5 +638,5 @@ def move(self, **__):
'-f',
from_file,
to_file,
cwd=self.cwd,
cwd=self.project_path,
)
17 changes: 10 additions & 7 deletions readthedocs/doc_builder/base.py
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ def __init__(self, build_env, python_env, force=False):
self.project = build_env.project
self.config = python_env.config if python_env else None
self._force = force
self.cwd = self.project.checkout_path(self.version.slug)
self.project_path = self.project.checkout_path(self.version.slug)
self.target = self.project.artifact_path(
version=self.version.slug,
type_=self.type,
@@ -91,12 +91,15 @@ def clean(self, **__):

def docs_dir(self, docs_dir=None, **__):
"""Handle creating a custom docs_dir if it doesn't exist."""
if not docs_dir:
for doc_dir_name in ['docs', 'doc', 'Doc', 'book']:
possible_path = os.path.join(self.cwd, doc_dir_name)
if os.path.exists(possible_path):
return possible_path
return docs_dir or self.cwd
if docs_dir:
return docs_dir

for doc_dir_name in ['docs', 'doc', 'Doc', 'book']:
possible_path = os.path.join(self.project_path, doc_dir_name)
if os.path.exists(possible_path):
return possible_path

return self.project_path

def create_index(self, extension='md', **__):
"""Create an index file if it needs it."""

0 comments on commit 557f1b3

Please sign in to comment.