Page MenuHomePhabricator

setup.py raises IndexError when no tags are found in cloned repository
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue:

clone pywikibot with depth 1 and run make_dist:

git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +9f518689d84786fea4109e3281957447e76778a8:refs/remotes/origin/master

coverage run -m make_dist -local

What happens?:

Removing old dist folders... done
directory is /home/runner/work/pwb/pwb
clear /home/runner/work/pwb/pwb/pywikibot/scripts/i18n/pywikibot directory
copy i18n files ... done
Remove copied files... done
Traceback (most recent call last):
  File "/home/runner/work/pwb/pwb/make_dist.py", line 210, in <module>
    main()
  File "/home/runner/work/pwb/pwb/make_dist.py", line 206, in main
    SetupPywikibot(*args).run()
  File "/home/runner/work/pwb/pwb/make_dist.py", line 115, in run
    setup.main()  # create a new package
  File "/home/runner/work/pwb/pwb/setup.py", line 216, in main
    version = get_validated_version()
  File "/home/runner/work/pwb/pwb/setup.py", line 155, in get_validated_version
    last_tag = tags[-1]
IndexError: list index out of range

https://github.com/xqt/pwb/actions/runs/4850444159/jobs/8643352202

Event Timeline

Xqt changed the task status from Open to In Progress.May 1 2023, 10:48 AM
Xqt claimed this task.
Xqt triaged this task as Medium priority.

Change 913914 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [bugfix] Take into account that a repository clone may have no tags

https://gerrit.wikimedia.org/r/913914

Change 913914 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] Take into account that a repository clone may have no tags

https://gerrit.wikimedia.org/r/913914