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

BUG: Fix finding PROJ version with PROJ_LIB and PROJ 9.1+ #1128

Merged
merged 1 commit into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Latest
- BUG: Add support for `PROJ_DATA` environment variable (issue #1097)
- BUG: Ensure numpy masked arrays stay masked after projection (issue #1102)
- BLD: Don't specify runtime_library_dirs on Cygwin (pull #1120)
- BUG: Fix finding PROJ version with PROJ_LIB and PROJ 9.1+ (issue #1127)

3.3.1
-------
Expand Down
10 changes: 9 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import platform
import re
import shutil
import subprocess
import sys
Expand All @@ -13,6 +14,7 @@
CURRENT_FILE_PATH = Path(__file__).absolute().parent
BASE_INTERNAL_PROJ_DIR = Path("proj_dir")
INTERNAL_PROJ_DIR = CURRENT_FILE_PATH / "pyproj" / BASE_INTERNAL_PROJ_DIR
PROJ_VERSION_SEARCH = re.compile(r".*Rel\.\s+(?P<version>\d+\.\d+\.\d+).*")


def get_proj_version(proj_dir: Path) -> str:
Expand All @@ -23,7 +25,13 @@ def get_proj_version(proj_dir: Path) -> str:
proj_ver = subprocess.check_output(str(proj), stderr=subprocess.STDOUT).decode(
"ascii"
)
return (proj_ver.split()[1]).strip(",")
match = PROJ_VERSION_SEARCH.search(proj_ver)
if not match:
raise RuntimeError(
"PROJ version unable to be determined. "
"Please set the PROJ_VERSION environment variable."
)
return match.groupdict()["version"]


def check_proj_version(proj_version: str) -> None:
Expand Down