Skip to content

Commit

Permalink
Documentation generator fix: enforce local NBT.
Browse files Browse the repository at this point in the history
Work-around for stupid setuptools behaviour with .pth files, that override the sys.path.
  • Loading branch information
macfreek committed Oct 27, 2013
1 parent 0f3ccff commit 71ec345
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Sphinx configuration for NBT documentation.
#
# This file is execfile()d with the current directory set to its containing dir.
# This file is execfile()d by sphinx-build with the current directory set to its containing dir.

# To generate the documentation, run:
# sphinx-build -b rst -a path-to/NBT/doc path-to/NBT.wiki
Expand All @@ -24,6 +24,13 @@
if os.path.exists(os.path.join(parentdir, 'tests')):
sys.path.insert(1, os.path.join(parentdir, 'tests'))
sys.path.insert(1, parentdir)
# setuptools (which is used by pip) sometimes places a .pth file in the
# site-package folder which overrides sys.path by manipulating sys.modules.
# Undo this manipulation, to ensure we're not using nbt in the site-package
# folder when generating documentation.
if 'nbt' in sys.modules:
del sys.modules['nbt']

import nbt

# -- General configuration -----------------------------------------------------
Expand Down

0 comments on commit 71ec345

Please sign in to comment.