소스 검색

feat: Add `SPHINX_MULTIVERSION_GIT_COMMIT` env

Signed-off-by: longjin <[email protected]>
longjin 6 달 전
부모
커밋
5c3663574a
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      sphinx_multiversion/main.py

+ 3 - 0
sphinx_multiversion/main.py

@@ -227,6 +227,7 @@ def main(argv=None):
         for gitref in gitrefs:
             # Clone Git repo
             repopath = os.path.join(tmp, gitref.commit)
+            commit = str(gitref.commit)
             try:
                 git.copy_tree(str(gitroot), gitroot.as_uri(), repopath, gitref)
             except (OSError, subprocess.CalledProcessError):
@@ -289,6 +290,7 @@ def main(argv=None):
                 ),
                 "confdir": confpath,
                 "docnames": list(project.discover()),
+                "commit": commit
             }
 
         if args.dump_metadata:
@@ -347,6 +349,7 @@ def main(argv=None):
                     "SPHINX_MULTIVERSION_SOURCEDIR": data["sourcedir"],
                     "SPHINX_MULTIVERSION_OUTPUTDIR": data["outputdir"],
                     "SPHINX_MULTIVERSION_CONFDIR": data["confdir"],
+                    "SPHINX_MULTIVERSION_GIT_COMMIT": data["commit"],
                 }
             )
             subprocess.check_call(cmd, cwd=current_cwd, env=env)