martin-g commented on code in PR #20001:
URL: https://github.com/apache/datafusion/pull/20001#discussion_r2725921280
##########
dev/update_datafusion_versions.py:
##########
@@ -116,7 +115,8 @@ def update_docs(path: str, new_version: str):
with open(path, 'r+') as fd:
content = fd.read()
fd.seek(0)
- content = re.sub(r'datafusion = "(.+)"', f'datafusion =
"{new_version}"', content)
+ content = re.sub(r'datafusion = "(.+?)"', f'datafusion =
"{new_version}"', content)
+ content = re.sub(r'datafusion = { version = "(.+?)"', f'datafusion =
{{ version = "{new_version}"', content)
Review Comment:
In addition the regex won't match if there is no exactly one space
before/after `=` and `{`, e.g. `datafusion = {version="..."}`. Maybe `\s*`
should be used instead of spaces ?
##########
dev/update_datafusion_versions.py:
##########
@@ -116,7 +115,8 @@ def update_docs(path: str, new_version: str):
with open(path, 'r+') as fd:
content = fd.read()
fd.seek(0)
Review Comment:
Shouldn't this actually truncate the file ?
Currently it overwrites its content but if the new content is shorter than
the previous one then the extra characters from the old one will still stay at
the end.
##########
dev/update_datafusion_versions.py:
##########
@@ -116,7 +115,8 @@ def update_docs(path: str, new_version: str):
with open(path, 'r+') as fd:
content = fd.read()
fd.seek(0)
- content = re.sub(r'datafusion = "(.+)"', f'datafusion =
"{new_version}"', content)
+ content = re.sub(r'datafusion = "(.+?)"', f'datafusion =
"{new_version}"', content)
+ content = re.sub(r'datafusion = { version = "(.+?)"', f'datafusion =
{{ version = "{new_version}"', content)
Review Comment:
```suggestion
content = re.sub(r'datafusion = \{ version = "(.+?)"', f'datafusion
= {{ version = "{new_version}"', content)
```
`{` is a special character in regex and it should be escaped if used as a
literal.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]