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
801883a5
Unverified
Commit
801883a5
authored
Mar 17, 2018
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix wheel metadata
parent
c2332f2d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
32 deletions
+56
-32
CHANGELOG.md
+1
-1
poetry/masonry/builders/wheel.py
+31
-27
tests/masonry/builders/test_complete.py
+24
-4
No files found.
CHANGELOG.md
View file @
801883a5
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
### Fixed
### Fixed
-
Fixed wheel entry points being written on a single line.
-
Fixed wheel entry points being written on a single line.
-
Fixed wheel metadata (Tag and Root-Is-Purelib).
## [0.6.0] - 2018-03-16
## [0.6.0] - 2018-03-16
...
...
poetry/masonry/builders/wheel.py
View file @
801883a5
...
@@ -28,8 +28,9 @@ from .builder import Builder
...
@@ -28,8 +28,9 @@ from .builder import Builder
wheel_file_template
=
"""
\
wheel_file_template
=
"""
\
Wheel-Version: 1.0
Wheel-Version: 1.0
Generator: poetry {version}
Generator: poetry {version}
Root-Is-Purelib: true
Root-Is-Purelib: {pure_lib}
"""
.
format
(
version
=
__version__
)
Tag: {tag}
"""
class
WheelBuilder
(
Builder
):
class
WheelBuilder
(
Builder
):
...
@@ -178,28 +179,10 @@ class WheelBuilder(Builder):
...
@@ -178,28 +179,10 @@ class WheelBuilder(Builder):
@property
@property
def
wheel_filename
(
self
)
->
str
:
def
wheel_filename
(
self
)
->
str
:
if
self
.
_package
.
build
:
platform
=
get_platform
()
.
replace
(
'.'
,
'_'
)
.
replace
(
'-'
,
'_'
)
impl_name
=
get_abbr_impl
()
impl_ver
=
get_impl_ver
()
impl
=
impl_name
+
impl_ver
abi_tag
=
str
(
get_abi_tag
())
.
lower
()
tag
=
(
impl
,
abi_tag
,
platform
)
else
:
platform
=
'any'
if
self
.
supports_python2
():
impl
=
'py2.py3'
else
:
impl
=
'py3'
tag
=
(
impl
,
'none'
,
platform
)
tag
=
'-'
.
join
(
tag
)
return
'{}-{}-{}.whl'
.
format
(
return
'{}-{}-{}.whl'
.
format
(
re
.
sub
(
"[^
\
w
\
d.]+"
,
"_"
,
self
.
_package
.
pretty_name
,
flags
=
re
.
UNICODE
),
re
.
sub
(
"[^
\
w
\
d.]+"
,
"_"
,
self
.
_package
.
pretty_name
,
flags
=
re
.
UNICODE
),
re
.
sub
(
"[^
\
w
\
d.]+"
,
"_"
,
self
.
_package
.
version
,
flags
=
re
.
UNICODE
),
re
.
sub
(
"[^
\
w
\
d.]+"
,
"_"
,
self
.
_package
.
version
,
flags
=
re
.
UNICODE
),
tag
self
.
tag
)
)
def
supports_python2
(
self
):
def
supports_python2
(
self
):
...
@@ -216,6 +199,26 @@ class WheelBuilder(Builder):
...
@@ -216,6 +199,26 @@ class WheelBuilder(Builder):
return
'{}-{}.dist-info'
.
format
(
escaped_name
,
escaped_version
)
return
'{}-{}.dist-info'
.
format
(
escaped_name
,
escaped_version
)
@property
def
tag
(
self
):
if
self
.
_package
.
build
:
platform
=
get_platform
()
.
replace
(
'.'
,
'_'
)
.
replace
(
'-'
,
'_'
)
impl_name
=
get_abbr_impl
()
impl_ver
=
get_impl_ver
()
impl
=
impl_name
+
impl_ver
abi_tag
=
str
(
get_abi_tag
())
.
lower
()
tag
=
(
impl
,
abi_tag
,
platform
)
else
:
platform
=
'any'
if
self
.
supports_python2
():
impl
=
'py2.py3'
else
:
impl
=
'py3'
tag
=
(
impl
,
'none'
,
platform
)
return
'-'
.
join
(
tag
)
def
_add_file
(
self
,
full_path
,
rel_path
):
def
_add_file
(
self
,
full_path
,
rel_path
):
full_path
,
rel_path
=
str
(
full_path
),
str
(
rel_path
)
full_path
,
rel_path
=
str
(
full_path
),
str
(
rel_path
)
if
os
.
sep
!=
'/'
:
if
os
.
sep
!=
'/'
:
...
@@ -282,12 +285,13 @@ class WheelBuilder(Builder):
...
@@ -282,12 +285,13 @@ class WheelBuilder(Builder):
fp
.
write
(
'
\n
'
)
fp
.
write
(
'
\n
'
)
def
_write_wheel_file
(
self
,
fp
):
def
_write_wheel_file
(
self
,
fp
):
fp
.
write
(
wheel_file_template
)
fp
.
write
(
wheel_file_template
.
format
(
if
self
.
supports_python2
():
version
=
__version__
,
fp
.
write
(
"Tag: py2-none-any
\n
"
)
pure_lib
=
'true'
if
self
.
_package
.
build
is
None
else
'false'
,
tag
=
self
.
tag
fp
.
write
(
"Tag: py3-none-any
\n
"
)
)
)
def
_write_metadata_file
(
self
,
fp
):
def
_write_metadata_file
(
self
,
fp
):
"""
"""
...
...
tests/masonry/builders/test_complete.py
View file @
801883a5
import
pytest
import
pytest
import
re
import
shutil
import
shutil
import
tarfile
import
tarfile
import
zipfile
import
zipfile
from
pathlib
import
Path
from
pathlib
import
Path
from
poetry
import
__version__
from
poetry
import
Poetry
from
poetry
import
Poetry
from
poetry.io
import
NullIO
from
poetry.io
import
NullIO
from
poetry.masonry.builders
import
CompleteBuilder
from
poetry.masonry.builders
import
CompleteBuilder
...
@@ -53,10 +55,20 @@ def test_wheel_c_extension():
...
@@ -53,10 +55,20 @@ def test_wheel_c_extension():
if
name
.
startswith
(
'extended/extended'
)
and
name
.
endswith
(
'.so'
):
if
name
.
startswith
(
'extended/extended'
)
and
name
.
endswith
(
'.so'
):
has_compiled_extension
=
True
has_compiled_extension
=
True
zip
.
close
()
assert
has_compiled_extension
assert
has_compiled_extension
try
:
wheel_data
=
zip
.
read
(
'extended-0.1.dist-info/WHEEL'
)
.
decode
()
assert
re
.
match
(
"""(?m)^
\
Wheel-Version: 1.0
Generator: poetry {}
Root-Is-Purelib: false
Tag: cp3
\
d-cp3
\
dm-.+
$"""
.
format
(
__version__
),
wheel_data
)
is
not
None
finally
:
zip
.
close
()
def
test_complete
():
def
test_complete
():
module_path
=
fixtures_dir
/
'complete'
module_path
=
fixtures_dir
/
'complete'
...
@@ -72,12 +84,20 @@ def test_complete():
...
@@ -72,12 +84,20 @@ def test_complete():
try
:
try
:
entry_points
=
zip
.
read
(
'my_package-1.2.3.dist-info/entry_points.txt'
)
entry_points
=
zip
.
read
(
'my_package-1.2.3.dist-info/entry_points.txt'
)
print
(
entry_points
.
decode
())
assert
entry_points
.
decode
()
==
"""[console_scripts]
assert
entry_points
.
decode
()
==
"""
\
[console_scripts]
my-2nd-script=my_package:main2
my-2nd-script=my_package:main2
my-script=my_package:main
my-script=my_package:main
"""
"""
wheel_data
=
zip
.
read
(
'my_package-1.2.3.dist-info/WHEEL'
)
.
decode
()
assert
wheel_data
==
f
"""
\
Wheel-Version: 1.0
Generator: poetry {__version__}
Root-Is-Purelib: true
Tag: py3-none-any
"""
finally
:
finally
:
zip
.
close
()
zip
.
close
()
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