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
a22683a8
Unverified
Commit
a22683a8
authored
Apr 03, 2018
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix new command creating invalid pyproject.toml files
parent
7ae77fd7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
29 deletions
+26
-29
CHANGELOG.md
+1
-0
poetry/console/commands/new.py
+2
-2
poetry/layouts/layout.py
+23
-27
No files found.
CHANGELOG.md
View file @
a22683a8
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
-
Fixed handling of markers with the
`in`
operator.
-
Fixed handling of markers with the
`in`
operator.
-
Fixed
`update`
not properly adding new packages to the lock file.
-
Fixed
`update`
not properly adding new packages to the lock file.
-
Fixed solver adding uninstall operations for non-installed packages.
-
Fixed solver adding uninstall operations for non-installed packages.
-
Fixed
`new`
command creating invalid
`pyproject.toml`
files.
## [0.6.5] - 2018-03-22
## [0.6.5] - 2018-03-22
...
...
poetry/console/commands/new.py
View file @
a22683a8
from
pathlib
import
Path
from
pathlib
import
Path
from
poetry.layouts
import
layout
from
.command
import
Command
from
.command
import
Command
...
@@ -15,6 +13,8 @@ class NewCommand(Command):
...
@@ -15,6 +13,8 @@ class NewCommand(Command):
"""
"""
def
handle
(
self
):
def
handle
(
self
):
from
poetry.layouts
import
layout
layout_
=
layout
(
'standard'
)
layout_
=
layout
(
'standard'
)
path
=
Path
.
cwd
()
/
Path
(
self
.
argument
(
'path'
))
path
=
Path
.
cwd
()
/
Path
(
self
.
argument
(
'path'
))
...
...
poetry/layouts/layout.py
View file @
a22683a8
import
toml
from
poetry.toml
import
dumps
from
poetry.toml
import
loads
from
poetry.utils.helpers
import
module_name
from
poetry.utils.helpers
import
module_name
from
poetry.vcs.git
import
Git
from
poetry.vcs.git
import
Git
...
@@ -12,6 +12,21 @@ def test_version():
...
@@ -12,6 +12,21 @@ def test_version():
"""
"""
POETRY_DEFAULT
=
"""
\
[tool.poetry]
name = ""
version = ""
description = ""
authors = []
[tool.poetry.dependencies]
python = "*"
[tool.poetry.dev-dependencies]
pytest = "^3.5"
"""
class
Layout
(
object
):
class
Layout
(
object
):
def
__init__
(
self
,
project
,
version
=
'0.1.0'
,
readme_format
=
'md'
,
author
=
None
):
def
__init__
(
self
,
project
,
version
=
'0.1.0'
,
readme_format
=
'md'
,
author
=
None
):
...
@@ -84,32 +99,13 @@ class Layout(object):
...
@@ -84,32 +99,13 @@ class Layout(object):
)
)
def
_write_poetry
(
self
,
path
):
def
_write_poetry
(
self
,
path
):
output
=
{
content
=
loads
(
POETRY_DEFAULT
)
'tool'
:
{
poetry_content
=
content
[
'tool'
][
'poetry'
]
'poetry'
:
{
poetry_content
[
'name'
]
=
self
.
_project
'name'
:
self
.
_project
,
poetry_content
[
'version'
]
=
self
.
_version
'version'
:
self
.
_version
,
poetry_content
[
'authors'
]
.
append
(
self
.
_author
)
'authors'
:
[
self
.
_author
],
}
}
}
content
=
toml
.
dumps
(
output
,
preserve
=
True
)
output
=
{
'tool'
:
{
'poetry'
:
{
'dependencies'
:
{},
'dev-dependencies'
:
{
'pytest'
:
'^3.4'
}
}
}
}
content
+=
'
\n
'
+
toml
.
dumps
(
output
,
preserve
=
True
)
poetry
=
path
/
'pyproject.toml'
poetry
=
path
/
'pyproject.toml'
with
poetry
.
open
(
'w'
)
as
f
:
with
poetry
.
open
(
'w'
)
as
f
:
f
.
write
(
content
)
f
.
write
(
dumps
(
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