-
Notifications
You must be signed in to change notification settings - Fork 228
Pass in NULL pointer to GMT_Get_Enum #224
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
Pass in NULL pointer to GMT_Get_Enum #224
Conversation
Black is Python 3.6 only so installing it through the requirements.txt file was causing a silent upgrade of Python.
💖 Thanks for opening this pull request! 💖 Please make sure you read our contributing guidelines and abide by our code of conduct. A few things to keep in mind:
|
gmt/clib/session.py
Outdated
@@ -196,6 +196,11 @@ def __getitem__(self, name): | |||
|
|||
Used to set configuration values for other API calls. Wraps ``GMT_Get_Enum``. | |||
|
|||
.. warning:: | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W293 blank line contains whitespace
gmt/clib/session.py
Outdated
@@ -196,6 +196,11 @@ def __getitem__(self, name): | |||
|
|||
Used to set configuration values for other API calls. Wraps ``GMT_Get_Enum``. | |||
|
|||
.. warning:: | |||
|
|||
This call will fail with GMT 6.0.0 trunk revisions prior to r20437 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W291 trailing whitespace
gmt/clib/session.py
Outdated
value = c_get_enum(name.encode()) | ||
# None type is valid for API purposes, so this is safe always | ||
# Constants can be queried before session is created (chicken-or-egg) | ||
# so we are not guaranteed a valid session pointer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W291 trailing whitespace
gmt/clib/session.py
Outdated
session = self.session_pointer | ||
except GMTCLibNoSessionError: | ||
session = None | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W293 blank line contains whitespace
gmt/clib/session.py
Outdated
padding = self["GMT_PAD_DEFAULT"] | ||
session_type = self["GMT_SESSION_EXTERNAL"] | ||
# While GMT 6.0.0 is in development, this check is necessary to | ||
# prevent confusion with older development builds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W291 trailing whitespace
gmt/clib/session.py
Outdated
session_type = self["GMT_SESSION_EXTERNAL"] | ||
except GMTCLibError as e: | ||
raise GMTCLibError("Ensure GMT 6.0.0 is r20437 or later ") from e | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W293 blank line contains whitespace
gmt/clib/session.py
Outdated
session = c_create_session(name.encode(), padding, session_type, print_func) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W293 blank line contains whitespace
gmt/clib/session.py
Outdated
session = c_create_session(name.encode(), padding, session_type, print_func) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W293 blank line contains whitespace
for `GMT_Get_Enum`. Resolves GenericMappingTools#222 This update breaks compatability with trunk revisions prior to r20437. However, a rudimentary check is done to try to indicate to the user. It can be removed once GMT 6.0.0 is released. Additionally, session handling has been added to `__getitem__` to use the session pointer if there is an open session. Warning added to API documentation
6f107b8
to
f208f2e
Compare
We don't really need those. GMT6 is not released yet and we assume that people have the latest version. We'll end up forgetting to remove these checks later so it's best to not have them.
Hi @akshmakov, sorry for the huge delay in responding. I was busy trying to get GMT building on conda again so that we could run the CI. This is great! Thanks for doing it! I went ahead and made a few changes to remove the Thanks, I really appreciate it! |
Closes #216 as well |
OK, this seems to be a problem with the OSX conda package for GMT (again). I'm merging this the way it is so that we can move on. This has been a very frustrating month on conda-forge. |
🎉🎉🎉 Congrats on merging your first pull request and welcome to the team! 🎉🎉🎉 Please open a new pull request to add yourself to the |
Updated
gmt.clib.Session.__getitem__
to reflect update GMT 6.0.0 API for forGMT_Get_Enum
.This update breaks compatability with trunk revisions prior to r20437. However,
a rudimentary check is done to try to indicate to the user. It can be removed
once GMT 6.0.0 is released.
Additionally, session handling has been added to
__getitem__
to use thesession pointer if there is an open session.
Warning added to API documentation
Fixes #222