Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
e2ca0611
Unverified
Commit
e2ca0611
authored
Mar 23, 2019
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix parsing of platform_release markers
parent
d792134b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
poetry/version/markers.py
+3
-2
poetry/version/requirements.py
+2
-2
tests/version/test_markers.py
+15
-0
No files found.
poetry/version/markers.py
View file @
e2ca0611
...
...
@@ -230,6 +230,7 @@ class EmptyMarker(BaseMarker):
class
SingleMarker
(
BaseMarker
):
_CONSTRAINT_RE
=
re
.
compile
(
r"(?i)^(~=|!=|>=?|<=?|==?|in|not in)?\s*(.+)$"
)
_VERSION_LIKE_MARKER_NAME
=
{
"python_version"
,
"platform_release"
}
def
__init__
(
self
,
name
,
constraint
):
from
poetry.packages.constraints
import
(
...
...
@@ -248,10 +249,10 @@ class SingleMarker(BaseMarker):
self
.
_value
=
m
.
group
(
2
)
self
.
_parser
=
parse_generic_constraint
if
self
.
_name
==
"python_version"
:
if
name
in
self
.
_VERSION_LIKE_MARKER_NAME
:
self
.
_parser
=
parse_constraint
if
name
==
"python_version"
:
if
self
.
_operator
in
{
"in"
,
"not in"
}:
versions
=
[]
for
v
in
re
.
split
(
"[ ,]+"
,
self
.
_value
):
...
...
poetry/version/requirements.py
View file @
e2ca0611
...
...
@@ -174,8 +174,8 @@ MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
MARKER_EXPR
.
setParseAction
(
lambda
s
,
l
,
t
:
parse_marker
(
s
[
t
.
_original_start
:
t
.
_original_end
])
)
MARKER_SEP
E
RATOR
=
SEMICOLON
MARKER
=
MARKER_SEP
E
RATOR
+
MARKER_EXPR
MARKER_SEP
A
RATOR
=
SEMICOLON
MARKER
=
MARKER_SEP
A
RATOR
+
MARKER_EXPR
VERSION_AND_MARKER
=
VERSION_SPEC
+
Optional
(
MARKER
)
URL_AND_MARKER
=
URL
+
Optional
(
MARKER
)
...
...
tests/version/test_markers.py
View file @
e2ca0611
...
...
@@ -423,3 +423,18 @@ def test_validate(marker_string, environment, expected):
m
=
parse_marker
(
marker_string
)
assert
m
.
validate
(
environment
)
is
expected
@pytest.mark.parametrize
(
"marker, env"
,
[
(
'platform_release >= "9.0" and platform_release < "11.0"'
,
{
"platform_release"
:
"10.0"
},
)
],
)
def
test_parse_version_like_markers
(
marker
,
env
):
m
=
parse_marker
(
marker
)
assert
m
.
validate
(
env
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment