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
24da824b
Unverified
Commit
24da824b
authored
Jul 24, 2018
by
Sébastien Eustace
Committed by
Sébastien Eustace
Jul 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of single versions when packaging
parent
434e5409
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
63 additions
and
2 deletions
+63
-2
CHANGELOG.md
+1
-1
poetry/semver/version.py
+5
-1
poetry/version/helpers.py
+11
-0
tests/masonry/builders/fixtures/simple_version/README.rst
+2
-0
tests/masonry/builders/fixtures/simple_version/pyproject.toml
+16
-0
tests/masonry/builders/fixtures/simple_version/simple_version.py
+3
-0
tests/masonry/builders/test_sdist.py
+11
-0
tests/version/test_helpers.py
+14
-0
No files found.
CHANGELOG.md
View file @
24da824b
...
@@ -6,10 +6,10 @@
...
@@ -6,10 +6,10 @@
-
Poetry now only uses
[
TOML Kit
](
https://github.com/sdispater/tomlkit
)
for TOML files manipulation.
-
Poetry now only uses
[
TOML Kit
](
https://github.com/sdispater/tomlkit
)
for TOML files manipulation.
### Fixed
### Fixed
-
Fixed missing dependency information for some packages.
-
Fixed missing dependency information for some packages.
-
Fixed handling of single versions when packaging.
## [0.11.2] - 2018-07-03
## [0.11.2] - 2018-07-03
...
...
poetry/semver/version.py
View file @
24da824b
...
@@ -23,7 +23,7 @@ class Version(VersionRange):
...
@@ -23,7 +23,7 @@ class Version(VersionRange):
pre
=
None
,
# type: Union[str, None]
pre
=
None
,
# type: Union[str, None]
build
=
None
,
# type: Union[str, None]
build
=
None
,
# type: Union[str, None]
text
=
None
,
# type: Union[str, None]
text
=
None
,
# type: Union[str, None]
precision
=
None
,
# type: Union[
str
, None]
precision
=
None
,
# type: Union[
int
, None]
):
# type: () -> None
):
# type: () -> None
self
.
_major
=
int
(
major
)
self
.
_major
=
int
(
major
)
self
.
_precision
=
None
self
.
_precision
=
None
...
@@ -106,6 +106,10 @@ class Version(VersionRange):
...
@@ -106,6 +106,10 @@ class Version(VersionRange):
return
self
.
_text
return
self
.
_text
@property
@property
def
precision
(
self
):
# type: () -> int
return
self
.
_precision
@property
def
stable
(
self
):
def
stable
(
self
):
if
not
self
.
is_prerelease
():
if
not
self
.
is_prerelease
():
return
self
return
self
...
...
poetry/version/helpers.py
View file @
24da824b
from
poetry.semver
import
parse_constraint
from
poetry.semver
import
parse_constraint
from
poetry.semver
import
Version
from
poetry.semver
import
VersionUnion
from
poetry.semver
import
VersionUnion
PYTHON_VERSION
=
[
PYTHON_VERSION
=
[
...
@@ -20,6 +21,16 @@ def format_python_constraint(constraint):
...
@@ -20,6 +21,16 @@ def format_python_constraint(constraint):
This helper will help in transforming
This helper will help in transforming
disjunctive constraint into proper constraint.
disjunctive constraint into proper constraint.
"""
"""
if
isinstance
(
constraint
,
Version
)
and
constraint
.
precision
<
3
:
# Transform 3.6 or 3
if
constraint
.
precision
==
2
:
# 3.6
constraint
=
parse_constraint
(
"~{}.{}"
.
format
(
constraint
.
major
,
constraint
.
minor
)
)
else
:
constraint
=
parse_constraint
(
"^{}.0"
.
format
(
constraint
.
major
))
if
not
isinstance
(
constraint
,
VersionUnion
):
if
not
isinstance
(
constraint
,
VersionUnion
):
return
str
(
constraint
)
return
str
(
constraint
)
...
...
tests/masonry/builders/fixtures/simple_version/README.rst
0 → 100644
View file @
24da824b
Module 1
========
tests/masonry/builders/fixtures/simple_version/pyproject.toml
0 → 100644
View file @
24da824b
[tool.poetry]
name
=
"simple-version"
version
=
"0.1"
description
=
"Some description."
authors
=
[
"Sébastien Eustace <sebastien@eustace.io>"
]
license
=
"MIT"
readme
=
"README.rst"
homepage
=
"https://poetry.eustace.io/"
[tool.poetry.dependencies]
python
=
"3.6"
tests/masonry/builders/fixtures/simple_version/simple_version.py
0 → 100644
View file @
24da824b
"""Example module"""
__version__
=
"0.1"
tests/masonry/builders/test_sdist.py
View file @
24da824b
...
@@ -395,3 +395,14 @@ def test_package_with_include(mocker):
...
@@ -395,3 +395,14 @@ def test_package_with_include(mocker):
assert
"with-include-1.2.3/pyproject.toml"
in
names
assert
"with-include-1.2.3/pyproject.toml"
in
names
assert
"with-include-1.2.3/setup.py"
in
names
assert
"with-include-1.2.3/setup.py"
in
names
assert
"with-include-1.2.3/PKG-INFO"
in
names
assert
"with-include-1.2.3/PKG-INFO"
in
names
def
test_proper_python_requires_if_single_version_specified
():
poetry
=
Poetry
.
create
(
project
(
"simple_version"
))
builder
=
SdistBuilder
(
poetry
,
NullVenv
(),
NullIO
())
pkg_info
=
builder
.
build_pkg_info
()
p
=
Parser
()
parsed
=
p
.
parsestr
(
to_str
(
pkg_info
))
assert
parsed
[
"Requires-Python"
]
==
">=3.6,<3.7"
tests/version/test_helpers.py
View file @
24da824b
...
@@ -8,3 +8,17 @@ def test_format_python_constraint():
...
@@ -8,3 +8,17 @@ def test_format_python_constraint():
result
=
format_python_constraint
(
constraint
)
result
=
format_python_constraint
(
constraint
)
assert
result
==
">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
assert
result
==
">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
def
test_format_python_constraint_single_version
():
constraint
=
parse_constraint
(
"3.6"
)
result
=
format_python_constraint
(
constraint
)
assert
result
==
">=3.6,<3.7"
constraint
=
parse_constraint
(
"3"
)
result
=
format_python_constraint
(
constraint
)
assert
result
==
">=3.0,<4.0"
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