mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
build(app): Add fallback to os.path.join + newsfragment 886
This commit is contained in:
15
docs/conf.py
15
docs/conf.py
@ -16,20 +16,23 @@
|
|||||||
# sys.path.insert(0, os.path.abspath('.'))
|
# sys.path.insert(0, os.path.abspath('.'))
|
||||||
|
|
||||||
import doctest
|
import doctest
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import tomllib
|
import tomllib
|
||||||
except ModuleNotFoundError:
|
except ImportError:
|
||||||
# For Python < 3.11
|
# For Python < 3.11
|
||||||
import tomli as tomllib # type: ignore (In case of >3.11 Pyrefly doesnt find tomli , which is right but a false flag)
|
import tomli as tomllib # type: ignore
|
||||||
|
|
||||||
# Path to pyproject.toml (assuming conf.py is in a 'docs' subdirectory)
|
# Path to pyproject.toml (assuming conf.py is in a 'docs' subdirectory)
|
||||||
from libp2p.utils.paths import get_project_root, join_paths
|
try:
|
||||||
|
from libp2p.utils.paths import get_project_root, join_paths
|
||||||
pyproject_path = join_paths(get_project_root(), "pyproject.toml")
|
pyproject_path = join_paths(get_project_root(), "pyproject.toml")
|
||||||
|
except ImportError:
|
||||||
|
# Fallback for documentation builds where libp2p is not available
|
||||||
|
import os
|
||||||
|
pyproject_path = os.path.join(os.path.dirname(__file__), "..", "pyproject.toml")
|
||||||
|
|
||||||
with open(pyproject_path, "rb") as f:
|
with open(pyproject_path, "rb") as f:
|
||||||
pyproject_data = tomllib.load(f)
|
pyproject_data = tomllib.load(f)
|
||||||
|
|||||||
2
newsfragments/886.bugfix.rst
Normal file
2
newsfragments/886.bugfix.rst
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Fixed cross-platform path handling by replacing hardcoded OS-specific
|
||||||
|
paths with standardized utilities in core modules and examples.
|
||||||
Reference in New Issue
Block a user