Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.pyc
*.egg-info
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Changelog
Version 0.2
===========

Version 0.2.5 (2023-09-13)
--------------------------

* Added partial support for git submodules. Now it is simply copied to a temporary folder from gitroot.

Version 0.2.4 (2020-08-12)
--------------------------

Expand Down
2 changes: 1 addition & 1 deletion sphinx_multiversion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .sphinx import setup
from .main import main

__version__ = "0.2.4"
__version__ = "0.2.5"

__all__ = [
"setup",
Expand Down
17 changes: 17 additions & 0 deletions sphinx_multiversion/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import subprocess
import tarfile
import tempfile
import shutil


GitRef = collections.namedtuple(
"VersionRef",
Expand Down Expand Up @@ -168,3 +170,18 @@ def copy_tree(gitroot, src, dst, reference, sourcepath="."):
fp.seek(0)
with tarfile.TarFile(fileobj=fp) as tarfp:
tarfp.extractall(dst)

cmd = (
"git",
"submodule",
"status",
)
output = subprocess.check_output(cmd, cwd=gitroot).decode()
for line in output.splitlines():
fields = line.strip().split(" ")
if len(fields) != 3:
continue
name = fields[1]
srcpath = os.path.join(gitroot, name)
dstpath = os.path.join(dst, name)
shutil.copytree(srcpath, dstpath, dirs_exist_ok=True)