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
c55d55a8
Unverified
Commit
c55d55a8
authored
May 31, 2018
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of PEP 440 ~= version constraint
parent
19006330
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
1 deletions
+29
-1
CHANGELOG.md
+1
-0
poetry/semver/__init__.py
+23
-0
poetry/semver/patterns.py
+2
-1
tests/semver/test_main.py
+3
-0
No files found.
CHANGELOG.md
View file @
c55d55a8
...
...
@@ -10,6 +10,7 @@
-
Fixed terminal coloring being activated even if not supported.
-
Fixed wrong executable being picked up on Windows in
`poetry run`
.
-
Fixed error when listing distribution links for private repositories.
-
Fixed handling of PEP 440
`~=`
version constraint.
## [0.10.1] - 2018-05-28
...
...
poetry/semver/__init__.py
View file @
c55d55a8
...
...
@@ -4,6 +4,7 @@ from .empty_constraint import EmptyConstraint
from
.patterns
import
BASIC_CONSTRAINT
from
.patterns
import
CARET_CONSTRAINT
from
.patterns
import
TILDE_CONSTRAINT
from
.patterns
import
TILDE_PEP440_CONSTRAINT
from
.patterns
import
X_CONSTRAINT
from
.version
import
Version
from
.version_constraint
import
VersionConstraint
...
...
@@ -59,6 +60,28 @@ def parse_single_constraint(constraint): # type: (str) -> VersionConstraint
high
=
version
.
stable
.
next_major
return
VersionRange
(
version
,
high
,
include_min
=
True
)
return
VersionRange
()
# PEP 440 Tilde range (~=)
m
=
TILDE_PEP440_CONSTRAINT
.
match
(
constraint
)
if
m
:
precision
=
1
if
m
.
group
(
3
):
precision
+=
1
if
m
.
group
(
4
):
precision
+=
1
version
=
Version
.
parse
(
m
.
group
(
1
))
if
precision
==
2
:
low
=
version
high
=
version
.
stable
.
next_major
else
:
low
=
Version
(
version
.
major
,
version
.
minor
,
0
)
high
=
version
.
stable
.
next_minor
return
VersionRange
(
low
,
high
,
include_min
=
True
)
# Caret range
m
=
CARET_CONSTRAINT
.
match
(
constraint
)
...
...
poetry/semver/patterns.py
View file @
c55d55a8
...
...
@@ -11,7 +11,8 @@ _COMPLETE_VERSION = "v?(\d+)(?:\.(\d+))?(?:\.(\d+))?{}(?:\+[^\s]+)?".format(MODI
COMPLETE_VERSION
=
re
.
compile
(
"(?i)"
+
_COMPLETE_VERSION
)
CARET_CONSTRAINT
=
re
.
compile
(
"(?i)^
\
^({})$"
.
format
(
_COMPLETE_VERSION
))
TILDE_CONSTRAINT
=
re
.
compile
(
"(?i)^~=?({})$"
.
format
(
_COMPLETE_VERSION
))
TILDE_CONSTRAINT
=
re
.
compile
(
"(?i)^~(?!=)({})$"
.
format
(
_COMPLETE_VERSION
))
TILDE_PEP440_CONSTRAINT
=
re
.
compile
(
"(?i)^~=({})$"
.
format
(
_COMPLETE_VERSION
))
X_CONSTRAINT
=
re
.
compile
(
"^(!= ?|==)?v?(
\
d+)(?:
\
.(
\
d+))?(?:
\
.(
\
d+))?(?:
\
.[xX*])+$"
)
BASIC_CONSTRAINT
=
re
.
compile
(
"(?i)^(<>|!=|>=?|<=?|==?)?
\
s*({})"
.
format
(
_COMPLETE_VERSION
)
...
...
tests/semver/test_main.py
View file @
c55d55a8
...
...
@@ -60,6 +60,9 @@ def test_parse_constraint_wildcard(input, constraint):
(
"~1.2-beta"
,
VersionRange
(
Version
(
1
,
2
,
0
,
"beta"
),
Version
(
1
,
3
,
0
),
True
)),
(
"~1.2-b2"
,
VersionRange
(
Version
(
1
,
2
,
0
,
"b2"
),
Version
(
1
,
3
,
0
),
True
)),
(
"~0.3"
,
VersionRange
(
Version
(
0
,
3
,
0
),
Version
(
0
,
4
,
0
),
True
)),
(
"~3.5"
,
VersionRange
(
Version
(
3
,
5
,
0
),
Version
(
3
,
6
,
0
),
True
)),
(
"~=3.5"
,
VersionRange
(
Version
(
3
,
5
,
0
),
Version
(
4
,
0
,
0
),
True
)),
# PEP 440
(
"~=3.5.3"
,
VersionRange
(
Version
(
3
,
5
,
0
),
Version
(
3
,
6
,
0
),
True
)),
# PEP 440
],
)
def
test_parse_constraint_tilde
(
input
,
constraint
):
...
...
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