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
bdcffe5c
Unverified
Commit
bdcffe5c
authored
Nov 05, 2018
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a KeyError when getting package information from sdist
parent
a2cf6acd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
1 deletions
+49
-1
CHANGELOG.md
+1
-0
poetry/repositories/pypi_repository.py
+3
-1
tests/repositories/fixtures/legacy/jupyter.html
+11
-0
tests/repositories/test_legacy_repository.py
+34
-0
No files found.
CHANGELOG.md
View file @
bdcffe5c
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
### Fixed
### Fixed
-
Fixed reading of some
`setup.py`
files.
-
Fixed reading of some
`setup.py`
files.
-
Fixed a
`KeyError`
when getting information for packages which require reading setup files.
## [0.12.6] - 2018-11-05
## [0.12.6] - 2018-11-05
...
...
poetry/repositories/pypi_repository.py
View file @
bdcffe5c
...
@@ -506,7 +506,9 @@ class PyPiRepository(Repository):
...
@@ -506,7 +506,9 @@ class PyPiRepository(Repository):
# Still nothing, try reading (without executing it)
# Still nothing, try reading (without executing it)
# the setup.py file.
# the setup.py file.
try
:
try
:
return
self
.
_inspect_sdist_with_setup
(
sdist_dir
)
info
.
update
(
self
.
_inspect_sdist_with_setup
(
sdist_dir
))
return
info
except
Exception
as
e
:
except
Exception
as
e
:
self
.
_log
(
self
.
_log
(
"An error occurred when reading setup.py or setup.cfg: {}"
.
format
(
"An error occurred when reading setup.py or setup.cfg: {}"
.
format
(
...
...
tests/repositories/fixtures/legacy/jupyter.html
0 → 100644
View file @
bdcffe5c
<!DOCTYPE html>
<html>
<head>
<title>
Links for jupyter
</title>
</head>
<body>
<h1>
Links for jupyter
</h1>
<a
href=
"https://files.pythonhosted.org/packages/c9/a9/371d0b8fe37dd231cf4b2cff0a9f0f25e98f3a73c3771742444be27f2944/jupyter-1.0.0.tar.gz#sha256=d9dc4b3318f310e34c82951ea5d6683f67bed7def4b259fafbfe4f1beb1d8e5f"
>
jupyter-1.0.0.tar.gz
</a><br/>
</body>
</html>
<!--SERIAL 1673841-->
tests/repositories/test_legacy_repository.py
View file @
bdcffe5c
import
pytest
import
pytest
import
shutil
try
:
import
urllib.parse
as
urlparse
except
ImportError
:
import
urlparse
from
poetry.packages
import
Dependency
from
poetry.repositories.exceptions
import
PackageNotFound
from
poetry.repositories.exceptions
import
PackageNotFound
from
poetry.repositories.legacy_repository
import
LegacyRepository
from
poetry.repositories.legacy_repository
import
LegacyRepository
from
poetry.repositories.legacy_repository
import
Page
from
poetry.repositories.legacy_repository
import
Page
...
@@ -24,6 +31,12 @@ class MockRepository(LegacyRepository):
...
@@ -24,6 +31,12 @@ class MockRepository(LegacyRepository):
with
fixture
.
open
()
as
f
:
with
fixture
.
open
()
as
f
:
return
Page
(
self
.
_url
+
endpoint
,
f
.
read
(),
{})
return
Page
(
self
.
_url
+
endpoint
,
f
.
read
(),
{})
def
_download
(
self
,
url
,
dest
):
filename
=
urlparse
.
urlparse
(
url
)
.
path
.
rsplit
(
"/"
)[
-
1
]
filepath
=
self
.
FIXTURES
.
parent
/
"pypi.org"
/
"dists"
/
filename
shutil
.
copyfile
(
str
(
filepath
),
dest
)
def
test_page_relative_links_path_are_correct
():
def
test_page_relative_links_path_are_correct
():
repo
=
MockRepository
()
repo
=
MockRepository
()
...
@@ -58,3 +71,24 @@ def test_missing_version(mocker):
...
@@ -58,3 +71,24 @@ def test_missing_version(mocker):
with
pytest
.
raises
(
PackageNotFound
):
with
pytest
.
raises
(
PackageNotFound
):
repo
.
_get_release_info
(
"missing_version"
,
"1.1.0"
)
repo
.
_get_release_info
(
"missing_version"
,
"1.1.0"
)
def
test_get_package_information_fallback_read_setup
():
repo
=
MockRepository
()
package
=
repo
.
package
(
"jupyter"
,
"1.0.0"
)
assert
package
.
name
==
"jupyter"
assert
package
.
version
.
text
==
"1.0.0"
assert
(
package
.
description
==
"Jupyter metapackage. Install all the Jupyter components in one go."
)
assert
package
.
requires
==
[
Dependency
(
"notebook"
,
"*"
),
Dependency
(
"qtconsole"
,
"*"
),
Dependency
(
"jupyter-console"
,
"*"
),
Dependency
(
"nbconvert"
,
"*"
),
Dependency
(
"ipykernel"
,
"*"
),
Dependency
(
"ipywidgets"
,
"*"
),
]
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