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

g.extension: fix addon SOURCE_URL env var value for official GitHub addons #2936

Merged
merged 3 commits into from
Apr 30, 2023

Conversation

tmszi
Copy link
Member

@tmszi tmszi commented Apr 26, 2023

Describe the bug
Installed extension HTML manual page has wrong source code and history GitHub URL link.

Wrong is SOURCE_URL env var value, which is for every official addon https://github.com/OSGeo/grass-addons (correct URL for e.g. db.join addon should be https://github.com/OSGeo/grass-addons/tree/grass8/src/db/db.join):

"SOURCE_URL=%s" % url,

which is used inside mkhtml.py file (line 802)

grass/utils/mkhtml.py

Lines 791 to 804 in c0addd9

if os.getenv("SOURCE_URL", ""):
addon_path = get_addon_path()
if addon_path:
# Addon is installed from the local dir
if os.path.exists(os.getenv("SOURCE_URL")):
url_source = urlparse.urljoin(
addons_url,
addon_path,
)
else:
url_source = urlparse.urljoin(
os.environ["SOURCE_URL"].split("src")[0],
addon_path,
)

To Reproduce
Steps to reproduce the behavior:

  1. Try install some extension e.g. g.extension db.join
  2. Check db.join HTML manual page with $EDITOR $GRASS_ADDON_BASE/docs/html/db.join.html
  3. See SOURCE code section db.join source code and history link
<h2>SOURCE CODE</h2>
<p>
  Available at:
  <a href="https://github.com/OSGeo/src/db/db.join">db.join source code</a>
  (<a href="https://github.com/OSGeo/src/db/db.join">history</a>)
</p>

Check if these URLs exists:

test@test:~$ URL=https://github.com/OSGeo/src/db/db.join; if curl --output /dev/null --silent --head --fail "$URL"; then echo "URL exists: $URL"; else echo "URL does not exist: $URL"; fi
URL does not exist: https://github.com/OSGeo/src/db/db.join

Expected behavior
Installed extension HTML manual page should have correct source code and history GitHub URL link.

e.g. db.join addon

<h2>SOURCE CODE</h2>
<p>
  Available at:
  <a href="https://github.com/OSGeo/grass-addons/tree/grass8/src/db/db.join">db.join source code</a>
  (<a href="https://github.com/OSGeo/grass-addons/commits/grass8/src/db/db.join">history</a>)
</p>

Check if these URLs exists:

test@test:~$ URL=https://github.com/OSGeo/grass-addons/tree/grass8/src/db/db.join; if curl --output /dev/null --silent --head --fail "$URL"; then echo "URL exists: $URL"; else echo "URL does not exist: $URL"; fi
URL exists: https://github.com/OSGeo/grass-addons/tree/grass8/src/db/db.join

test@test:~$ URL=https://github.com/OSGeo/grass-addons/commits/grass8/src/db/db.join; if curl --output /dev/null --silent --head --fail "$URL"; then echo "URL exists: $URL"; else echo "URL does not exist: $URL"; fi
URL exists: https://github.com/OSGeo/grass-addons/commits/grass8/src/db/db.join

System description (please complete the following information):

  • Operating System: UNIX like
  • GRASS GIS version 8.3.dev

Additional context
To be backported with #2895.

@tmszi tmszi added bug Something isn't working backport_needed manual Documentation related issues Python Related code is in Python labels Apr 26, 2023
@tmszi tmszi added this to the 8.3.0 milestone Apr 26, 2023
@tmszi tmszi merged commit da50e2a into OSGeo:main Apr 30, 2023
21 checks passed
@tmszi tmszi deleted the g_extension_fix_addon_src_url_path branch April 30, 2023 04:20
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working manual Documentation related issues Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants