Skip to content

allow trailing comma in version_many #1550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 26, 2024
Merged
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
8 changes: 6 additions & 2 deletions source/specifications/dependency-specifiers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ URI is defined in :rfc:`std-66 <3986>`)::
version_cmp = wsp* '<' | '<=' | '!=' | '==' | '>=' | '>' | '~=' | '==='
version = wsp* ( letterOrDigit | '-' | '_' | '.' | '*' | '+' | '!' )+
version_one = version_cmp version wsp*
version_many = version_one (wsp* ',' version_one)*
version_many = version_one (',' version_one)* (',' wsp*)?
versionspec = ( '(' version_many ')' ) | version_many
urlspec = '@' wsp* <URI_reference>

Expand Down Expand Up @@ -303,7 +303,7 @@ The complete parsley grammar::
version_cmp = wsp* <'<=' | '<' | '!=' | '==' | '>=' | '>' | '~=' | '==='>
version = wsp* <( letterOrDigit | '-' | '_' | '.' | '*' | '+' | '!' )+>
version_one = version_cmp:op version:v wsp* -> (op, v)
version_many = version_one:v1 (wsp* ',' version_one)*:v2 -> [v1] + v2
version_many = version_one:v1 (',' version_one)*:v2 (',' wsp*)? -> [v1] + v2
versionspec = ('(' version_many:v ')' ->v) | version_many
urlspec = '@' wsp* <URI_reference>
marker_op = version_cmp | (wsp* 'in') | (wsp* 'not' wsp+ 'in')
Expand Down Expand Up @@ -424,6 +424,7 @@ A test program - if the grammar is in a string ``grammar``:
"name",
"name<=1",
"name>=3",
"name>=3,",
"name>=3,<2",
"name@http://foo.com",
"name [fred,bar] @ http://foo.com ; python_version=='2.7'",
Expand Down Expand Up @@ -481,6 +482,9 @@ History
``'.'.join(platform.python_version_tuple()[:2])``, to accommodate potential
future versions of Python with 2-digit major and minor versions
(e.g. 3.10). [#future_versions]_
- June 2024: The definition of ``version_many`` was changed to allow trailing
commas, matching with the behavior of the Python implementation that has been
in use since late 2022.


References
Expand Down
Loading