Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not spam Created directory to stderr on each get_filename4code #109

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ jobs:
# - 2.11.4
# - 2.12
- latest
# The empty env for all python but 3.5
pip-trusted-host: [""]
include:
- os: ubuntu-20.04
python-version: 3.5
pandoc-version: latest
pip-trusted-host: "pypi.python.org pypi.org files.pythonhosted.org"
- os: ubuntu-20.04
python-version: 3.6
pandoc-version: latest
Expand All @@ -59,6 +62,8 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
env:
PIP_TRUSTED_HOST: ${{ matrix.pip-trusted-host }}
- name: Install examples' dependencies
run: sudo apt update && sudo apt install abcm2ps graphviz graphviz-dev texlive-full
- name: Install dependencies—pip
Expand Down
11 changes: 6 additions & 5 deletions pandocfilters.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ def get_filename4code(module, content, ext=None):
else:
imagedir = module + "-images"
fn = hashlib.sha1(content.encode(sys.getfilesystemencoding())).hexdigest()
try:
os.makedirs(imagedir, exist_ok=True)
sys.stderr.write('Created directory ' + imagedir + '\n')
except OSError:
sys.stderr.write('Could not create directory "' + imagedir + '"\n')
if not os.path.isdir(imagedir):
try:
os.makedirs(imagedir)
sys.stderr.write('Created directory ' + imagedir + '\n')
except OSError:
sys.stderr.write('Could not create directory "' + imagedir + '"\n')
if ext:
fn += "." + ext
return os.path.join(imagedir, fn)
Expand Down
Loading