Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/update_setup_py.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ echo -e "rules:
constraint_files = set()

# groups \"my-package-name<=x.y.z,...\" into (\"my-package-name\", \"<=x.y.z,...\")
requirement_line_regex = re.compile(r\"([a-zA-Z0-9-_.]+)([<>=][^#\s]+)?\")
requirement_line_regex = re.compile(r\"([a-zA-Z0-9-_.\[\]]+)([<>=][^#\s]+)?\")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
requirement_line_regex = re.compile(r\"([a-zA-Z0-9-_.\[\]]+)([<>=][^#\s]+)?\")
requirement_line_regex = re.compile(r\"([a-zA-Z0-9\-_.\[\],]+)([<>=][^#\s]+)?\")

There can be more than one extra in the list, so we should have a comma as well. And probably want to escape this hyphen, even though it shouldn't cause trouble at the moment (since there's a range just before it).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically, there could also be whitespace around that comma or probably even the brackets. I don't see any instances of that in our code, though. 🤔


def add_version_constraint_or_raise(current_line, current_requirements, add_if_not_present):
regex_match = requirement_line_regex.match(current_line)
Expand Down