Skip to content

Commit

Permalink
Fixes #76 - Swapping over to use package
Browse files Browse the repository at this point in the history
  • Loading branch information
Samreay committed Oct 18, 2023
1 parent 89fea9e commit c950fb0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ install_requires =
mkdocs>=1,<2
mkdocs-material
tqdm
packaging
tests_require =
pytest
# for some reason these pytest dependencies were not declared in old versions of pytest
Expand Down
6 changes: 3 additions & 3 deletions src/mkdocs_gallery/py_source_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from __future__ import absolute_import, division, print_function

import ast
import platform
import re
import sys
import tokenize
from distutils.version import LooseVersion
from packaging.version import parse as parse_version
from io import BytesIO
from pathlib import Path
from textwrap import dedent
Expand Down Expand Up @@ -106,7 +106,7 @@ def _get_docstring_and_rest(file: Path):
'unless the file is ignored by "ignore_pattern"'
)

if LooseVersion(sys.version) >= LooseVersion("3.7"):
if parse_version(platform.python_version()) >= parse_version("3.7"):
docstring = ast.get_docstring(node)
assert docstring is not None # noqa # should be guaranteed above
# This is just for backward compat
Expand Down
4 changes: 2 additions & 2 deletions src/mkdocs_gallery/scrapers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import os
import re
import sys
from distutils.version import LooseVersion
from packaging.version import parse as parse_version
from pathlib import Path, PurePosixPath
from textwrap import indent
from typing import Dict, List, Optional
Expand Down Expand Up @@ -272,7 +272,7 @@ def _anim_md(anim, image_path, gallery_conf):
thumb_size = gallery_conf["thumbnail_size"]
use_dpi = round(min(t_s / f_s for t_s, f_s in zip(thumb_size, fig_size)))
# FFmpeg is buggy for GIFs before Matplotlib 3.3.1
if LooseVersion(matplotlib.__version__) >= LooseVersion("3.3.1") and FFMpegWriter.isAvailable():
if parse_version(matplotlib.__version__) >= parse_version("3.3.1") and FFMpegWriter.isAvailable():
writer = "ffmpeg"
elif ImageMagickWriter.isAvailable():
writer = "imagemagick"
Expand Down

0 comments on commit c950fb0

Please sign in to comment.