Skip to content

Commit

Permalink
Fixed too many warnings on empty folder
Browse files Browse the repository at this point in the history
  • Loading branch information
spacemanspiff2007 committed Sep 22, 2021
1 parent b08b984 commit 66e6c97
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
13 changes: 10 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ Sphinx-exec-code allows execution of any python code during the documentation bu
It's also possible to display the output of the code execution.

With this extension it's easy to ensure that the provided code samples are always working.
Additionally, it's possible to inspect and print output of the documented code.
Additionally, it's possible to show the output of the documented code.

Each code snippet runs in a fresh interpreter so changes to not leak between executions.

## Documentation
[The full documentation can be found at here](https://sphinx-exec-code.readthedocs.io)
Expand All @@ -22,11 +24,16 @@ Additionally, it's possible to inspect and print output of the documented code.

````text
.. exec-code::
:hide_output:
print('This code will be executed')
````

generates
```python
print('This code will be executed')
```
```
This code will be executed
```

# Changelog
#### 0.2 (21.09.2021)
Expand Down
11 changes: 8 additions & 3 deletions src/sphinx_exec_code/sphinx_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,23 @@ def builder_ready(app):
raise FileNotFoundError(f'Additional directory "{_f}" not found! (configured by {CONF_NAME_DIRS})')

# Search for a python package and print a warning if we find none
# since this is the only reason to specify a working dir
# since this is the only reason to specify additional folders
for _f in folders:
package_found = False
for __f in _f.iterdir():
if not __f.is_dir():
continue

# log warning if we don't find a python package
for file in __f.iterdir():
if file.name == '__init__.py':
package_found = True
break
else:
log.warning(f'[exec-code] No Python package found in {_f}')
if package_found:
break

if not package_found:
log.warning(f'[exec-code] No Python packages found in {_f}')

setup_code_env(cwd, folders)
return None
Expand Down

0 comments on commit 66e6c97

Please sign in to comment.