Skip to content

Commit

Permalink
docs: allow building from verson in PYTHONPATH again
Browse files Browse the repository at this point in the history
  • Loading branch information
lonvia committed Jul 28, 2022
1 parent ee8908a commit 4e09905
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,20 @@
sys.version_info[0], sys.version_info[1]
)

if not os.path.exists(build_dir):
print("""
Compiled version of pyosmium not found, please build pyosmium for Python {}.{}
before building the documentation.
""".format(*sys.version_info))
raise RuntimeError("Cannot find pyosmium")
if os.path.exists(build_dir):
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath('.'), build_dir)))

# insert after the current directory
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath('.'), build_dir)))
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath('.'), '../tools')))

from osmium.version import pyosmium_major, pyosmium_release
try:
from osmium.version import pyosmium_major, pyosmium_release
except ImportError:
print("""
Compiled version of pyosmium not found, please build pyosmium for Python {}.{}
before building the documentation.
""".format(*sys.version_info))
raise RuntimeError("Cannot find pyosmium")

# -- General configuration ------------------------------------------------

Expand Down

0 comments on commit 4e09905

Please sign in to comment.