diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index ee54eef..5d6d7db 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -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 @@ -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 diff --git a/pandocfilters.py b/pandocfilters.py index 68569d9..6fd72b1 100755 --- a/pandocfilters.py +++ b/pandocfilters.py @@ -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)