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
a50b9a7e
Unverified
Commit
a50b9a7e
authored
Jun 28, 2018
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix keys and array order in lock file
parent
c0283e96
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
26 deletions
+37
-26
CHANGELOG.md
+1
-0
poetry/masonry/publishing/publisher.py
+5
-8
poetry/packages/locker.py
+16
-3
poetry/utils/toml_file.py
+8
-3
pyproject.toml
+1
-1
tests/installation/test_installer.py
+3
-6
tests/test_poetry.py
+3
-5
No files found.
CHANGELOG.md
View file @
a50b9a7e
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
-
Fixed
`remove`
command's case sensitivity. (Thanks to
[
@cauebs
](
https://github.com/cauebs
)
)
-
Fixed
`remove`
command's case sensitivity. (Thanks to
[
@cauebs
](
https://github.com/cauebs
)
)
-
Fixed detection of
`.egg-info`
directory for non-poetry projects. (Thanks to
[
@gtors
](
https://github.com/gtors
)
)
-
Fixed detection of
`.egg-info`
directory for non-poetry projects. (Thanks to
[
@gtors
](
https://github.com/gtors
)
)
-
Fixed only-wheel builds. (Thanks to
[
@gtors
](
https://github.com/gtors
)
)
-
Fixed only-wheel builds. (Thanks to
[
@gtors
](
https://github.com/gtors
)
)
-
Fixed key and array order in lock file to avoid having differences when relocking.
## [0.10.3] - 2018-06-04
## [0.10.3] - 2018-06-04
...
...
poetry/masonry/publishing/publisher.py
View file @
a50b9a7e
import
toml
from
poetry.locations
import
CONFIG_DIR
from
poetry.locations
import
CONFIG_DIR
from
poetry.utils._compat
import
Path
from
poetry.utils._compat
import
Path
from
poetry.utils.toml_file
import
TomlFile
from
.uploader
import
Uploader
from
.uploader
import
Uploader
...
@@ -44,7 +43,7 @@ class Publisher:
...
@@ -44,7 +43,7 @@ class Publisher:
repository_name
=
"pypi"
repository_name
=
"pypi"
else
:
else
:
# Retrieving config information
# Retrieving config information
config_file
=
Path
(
CONFIG_DIR
)
/
"config.toml"
config_file
=
TomlFile
(
Path
(
CONFIG_DIR
)
/
"config.toml"
)
if
not
config_file
.
exists
():
if
not
config_file
.
exists
():
raise
RuntimeError
(
raise
RuntimeError
(
...
@@ -52,8 +51,7 @@ class Publisher:
...
@@ -52,8 +51,7 @@ class Publisher:
"Unable to get repository information"
"Unable to get repository information"
)
)
with
config_file
.
open
()
as
f
:
config
=
config_file
.
read
(
raw
=
True
)
config
=
toml
.
loads
(
f
.
read
())
if
(
if
(
"repositories"
not
in
config
"repositories"
not
in
config
...
@@ -66,10 +64,9 @@ class Publisher:
...
@@ -66,10 +64,9 @@ class Publisher:
url
=
config
[
"repositories"
][
repository_name
][
"url"
]
url
=
config
[
"repositories"
][
repository_name
][
"url"
]
if
not
(
username
and
password
):
if
not
(
username
and
password
):
auth_file
=
Path
(
CONFIG_DIR
)
/
"auth.toml"
auth_file
=
TomlFile
(
Path
(
CONFIG_DIR
)
/
"auth.toml"
)
if
auth_file
.
exists
():
if
auth_file
.
exists
():
with
auth_file
.
open
()
as
f
:
auth_config
=
auth_file
.
read
(
raw
=
True
)
auth_config
=
toml
.
loads
(
f
.
read
())
if
(
if
(
"http-basic"
in
auth_config
"http-basic"
in
auth_config
...
...
poetry/packages/locker.py
View file @
a50b9a7e
...
@@ -140,7 +140,18 @@ class Locker:
...
@@ -140,7 +140,18 @@ class Locker:
return
False
return
False
def
_write_lock_data
(
self
,
data
):
def
_write_lock_data
(
self
,
data
):
self
.
_lock
.
write
(
data
)
# We want a clean lock file so we write
# packages first and metadata after
with
self
.
_lock
.
open
(
"w"
,
encoding
=
"utf-8"
)
as
f
:
f
.
write
(
self
.
_lock
.
dumps
({
"package"
:
data
[
"package"
]},
sort
=
True
))
f
.
write
(
"
\n
"
)
if
"extras"
in
data
:
f
.
write
(
self
.
_lock
.
dumps
({
"extras"
:
data
[
"extras"
]},
sort
=
True
))
f
.
write
(
"
\n
"
)
f
.
write
(
self
.
_lock
.
dumps
({
"metadata"
:
data
[
"metadata"
]},
sort
=
True
))
f
.
write
(
"
\n
"
)
self
.
_lock_data
=
None
self
.
_lock_data
=
None
def
_get_content_hash
(
self
):
# type: () -> str
def
_get_content_hash
(
self
):
# type: () -> str
...
@@ -211,10 +222,12 @@ class Locker:
...
@@ -211,10 +222,12 @@ class Locker:
"optional"
:
package
.
optional
,
"optional"
:
package
.
optional
,
"python-versions"
:
package
.
python_versions
,
"python-versions"
:
package
.
python_versions
,
"platform"
:
package
.
platform
,
"platform"
:
package
.
platform
,
"hashes"
:
package
.
hashes
,
"hashes"
:
sorted
(
package
.
hashes
),
"dependencies"
:
dependencies
,
}
}
if
dependencies
:
data
[
"dependencies"
]
=
dependencies
if
package
.
source_type
:
if
package
.
source_type
:
data
[
"source"
]
=
{
data
[
"source"
]
=
{
"type"
:
package
.
source_type
,
"type"
:
package
.
source_type
,
...
...
poetry/utils/toml_file.py
View file @
a50b9a7e
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
toml
import
pytoml
as
toml
from
poetry.toml
import
dumps
from
poetry.toml
import
dumps
from
poetry.toml
import
loads
from
poetry.toml
import
loads
...
@@ -23,12 +23,17 @@ class TomlFile:
...
@@ -23,12 +23,17 @@ class TomlFile:
return
loads
(
f
.
read
())
return
loads
(
f
.
read
())
def
write
(
self
,
data
):
# type: (...) -> None
def
dumps
(
self
,
data
,
sort
=
False
):
# type: (...) -> str
if
not
isinstance
(
data
,
TOMLFile
):
if
not
isinstance
(
data
,
TOMLFile
):
data
=
toml
.
dumps
(
data
)
data
=
toml
.
dumps
(
data
,
sort_keys
=
sort
)
else
:
else
:
data
=
dumps
(
data
)
data
=
dumps
(
data
)
return
data
def
write
(
self
,
data
,
sort
=
False
):
# type: (...) -> None
data
=
self
.
dumps
(
data
,
sort
=
sort
)
with
self
.
_path
.
open
(
"w"
,
encoding
=
"utf-8"
)
as
f
:
with
self
.
_path
.
open
(
"w"
,
encoding
=
"utf-8"
)
as
f
:
f
.
write
(
data
)
f
.
write
(
data
)
...
...
pyproject.toml
View file @
a50b9a7e
...
@@ -24,8 +24,8 @@ classifiers = [
...
@@ -24,8 +24,8 @@ classifiers = [
[tool.poetry.dependencies]
[tool.poetry.dependencies]
python
=
"~2.7 || ^3.4"
python
=
"~2.7 || ^3.4"
cleo
=
"^0.6.7"
cleo
=
"^0.6.7"
pytoml
=
"^0.1.16"
requests
=
"^2.18"
requests
=
"^2.18"
toml
=
"^0.9"
cachy
=
"^0.2"
cachy
=
"^0.2"
requests-toolbelt
=
"^0.8.0"
requests-toolbelt
=
"^0.8.0"
jsonschema
=
"^2.6"
jsonschema
=
"^2.6"
...
...
tests/installation/test_installer.py
View file @
a50b9a7e
...
@@ -3,7 +3,6 @@ from __future__ import unicode_literals
...
@@ -3,7 +3,6 @@ from __future__ import unicode_literals
import
sys
import
sys
import
pytest
import
pytest
import
toml
from
poetry.installation
import
Installer
as
BaseInstaller
from
poetry.installation
import
Installer
as
BaseInstaller
from
poetry.installation.noop_installer
import
NoopInstaller
from
poetry.installation.noop_installer
import
NoopInstaller
...
@@ -15,6 +14,7 @@ from poetry.repositories import Repository
...
@@ -15,6 +14,7 @@ from poetry.repositories import Repository
from
poetry.repositories.installed_repository
import
InstalledRepository
from
poetry.repositories.installed_repository
import
InstalledRepository
from
poetry.utils._compat
import
Path
from
poetry.utils._compat
import
Path
from
poetry.utils._compat
import
PY2
from
poetry.utils._compat
import
PY2
from
poetry.utils.toml_file
import
TomlFile
from
poetry.utils.venv
import
NullVenv
from
poetry.utils.venv
import
NullVenv
from
tests.helpers
import
get_dependency
from
tests.helpers
import
get_dependency
...
@@ -76,8 +76,6 @@ class Locker(BaseLocker):
...
@@ -76,8 +76,6 @@ class Locker(BaseLocker):
package
[
"python-versions"
]
=
python_versions
package
[
"python-versions"
]
=
python_versions
package
[
"platform"
]
=
platform
package
[
"platform"
]
=
platform
if
not
package
[
"dependencies"
]:
del
package
[
"dependencies"
]
self
.
_written_data
=
data
self
.
_written_data
=
data
...
@@ -133,10 +131,9 @@ def installer(package, pool, locker, venv, installed):
...
@@ -133,10 +131,9 @@ def installer(package, pool, locker, venv, installed):
def
fixture
(
name
):
def
fixture
(
name
):
file
=
Path
(
__file__
)
.
parent
/
"fixtures"
/
"{}.test"
.
format
(
name
)
file
=
TomlFile
(
Path
(
__file__
)
.
parent
/
"fixtures"
/
"{}.test"
.
format
(
name
)
)
with
file
.
open
()
as
f
:
return
file
.
read
(
raw
=
True
)
return
toml
.
loads
(
f
.
read
())
def
test_run_no_dependencies
(
installer
,
locker
):
def
test_run_no_dependencies
(
installer
,
locker
):
...
...
tests/test_poetry.py
View file @
a50b9a7e
...
@@ -2,10 +2,9 @@
...
@@ -2,10 +2,9 @@
from
__future__
import
absolute_import
from
__future__
import
absolute_import
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
import
toml
from
poetry.poetry
import
Poetry
from
poetry.poetry
import
Poetry
from
poetry.utils._compat
import
Path
from
poetry.utils._compat
import
Path
from
poetry.utils.toml_file
import
TomlFile
fixtures_dir
=
Path
(
__file__
)
.
parent
/
"fixtures"
fixtures_dir
=
Path
(
__file__
)
.
parent
/
"fixtures"
...
@@ -122,8 +121,7 @@ def test_poetry_with_packages_and_includes():
...
@@ -122,8 +121,7 @@ def test_poetry_with_packages_and_includes():
def
test_check
():
def
test_check
():
complete
=
fixtures_dir
/
"complete.toml"
complete
=
TomlFile
(
fixtures_dir
/
"complete.toml"
)
with
complete
.
open
()
as
f
:
content
=
complete
.
read
(
raw
=
True
)[
"tool"
][
"poetry"
]
content
=
toml
.
loads
(
f
.
read
())[
"tool"
][
"poetry"
]
assert
Poetry
.
check
(
content
)
assert
Poetry
.
check
(
content
)
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