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

FIX: setup.py should output "... 8.0.0 *or later*" if proj is missing or too old #1992

Merged
Merged
Changes from 1 commit
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
20 changes: 10 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
# Please keep in sync with INSTALL file.
GEOS_MIN_VERSION = (3, 7, 2)
PROJ_MIN_VERSION = (8, 0, 0)
PROJ_MIN_VERSION_STRING = '.'.join(str(v) for v in PROJ_MIN_VERSION)


def file_walk_relative(top, remove=''):
Expand Down Expand Up @@ -145,15 +146,14 @@ def find_proj_version_by_program(conda=None):
proj = shutil.which('proj')
if proj is None:
print(
'Proj {} must be installed.'.format(
'.'.join(str(v) for v in PROJ_MIN_VERSION)),
f'Proj {PROJ_MIN_VERSION_STRING} or later must be installed.',
file=sys.stderr)
exit(1)

if conda is not None and conda not in proj:
print(
'Proj {} must be installed in Conda environment "{}".'.format(
'.'.join(str(v) for v in PROJ_MIN_VERSION), conda),
f'Proj {PROJ_MIN_VERSION_STRING} or later must be installed in'
f' Conda environment "{conda}".',
file=sys.stderr)
exit(1)

Expand All @@ -164,9 +164,9 @@ def find_proj_version_by_program(conda=None):
proj_version = tuple(int(v.strip(b',')) for v in proj_version)
except (OSError, IndexError, ValueError, subprocess.CalledProcessError):
warnings.warn(
'Unable to determine Proj version. Ensure you have %s or later '
'installed, or installation may fail.' % (
'.'.join(str(v) for v in PROJ_MIN_VERSION), ))
f'Unable to determine Proj version. Ensure you have '
f'{PROJ_MIN_VERSION_STRING} or later installed, or installation may fail.'
)
proj_version = (0, 0, 0)

return proj_version
Expand All @@ -179,10 +179,10 @@ def find_proj_version_by_program(conda=None):
# the version, though.
proj_version = find_proj_version_by_program(conda)
if proj_version < PROJ_MIN_VERSION:
proj_version_string = '.'.join(str(v) for v in proj_version)
print(
'Proj version %s is installed, but cartopy requires at least '
'version %s.' % ('.'.join(str(v) for v in proj_version),
'.'.join(str(v) for v in PROJ_MIN_VERSION)),
f'Proj version {proj_version_string} is installed, but cartopy requires '

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (85 > 79 characters)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, fixed in 2nd commit

f'at least version {PROJ_MIN_VERSION_STRING}',
file=sys.stderr)
exit(1)

Expand Down