Skip to content

Commit

Permalink
Fix IndexError when calling subprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Dec 19, 2023
1 parent 3a0bdab commit 0eef68b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
- name: Package and deploy the zip
run: >-
qgis-plugin-ci
-vv
-v
release ${{ env.RELEASE_VERSION }}
--github-token ${{ secrets.BOT_HUB_TOKEN }}
--transifex-token ${{ secrets.TRANSIFEX_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ package-zip:
script:
- >
qgis-plugin-ci
-vv
-v
package ${VERSION}
--plugin-repo-url https://packages.3liz.org/pub/lizmap-qgis-plugin/${STATUS}/
--transifex-token ${TX_TOKEN}
Expand Down
24 changes: 21 additions & 3 deletions lizmap/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,13 @@ def current_git_hash() -> str:
universal_newlines=True,
encoding='utf8'
)
hash_number = git_show.communicate()[0].partition('\n')[0]
try:
hash_number = git_show.communicate()[0].partition('\n')[0]
except IndexError:
# Reported on redmine
# IndexError: list index out of range
hash_number = ''

if hash_number == '':
hash_number = 'unknown'
return hash_number
Expand All @@ -169,7 +175,13 @@ def has_git() -> bool:
universal_newlines=True,
encoding='utf8'
)
output = git_show.communicate()[0].partition('\n')[0]
try:
output = git_show.communicate()[0].partition('\n')[0]
except IndexError:
# Reported on redmine
# IndexError: list index out of range
output = ''

return output != ''


Expand All @@ -185,7 +197,13 @@ def next_git_tag():
universal_newlines=True,
encoding='utf8'
)
tag = git_show.communicate()[0].partition('\n')[0]
try:
tag = git_show.communicate()[0].partition('\n')[0]
except IndexError:
# Reported on redmine
# IndexError: list index out of range
tag = ''

if not tag:
return 'next'
versions = tag.split('.')
Expand Down

0 comments on commit 0eef68b

Please sign in to comment.