Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 6 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@
html_theme_options = {}
repository = "GenericMappingTools/pygmt"
repository_url = "https://github.com/GenericMappingTools/pygmt"
commit_link = f'<a href="{repository_url}/commit/{ __commit__ }">{ __commit__[:8] }</a>'
if __commit__:
commit_link = (
f'<a href="{repository_url}/commit/{ __commit__ }">{ __commit__[:8] }</a>'
)
else:
commit_link = ""
Copy link
Member

Choose a reason for hiding this comment

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

Since we have this if-else block, could we be smart and point to the tag on GitHub?

Copy link
Member

@weiji14 weiji14 Apr 5, 2021

Choose a reason for hiding this comment

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

We'll need to detect whether the commit string is a hash like a1b2c4d4 or a version tag like v0.X.Y, but the idea is to have something like so (note, don't commit yet as it won't work):

Suggested change
commit_link = ""
commit_link = f'<a href="{repository_url}/tree/{ __commit__ }">{ __commit__}</a>'

which would e.g. point to https://github.com/GenericMappingTools/pygmt/tree/v0.3.1

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking about it too. It's OK to point to the specific tag, but the text would be "Revision v0.3.1", not "Release v0.3.1".

Copy link
Member

Choose a reason for hiding this comment

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

"Revision v0.3.1" doesn't sound too bad actually (though it's not perfect either).

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Does this need to be backported to the gh-pages branch?

Copy link
Member Author

Choose a reason for hiding this comment

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

Perhaps do the backport together with #1151, as mentioned in #1150 (comment).

Copy link
Member

Choose a reason for hiding this comment

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

Ok, sounds like a good plan.

html_context = {
"menu_links": [
(
Expand Down
2 changes: 1 addition & 1 deletion pygmt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

# Get semantic version through setuptools-scm
__version__ = f'v{get_distribution("pygmt").version}' # e.g. v0.1.2.dev3+g0ab3cd78
__commit__ = __version__.split("+g")[-1] # 0ab3cd78
__commit__ = __version__.split("+g")[-1] if "+g" in __version__ else "" # 0ab3cd78

# Start our global modern mode session
_begin()
Expand Down