Skip to content

Commit

Permalink
[frontend] fixed autodoc error (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankLeeeee authored Sep 8, 2023
1 parent e62466b commit e774827
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions doc-build/docer/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from docer.core.autodoc import AutoDoc
from docer.core.docs import DocManager
from docer.core.doctest import DocTest
from docer.core.git import GitClient


@click.command(help="Extract the docs from the versions given in the main branch")
Expand Down Expand Up @@ -40,6 +41,7 @@ def extract(cache, owner, project, ref):
@click.option('-n', '--name', help="name of the folder containing the docs", default=None)
def autodoc(cache, owner, project, ref, name):
auto_doc = AutoDoc()
git_client = GitClient(root_directory=cache, owner=owner, project=project)

doc_dir = os.path.join(cache, 'docs')

Expand All @@ -50,12 +52,13 @@ def _convert(tag_ver, version_dir):
version_tag=tag_ver,
)

# generate the github url based on page info
pip_link = "git+https://github.com/{repo_owner}/{repo_name}.git@{version_tag}".format(**page_info)
# git checkout to the specified ref
git_client.checkout(ref)

# install this url via pip
# such that the autodoc is with respect the specified version
subprocess.check_call(['pip', 'install', '--force-reinstall', pip_link])
with git_client._change_dir(git_client.repo_directory):
subprocess.check_call(['pip', 'install', '--force-reinstall', "."])

# convert all docs in place
auto_doc.convert_to_mdx_in_place(version_dir, page_info)
Expand Down

0 comments on commit e774827

Please sign in to comment.