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

Convert version parsing from pkg_resources to packaging #120

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
8 changes: 4 additions & 4 deletions contrib/generate-version-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sys
import xml.etree.ElementTree as ET

from pkg_resources import parse_version
from packaging.version import parse

XMLNS = '{http://www.gtk.org/introspection/core/1.0}'
XMLNS_C = '{http://www.gtk.org/introspection/c/1.0}'
Expand Down Expand Up @@ -55,14 +55,14 @@ def _add_cls(self, cls):
for node in cls.findall(XMLNS + 'method'):
version_tmp = self._add_node(node)
if version_tmp:
if not version_lowest or parse_version(version_tmp) < parse_version(version_lowest):
if not version_lowest or parse(version_tmp) < parse(version_lowest):
version_lowest = version_tmp

# add the constructor
for node in cls.findall(XMLNS + 'constructor'):
version_tmp = self._add_node(node)
if version_tmp:
if not version_lowest or parse_version(version_tmp) < parse_version(version_lowest):
if not version_lowest or parse(version_tmp) < parse(version_lowest):
version_lowest = version_tmp

if '{http://www.gtk.org/introspection/glib/1.0}get-type' not in cls.attrib:
Expand Down Expand Up @@ -94,7 +94,7 @@ def render(self):
# output the version data to a file
verout = '# generated automatically, do not edit!\n'
oldversion = None
for version in sorted(versions, key=parse_version):
for version in sorted(versions, key=parse):
symbols = sorted(self.releases[version])
verout += '\n%s_%s {\n' % (self.library_name, version)
verout += ' global:\n'
Expand Down
Loading