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
b309a748
Unverified
Commit
b309a748
authored
Oct 25, 2019
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Dependency.to_pep508() for inequality specifiers
parent
d12f6421
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
poetry/packages/dependency.py
+4
-3
poetry/semver/version_union.py
+2
-2
tests/packages/test_dependency.py
+6
-0
No files found.
poetry/packages/dependency.py
View file @
b309a748
...
@@ -144,9 +144,10 @@ class Dependency(object):
...
@@ -144,9 +144,10 @@ class Dependency(object):
requirement
+=
"[{}]"
.
format
(
","
.
join
(
self
.
extras
))
requirement
+=
"[{}]"
.
format
(
","
.
join
(
self
.
extras
))
if
isinstance
(
self
.
constraint
,
VersionUnion
):
if
isinstance
(
self
.
constraint
,
VersionUnion
):
requirement
+=
" ({})"
.
format
(
if
self
.
constraint
.
excludes_single_version
():
","
.
join
([
str
(
c
)
.
replace
(
" "
,
""
)
for
c
in
self
.
constraint
.
ranges
])
requirement
+=
" ({})"
.
format
(
str
(
self
.
constraint
))
)
else
:
requirement
+=
" ({})"
.
format
(
self
.
pretty_constraint
)
elif
isinstance
(
self
.
constraint
,
Version
):
elif
isinstance
(
self
.
constraint
,
Version
):
requirement
+=
" (=={})"
.
format
(
self
.
constraint
.
text
)
requirement
+=
" (=={})"
.
format
(
self
.
constraint
.
text
)
elif
not
self
.
constraint
.
is_any
():
elif
not
self
.
constraint
.
is_any
():
...
...
poetry/semver/version_union.py
View file @
b309a748
...
@@ -228,7 +228,7 @@ class VersionUnion(VersionConstraint):
...
@@ -228,7 +228,7 @@ class VersionUnion(VersionConstraint):
raise
ValueError
(
"Unknown VersionConstraint type {}"
.
format
(
constraint
))
raise
ValueError
(
"Unknown VersionConstraint type {}"
.
format
(
constraint
))
def
_
excludes_single_version
(
self
):
# type: () -> bool
def
excludes_single_version
(
self
):
# type: () -> bool
from
.version
import
Version
from
.version
import
Version
from
.version_range
import
VersionRange
from
.version_range
import
VersionRange
...
@@ -243,7 +243,7 @@ class VersionUnion(VersionConstraint):
...
@@ -243,7 +243,7 @@ class VersionUnion(VersionConstraint):
def
__str__
(
self
):
def
__str__
(
self
):
from
.version_range
import
VersionRange
from
.version_range
import
VersionRange
if
self
.
_
excludes_single_version
():
if
self
.
excludes_single_version
():
return
"!={}"
.
format
(
VersionRange
()
.
difference
(
self
))
return
"!={}"
.
format
(
VersionRange
()
.
difference
(
self
))
return
" || "
.
join
([
str
(
r
)
for
r
in
self
.
_ranges
])
return
" || "
.
join
([
str
(
r
)
for
r
in
self
.
_ranges
])
...
...
tests/packages/test_dependency.py
View file @
b309a748
...
@@ -102,3 +102,9 @@ def test_to_pep_508_in_extras():
...
@@ -102,3 +102,9 @@ def test_to_pep_508_in_extras():
") "
") "
'and (extra == "foo" or extra == "bar")'
'and (extra == "foo" or extra == "bar")'
)
)
def
test_to_pep_508_with_single_version_excluded
():
dependency
=
Dependency
(
"foo"
,
"!=1.2.3"
)
assert
"foo (!=1.2.3)"
==
dependency
.
to_pep_508
()
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