Skip to content

Commit

Permalink
Merge pull request #53 from plone/maurits-ignore-invalid-version
Browse files Browse the repository at this point in the history
Ignore invalid versions
  • Loading branch information
gforcada committed Apr 15, 2023
2 parents 14fccf9 + 887051e commit 79b4290
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 39 deletions.
5 changes: 4 additions & 1 deletion CHANGES.rst
Expand Up @@ -4,7 +4,10 @@ Changelog
1.7.1 (unreleased)
------------------

- Nothing changed yet.
- Ignore invalid versions.
Needed for ``setuptools`` 66 and higher when checking a package that has invalid versions on PyPI.
Fixes `issue 52 <https://github.com/plone/plone.versioncheck/issues/52>`_.
[maurits]


1.7.0 (2019-03-08)
Expand Down
21 changes: 1 addition & 20 deletions setup.cfg
Expand Up @@ -27,26 +27,7 @@ norecursedirs =
xfail_strict = True

[isort]
# Plone Import Coding Conventions settings
# (see: https://docs.plone.org/develop/styleguide/python.html#about-imports).
# For all possible settings on isort see:
# http://isort.readthedocs.io/en/latest/#configuring-isort /
# https://github.com/timothycrosley/isort/wiki/isort-Settings
force_alphabetical_sort = True
force_single_line = True

# We want two empty lines after import sections
lines_after_imports = 2

#
line_length = 200

# We do not want any files skiped in Plone context, so include __init__.py
# which would be excluded by default.
not_skip =
__init__.py

skip =
profile = plone

[flake8]
exclude =
Expand Down
6 changes: 5 additions & 1 deletion setup.py
Expand Up @@ -3,7 +3,7 @@
from setuptools import setup


version = '1.7.1.dev0'
version = "1.7.1.dev0"

long_description = "{0}\n\n{1}".format(
open("README.rst").read(), open("CHANGES.rst").read()
Expand All @@ -28,6 +28,10 @@
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python",
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Quality Assurance",
Expand Down
2 changes: 1 addition & 1 deletion src/plone/versioncheck/analyser.py
Expand Up @@ -39,7 +39,7 @@ def is_cfgidx_newer(pkginfo, target_idx):


def is_cfg_newer(pkginfo):
""" checks if one of the cfg is newer
"""checks if one of the cfg is newer
returns boolean
"""
Expand Down
1 change: 1 addition & 0 deletions src/plone/versioncheck/formatter.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import print_function

from collections import OrderedDict
from fnmatch import fnmatch
from jinja2 import Environment
Expand Down
8 changes: 7 additions & 1 deletion src/plone/versioncheck/pypi.py
Expand Up @@ -74,7 +74,13 @@ def check(name, version, session): # noqa: C901
releases = sorted(data["releases"])
for release in releases:
# major check (overall)
rel_v = parse_version(release)
try:
rel_v = parse_version(release)
except Exception:
# likely pkg_resources.extern.packaging.version.InvalidVersion
# but really any exception can be ignored.
# See https://github.com/plone/plone.versioncheck/issues/52
continue
if rel_v <= version:
continue
rel_vtuple = mmbp_tuple(rel_v)
Expand Down
16 changes: 8 additions & 8 deletions src/plone/versioncheck/utils.py
Expand Up @@ -79,8 +79,7 @@ def requests_session(nocache=False):


def find_relative(extend, relative=""):
"""the base dir or url and the actual filename as tuple
"""
"""the base dir or url and the actual filename as tuple"""
if "://" in extend:
parts = list(urlparse(extend))
path = parts[2].split("/")
Expand All @@ -98,11 +97,11 @@ def find_relative(extend, relative=""):


def get_terminal_size():
""" getTerminalSize()
- get width and height of console
- works on linux,os x,windows,cygwin(windows)
originally retrieved from:
http://stackoverflow.com/questions/566746/how-to-get-console-window-width-in-python
"""getTerminalSize()
- get width and height of console
- works on linux,os x,windows,cygwin(windows)
originally retrieved from:
http://stackoverflow.com/questions/566746/how-to-get-console-window-width-in-python
"""
current_os = platform.system()
tuple_xy = None
Expand All @@ -120,7 +119,8 @@ def get_terminal_size():

def _get_terminal_size_windows():
try:
from ctypes import windll, create_string_buffer
from ctypes import create_string_buffer
from ctypes import windll

# stdin handle is -10
# stdout handle is -11
Expand Down
20 changes: 13 additions & 7 deletions tox.ini
Expand Up @@ -3,6 +3,11 @@ envlist =
py27,
py36,
py37,
py38,
py39,
# These currently fail because they get setuptools 66+:
# py310,
# py311,
pypy,
lint,
coverage-report,
Expand Down Expand Up @@ -42,13 +47,13 @@ commands =
coverage xml

[testenv:isort-apply]
basepython = python3.6
basepython = python3.8
skip_install = true
deps =
isort

commands =
isort --apply --recursive {toxinidir}/src {toxinidir}/tests {posargs}
isort src tests setup.py {posargs}

[testenv:autopep8]
basepython = python3.6
Expand All @@ -61,16 +66,17 @@ commands =
autopep8 --verbose --in-place --recursive --aggressive --aggressive {toxinidir}/src {toxinidir}/tests setup.py
docformatter --in-place --recursive {toxinidir}/src {toxinidir}/tests setup.py

[lint]
[testenv:lint]
skip_install = true
basepython = python3.6
basepython = python3.8

deps =
isort
black
black==21.12b0
click<8.1

commands =
isort --check-only --recursive {toxinidir}/src {toxinidir}/tests setup.py
isort --check-only src tests setup.py
black --check src tests setup.py

whitelist_externals =
Expand All @@ -87,7 +93,7 @@ commands =

[testenv:release]
skip_install = true
basepython = python3.6
basepython = python3.8

deps =
zest.releaser[recommended]
Expand Down

0 comments on commit 79b4290

Please sign in to comment.