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: refactor/simplify 'GitAdapter' class '_get_addons_list' method #2925

Merged
merged 1 commit into from
Apr 19, 2023

Conversation

tmszi
Copy link
Member

@tmszi tmszi commented Apr 19, 2023

Describe the bug
The installation of some extension via the g.extension module failed.

To Reproduce
Steps to reproduce the behavior:

  1. Try install some extension g.extension db.join
  2. See error
Traceback (most recent call last):
  File "/usr/lib64/grass83/scripts/g.extension", line 2876, in <module>
    sys.exit(main())
  File "/usr/lib64/grass83/scripts/g.extension", line 2856, in main
    install_extension(source=source, url=url, xmlurl=xmlurl, branch=branch)
  File "/usr/lib64/grass83/scripts/g.extension", line 1239, in install_extension
    ) = install_extension_std_platforms(
  File "/usr/lib64/grass83/scripts/g.extension", line 2000, in install_extension_std_platforms
    srcdir = download_source_code(
  File "/usr/lib64/grass83/scripts/g.extension", line 1912, in download_source_code
    directory = download_source_code_official_github(
  File "/usr/lib64/grass83/scripts/g.extension", line 1778, in download_source_code_official_github
    ga = GitAdapter(
  File "/usr/lib64/grass83/scripts/g.extension", line 252, in __init__
    self.addons = self._get_addons_list()
  File "/usr/lib64/grass83/scripts/g.extension", line 387, in _get_addons_list
    addons_dict[file_path.split("/")[3]] = "/".join(
IndexError: list index out of range

Expected behavior
The installation of some extension via g.extension module should work.

System description:

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

Additional context
Bug was introduced by addons PR OSGeo/grass-addons#887.
To be backported with #2895.

@tmszi tmszi added bug Something isn't working backport_needed Python Related code is in Python labels Apr 19, 2023
@tmszi tmszi added this to the 8.3.0 milestone Apr 19, 2023
@ninsbl
Copy link
Member

ninsbl commented Apr 19, 2023

Thanks @tmszi for the quick fix and improvement of the related code! Looks good to me.

And sorry for introducing the issue!

Maybe we should run the g.extension tests also in the addons repository, probably in a modified form that tests compilation. That way this issue would have been caught earlier (and maybe even befor hitting users).

@ninsbl
Copy link
Member

ninsbl commented Apr 19, 2023

For the record, the issue was introduced with: OSGeo/grass-addons#887 which added missing Makefiles in sum subdirectories.

@tmszi tmszi merged commit ca1bc80 into OSGeo:main Apr 19, 2023
@tmszi tmszi deleted the g_extension-refactor-get_addons_list-method branch April 19, 2023 17:44
@tmszi
Copy link
Member Author

tmszi commented Apr 19, 2023

And sorry for introducing the issue!

Bugs happen and appear, this is how we quickly discovered the weak point of this method's code and improve it.

Maybe we should run the g.extension tests also in the addons repository, probably in a modified form that tests compilation. That way this issue would have been caught earlier (and maybe even befor hitting users).

Good idea I agree.

neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
Refactor/simplify 'GitAdapter' class '_get_addons_list' method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants