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
e03c2d24
Commit
e03c2d24
authored
Sep 30, 2020
by
Arun Babu Neelicattu
Committed by
finswimmer
Oct 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
layout: make original toml content optional
parent
258ba299
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
poetry/console/commands/init.py
+1
-1
poetry/layouts/layout.py
+6
-3
No files found.
poetry/console/commands/init.py
View file @
e03c2d24
...
@@ -209,7 +209,7 @@ The <c1>init</c1> command creates a basic <comment>pyproject.toml</> file in the
...
@@ -209,7 +209,7 @@ The <c1>init</c1> command creates a basic <comment>pyproject.toml</> file in the
dev_dependencies
=
dev_requirements
,
dev_dependencies
=
dev_requirements
,
)
)
content
=
layout_
.
generate_poetry_content
(
pyproject
)
content
=
layout_
.
generate_poetry_content
(
original
=
pyproject
)
if
self
.
io
.
is_interactive
():
if
self
.
io
.
is_interactive
():
self
.
line
(
"<info>Generated file</info>"
)
self
.
line
(
"<info>Generated file</info>"
)
self
.
line
(
""
)
self
.
line
(
""
)
...
...
poetry/layouts/layout.py
View file @
e03c2d24
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
typing
import
Optional
from
tomlkit
import
dumps
from
tomlkit
import
dumps
from
tomlkit
import
loads
from
tomlkit
import
loads
...
@@ -86,7 +87,9 @@ class Layout(object):
...
@@ -86,7 +87,9 @@ class Layout(object):
self
.
_write_poetry
(
path
)
self
.
_write_poetry
(
path
)
def
generate_poetry_content
(
self
,
original_toml
):
# type: ("PyProjectTOML") -> str
def
generate_poetry_content
(
self
,
original
=
None
):
# type: (Optional["PyProjectTOML"]) -> str
template
=
POETRY_DEFAULT
template
=
POETRY_DEFAULT
if
self
.
_license
:
if
self
.
_license
:
template
=
POETRY_WITH_LICENSE
template
=
POETRY_WITH_LICENSE
...
@@ -121,8 +124,8 @@ class Layout(object):
...
@@ -121,8 +124,8 @@ class Layout(object):
content
=
dumps
(
content
)
content
=
dumps
(
content
)
if
original
_tom
l
.
file
.
exists
():
if
original
and
origina
l
.
file
.
exists
():
content
=
dumps
(
original
_toml
.
data
)
+
"
\n
"
+
content
content
=
dumps
(
original
.
data
)
+
"
\n
"
+
content
return
content
return
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