Skip to content

Commit

Permalink
raise an error if a built resource is present in source and the names…
Browse files Browse the repository at this point in the history
… conflicts

fixes #111
  • Loading branch information
3nids committed Feb 4, 2022
1 parent 6bb37a0 commit ad76761
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qgispluginci/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ class UncommitedChanges(Exception):

class ConfigurationNotFound(Exception):
pass


class BuiltResourceInSources(Exception):
pass
9 changes: 9 additions & 0 deletions qgispluginci/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

from qgispluginci.changelog import ChangelogParser
from qgispluginci.exceptions import (
BuiltResourceInSources,
GithubReleaseCouldNotUploadAsset,
GithubReleaseNotFound,
UncommitedChanges,
Expand Down Expand Up @@ -179,6 +180,14 @@ def create_archive(
]
)
for file in glob("{}/*_rc.py".format(parameters.plugin_path)):
with tarfile.open(top_tar_file, mode="r:") as tt:
for n in tt.getnames():
if n == file:
raise BuiltResourceInSources(
'The file "{}" is present in the sources and its name conflicts with a just built resource. You might want to remove it from the sources or setting export-ignore in .gitattributes config file.'.format(
file
)
)
with tarfile.open(top_tar_file, mode="a") as tt:
print(" adding resource: {}".format(file))
# https://stackoverflow.com/a/48462950/1548052
Expand Down

0 comments on commit ad76761

Please sign in to comment.