Skip to content

Commit

Permalink
fix replace2
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jul 23, 2019
1 parent 6e09a2c commit 15b54b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions qgispluginci/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ def release(parameters: Parameters,
"""

# set version in metadata
replace_in_file('{}/metadata.txt'.format(parameters.plugin_path),
r'^version=.*\$',
'version=${}'.format(release_version))
replace_in_file(
'{}/metadata.txt'.format(parameters.plugin_path),
r'^version=.*$',
'version=${}'.format(release_version)
)

# replace any DEBUG=False in all Python files
for file in glob('{}/**/*.py'.format(parameters.plugin_path), recursive=True):
Expand Down
2 changes: 1 addition & 1 deletion qgispluginci/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os


def replace_in_file(file_path: str, pattern: str, new: str, encoding = "utf8"):
def replace_in_file(file_path: str, pattern, new: str, encoding: str = "utf8"):
with open(file_path, 'r', encoding=encoding) as f:
content = f.read()
content = re.sub(pattern, new, content, flags=re.M)
Expand Down

0 comments on commit 15b54b1

Please sign in to comment.