Skip to content

Instantly share code, notes, and snippets.

@jams2
Created December 2, 2019 14:53
Show Gist options
  • Select an option

  • Save jams2/11a60020a1ada897d79fc4c77fb587eb to your computer and use it in GitHub Desktop.

Select an option

Save jams2/11a60020a1ada897d79fc4c77fb587eb to your computer and use it in GitHub Desktop.

Revisions

  1. jams2 created this gist Dec 2, 2019.
    13 changes: 13 additions & 0 deletions libgeos.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    """The version regex in django/contrib/gis/geos/libgeos.py fails on
    the latest homebrew geos install at time of writing, with message:
    django.contrib.gis.geos.error.GEOSException: Could not parse version info string "3.8.0-CAPI-1.13.1 "
    The trailing whitespace is the culprit. Add a r'\s?$' to the end of the pattern.
    """


    version_regex = re.compile(
    r'^(?P<version>(?P<major>\d+)\.(?P<minor>\d+)\.(?P<subminor>\d+))'
    r'((rc(?P<release_candidate>\d+))|dev)?-CAPI-(?P<capi_version>\d+\.\d+\.\d+)( r\d+)?( \w+)?\s?$'
    )