Created
August 1, 2014 07:24
-
-
Save cr0hn/ca7d17b1ff011067ac81 to your computer and use it in GitHub Desktop.
Locate automatically all .py files in your project to add to sphinx engine to generate documentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source code base directory | |
PROJECT_DIR = os.path.abspath(os.path.join(os.path.join(os.getcwd()), "../../.")) | |
# Insert Base project dir | |
sys.path.insert(0, os.path.abspath(os.path.join(PROJECT_DIR, "../."))) | |
# Run! | |
for root, dirs, files in os.walk(PROJECT_DIR): | |
# Looking for .py files and packages | |
if any(x.endswith(".py") for x in files) and any("__init__.py" in x for x in files): | |
sys.path.insert(0, os.path.join(root)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment