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
2d8ea84a
Commit
2d8ea84a
authored
May 27, 2022
by
Arun Babu Neelicattu
Committed by
Bjorn Neergaard
May 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
masonry: write PEP 610 metadata for editable builds
parent
e4e5497e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
src/poetry/masonry/builders/editable.py
+13
-0
tests/masonry/builders/test_editable_builder.py
+12
-0
No files found.
src/poetry/masonry/builders/editable.py
View file @
2d8ea84a
from
__future__
import
annotations
import
hashlib
import
json
import
os
import
shutil
...
...
@@ -241,6 +242,18 @@ class EditableBuilder(Builder):
added_files
.
append
(
dist_info
.
joinpath
(
"entry_points.txt"
))
# write PEP 610 metadata
direct_url_json
=
dist_info
.
joinpath
(
"direct_url.json"
)
direct_url_json
.
write_text
(
json
.
dumps
(
{
"dir_info"
:
{
"editable"
:
True
},
"url"
:
self
.
_poetry
.
file
.
path
.
parent
.
as_uri
(),
}
)
)
added_files
.
append
(
direct_url_json
)
record
=
dist_info
.
joinpath
(
"RECORD"
)
with
record
.
open
(
"w"
,
encoding
=
"utf-8"
)
as
f
:
for
path
in
added_files
:
...
...
tests/masonry/builders/test_editable_builder.py
View file @
2d8ea84a
from
__future__
import
annotations
import
json
import
os
import
shutil
...
...
@@ -9,6 +10,7 @@ from typing import TYPE_CHECKING
import
pytest
from
cleo.io.null_io
import
NullIO
from
deepdiff
import
DeepDiff
from
poetry.factory
import
Factory
from
poetry.masonry.builders.editable
import
EditableBuilder
...
...
@@ -105,6 +107,15 @@ def test_builder_installs_proper_files_for_standard_packages(
assert
dist_info
.
joinpath
(
"METADATA"
)
.
exists
()
assert
dist_info
.
joinpath
(
"RECORD"
)
.
exists
()
assert
dist_info
.
joinpath
(
"entry_points.txt"
)
.
exists
()
assert
dist_info
.
joinpath
(
"direct_url.json"
)
.
exists
()
assert
not
DeepDiff
(
{
"dir_info"
:
{
"editable"
:
True
},
"url"
:
simple_poetry
.
file
.
path
.
parent
.
as_uri
(),
},
json
.
loads
(
dist_info
.
joinpath
(
"direct_url.json"
)
.
read_text
()),
)
assert
dist_info
.
joinpath
(
"INSTALLER"
)
.
read_text
()
==
"poetry"
assert
(
...
...
@@ -157,6 +168,7 @@ My Package
assert
str
(
dist_info
.
joinpath
(
"INSTALLER"
))
in
records
assert
str
(
dist_info
.
joinpath
(
"entry_points.txt"
))
in
records
assert
str
(
dist_info
.
joinpath
(
"RECORD"
))
in
records
assert
str
(
dist_info
.
joinpath
(
"direct_url.json"
))
in
records
baz_script
=
f
"""
\
#!{tmp_venv.python}
...
...
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