Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addressing documentation build failures; testing ReadTheDocs build check for PRs #31

Merged
merged 3 commits into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import sys
import os
import subprocess

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand All @@ -30,25 +31,34 @@
sys.modules[mod_name] = mock.Mock()

# -- Obtain GIT version --
import subprocess


def _git_version():
cmd = ['git', 'describe', '--tags', '--always'] # omit "--dirty" from doc build
out = subprocess.check_output(cmd)
if type(out) != str:
out = out.decode('utf-8')
return out.strip()


__version__ = _git_version()


# -- Obtain upstream viral-core module: this is super hacky and not pinned to any version
def _get_viral_core():
cmd = ['git', 'clone', '--depth=1', 'https://github.com/broadinstitute/viral-core.git']
subprocess.check_call(cmd)
sys.path.insert(0, os.path.dirname(os.path.abspath('viral-core')))
viral_core_dir = os.path.abspath('viral-core')

# if the viral-core dir and its file exist, pull the latest
if os.path.exists(os.path.join(viral_core_dir,"assembly.py")): # ToDo: check if empty instead
cmd = ['git', '-C', viral_core_dir, 'pull', '--depth=1', 'https://github.com/broadinstitute/viral-core.git']
subprocess.check_call(cmd)
# otherwise clone viral-core, removing the viral-core directory if present
else:
if os.path.isdir(viral_core_dir):
os.remove(viral_core_dir, missing_ok=True)
cmd = ['git', 'clone', '--depth=1', 'https://github.com/broadinstitute/viral-core.git']
subprocess.check_call(cmd)

viral_core_parent_dir = os.path.dirname(os.path.abspath('viral-core'))
if viral_core_parent_dir not in sys.path:
sys.path.insert(0, viral_core_parent_dir)
_get_viral_core()


Expand Down