Skip to content

Commit a827fc0

Browse files
committed
importlib
1 parent c7154ad commit a827fc0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/sphinx_codeautolink/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Sphinx extension for linking code examples to reference documentation."""
22

3-
from pathlib import Path
3+
from importlib.resources import files
44
from shutil import copyfile
55

66
from sphinx.application import Sphinx
@@ -85,5 +85,6 @@ def setup(app: Sphinx):
8585

8686
def _copy_styles(app, exc):
8787
if app.builder.format == "html" and not exc:
88-
css_file = Path(__file__).parent / "static" / "sphinx-codeautolink.css"
89-
copyfile(css_file, app.outdir / "_static" / "sphinx-codeautolink.css")
88+
css_name = "sphinx-codeautolink.css"
89+
css_file = files("sphinx_codeautolink.static").joinpath(css_name)
90+
copyfile(css_file, app.outdir / "_static" / css_name)

0 commit comments

Comments
 (0)