Skip to content

Commit

Permalink
Fix wrong wheel being selected
Browse files Browse the repository at this point in the history
  • Loading branch information
sdispater committed Jul 30, 2018
1 parent 0a39d83 commit e61fec7
Show file tree
Hide file tree
Showing 11 changed files with 389 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ MANIFEST.in
/docs/site/*
pyproject.lock
/tests/fixtures/simple_project/setup.py
/tests/fixtures/project_with_extras/setup.py
.mypy_cache

.venv
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## [Unreleased]

### Fixed

- Fixed wrong wheel being selected when resolving dependencies.


## [0.11.3] - 2018-07-26

### Changed
Expand Down
25 changes: 18 additions & 7 deletions poetry/repositories/pypi_repository.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os
import re
import tarfile
import zipfile

Expand Down Expand Up @@ -288,17 +289,27 @@ def _get_release_info(self, name, version): # type: (str, str) -> dict
continue

# If bdist_wheel, check if it's universal
python_version = url["python_version"]
if python_version not in ["py2.py3", "py3", "py2"]:
filename = url["filename"]
if not re.search("-py2\.py3-none-any.whl", filename):
continue

parts = urlparse.urlparse(url["url"])
filename = os.path.basename(parts.path)
urls[dist_type] = url["url"]

if "-none-any" not in filename:
continue
if "sdist" in url and "bdist_wheel" not in urls:
# If can't found a universal wheel
# but we found an sdist, inspect the sdist first
info = self._get_info_from_urls(urls)
if info["requires_dist"]:
data["requires_dist"] = info["requires_dist"]

if not data["requires_python"]:
data["requires_python"] = info["requires_python"]

return data
else:
del urls["sdist"]

if not urls or "bdist_wheel" not in urls:
if not urls:
# If we don't have urls, we try to take the first one
# we find and go from there
if not json_data["urls"]:
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
160 changes: 160 additions & 0 deletions tests/repositories/fixtures/pypi.org/json/isort.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{
"info": {
"author": "Timothy Crosley",
"author_email": "[email protected]",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 6 - Mature",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries",
"Topic :: Utilities"
],
"description": "",
"description_content_type": null,
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/timothycrosley/isort",
"keywords": "Refactor",
"license": "MIT",
"maintainer": "",
"maintainer_email": "",
"name": "isort",
"package_url": "https://pypi.org/project/isort/",
"platform": "",
"project_url": "https://pypi.org/project/isort/",
"project_urls": {
"Homepage": "https://github.com/timothycrosley/isort"
},
"release_url": "https://pypi.org/project/isort/4.3.4/",
"requires_dist": null,
"requires_python": "",
"summary": "A Python utility / library to sort Python imports.",
"version": "4.3.4"
},
"last_serial": 3575149,
"releases": {
"4.3.4": [
{
"comment_text": "",
"digests": {
"md5": "f0ad7704b6dc947073398ba290c3517f",
"sha256": "ec9ef8f4a9bc6f71eec99e1806bfa2de401650d996c59330782b89a5555c1497"
},
"downloads": -1,
"filename": "isort-4.3.4-py2-none-any.whl",
"has_sig": false,
"md5_digest": "f0ad7704b6dc947073398ba290c3517f",
"packagetype": "bdist_wheel",
"python_version": "2.7",
"requires_python": null,
"size": 45393,
"upload_time": "2018-02-12T15:06:38",
"url": "https://files.pythonhosted.org/packages/41/d8/a945da414f2adc1d9e2f7d6e7445b27f2be42766879062a2e63616ad4199/isort-4.3.4-py2-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "fbaac4cd669ac21ea9e21ab1ea3180db",
"sha256": "1153601da39a25b14ddc54955dbbacbb6b2d19135386699e2ad58517953b34af"
},
"downloads": -1,
"filename": "isort-4.3.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fbaac4cd669ac21ea9e21ab1ea3180db",
"packagetype": "bdist_wheel",
"python_version": "3.6",
"requires_python": null,
"size": 45352,
"upload_time": "2018-02-12T15:06:20",
"url": "https://files.pythonhosted.org/packages/1f/2c/22eee714d7199ae0464beda6ad5fedec8fee6a2f7ffd1e8f1840928fe318/isort-4.3.4-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "fb554e9c8f9aa76e333a03d470a5cf52",
"sha256": "b9c40e9750f3d77e6e4d441d8b0266cf555e7cdabdcff33c4fd06366ca761ef8"
},
"downloads": -1,
"filename": "isort-4.3.4.tar.gz",
"has_sig": false,
"md5_digest": "fb554e9c8f9aa76e333a03d470a5cf52",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 56070,
"upload_time": "2018-02-12T15:06:16",
"url": "https://files.pythonhosted.org/packages/b1/de/a628d16fdba0d38cafb3d7e34d4830f2c9cb3881384ce5c08c44762e1846/isort-4.3.4.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "f0ad7704b6dc947073398ba290c3517f",
"sha256": "ec9ef8f4a9bc6f71eec99e1806bfa2de401650d996c59330782b89a5555c1497"
},
"downloads": -1,
"filename": "isort-4.3.4-py2-none-any.whl",
"has_sig": false,
"md5_digest": "f0ad7704b6dc947073398ba290c3517f",
"packagetype": "bdist_wheel",
"python_version": "2.7",
"requires_python": null,
"size": 45393,
"upload_time": "2018-02-12T15:06:38",
"url": "https://files.pythonhosted.org/packages/41/d8/a945da414f2adc1d9e2f7d6e7445b27f2be42766879062a2e63616ad4199/isort-4.3.4-py2-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "fbaac4cd669ac21ea9e21ab1ea3180db",
"sha256": "1153601da39a25b14ddc54955dbbacbb6b2d19135386699e2ad58517953b34af"
},
"downloads": -1,
"filename": "isort-4.3.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fbaac4cd669ac21ea9e21ab1ea3180db",
"packagetype": "bdist_wheel",
"python_version": "3.6",
"requires_python": null,
"size": 45352,
"upload_time": "2018-02-12T15:06:20",
"url": "https://files.pythonhosted.org/packages/1f/2c/22eee714d7199ae0464beda6ad5fedec8fee6a2f7ffd1e8f1840928fe318/isort-4.3.4-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "fb554e9c8f9aa76e333a03d470a5cf52",
"sha256": "b9c40e9750f3d77e6e4d441d8b0266cf555e7cdabdcff33c4fd06366ca761ef8"
},
"downloads": -1,
"filename": "isort-4.3.4.tar.gz",
"has_sig": false,
"md5_digest": "fb554e9c8f9aa76e333a03d470a5cf52",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 56070,
"upload_time": "2018-02-12T15:06:16",
"url": "https://files.pythonhosted.org/packages/b1/de/a628d16fdba0d38cafb3d7e34d4830f2c9cb3881384ce5c08c44762e1846/isort-4.3.4.tar.gz"
}
]
}
156 changes: 156 additions & 0 deletions tests/repositories/fixtures/pypi.org/json/jupyter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
{
"info": {
"author": "Jupyter Development Team",
"author_email": "[email protected]",
"bugtrack_url": null,
"classifiers": [
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4"
],
"description": "Install the Jupyter system, including the notebook, qtconsole, and the IPython kernel.",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "http://jupyter.org",
"keywords": null,
"license": "BSD",
"maintainer": null,
"maintainer_email": null,
"name": "jupyter",
"package_url": "https://pypi.org/project/jupyter/",
"platform": "UNKNOWN",
"project_url": "https://pypi.org/project/jupyter/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "http://jupyter.org"
},
"release_url": "https://pypi.org/project/jupyter/1.0.0/",
"requires_dist": null,
"requires_python": null,
"summary": "Jupyter metapackage. Install all the Jupyter components in one go.",
"version": "1.0.0"
},
"last_serial": 1673841,
"releases": {
"0.0.0": [],
"1.0.0": [
{
"comment_text": "",
"digests": {
"md5": "f81d039e084c2c0c4da9e4a86446b863",
"sha256": "5b290f93b98ffbc21c0c7e749f054b3267782166d72fa5e3ed1ed4eaf34a2b78"
},
"downloads": -1,
"filename": "jupyter-1.0.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "f81d039e084c2c0c4da9e4a86446b863",
"packagetype": "bdist_wheel",
"python_version": "3.4",
"requires_python": null,
"size": 2736,
"upload_time": "2015-08-12T00:42:58",
"url": "https://files.pythonhosted.org/packages/83/df/0f5dd132200728a86190397e1ea87cd76244e42d39ec5e88efd25b2abd7e/jupyter-1.0.0-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "c6030444c7eb6c05a4d7b1768c72aed7",
"sha256": "d9dc4b3318f310e34c82951ea5d6683f67bed7def4b259fafbfe4f1beb1d8e5f"
},
"downloads": -1,
"filename": "jupyter-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "c6030444c7eb6c05a4d7b1768c72aed7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12916,
"upload_time": "2015-08-12T00:43:08",
"url": "https://files.pythonhosted.org/packages/c9/a9/371d0b8fe37dd231cf4b2cff0a9f0f25e98f3a73c3771742444be27f2944/jupyter-1.0.0.tar.gz"
},
{
"comment_text": "",
"digests": {
"md5": "25142b08e2ad7142b6f920bc8cc8dfeb",
"sha256": "3e1f86076bbb7c8c207829390305a2b1fe836d471ed54be66a3b8c41e7f46cc7"
},
"downloads": -1,
"filename": "jupyter-1.0.0.zip",
"has_sig": false,
"md5_digest": "25142b08e2ad7142b6f920bc8cc8dfeb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16690,
"upload_time": "2015-08-12T00:43:12",
"url": "https://files.pythonhosted.org/packages/fc/21/a372b73e3a498b41b92ed915ada7de2ad5e16631546329c03e484c3bf4e9/jupyter-1.0.0.zip"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "f81d039e084c2c0c4da9e4a86446b863",
"sha256": "5b290f93b98ffbc21c0c7e749f054b3267782166d72fa5e3ed1ed4eaf34a2b78"
},
"downloads": -1,
"filename": "jupyter-1.0.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "f81d039e084c2c0c4da9e4a86446b863",
"packagetype": "bdist_wheel",
"python_version": "3.4",
"requires_python": null,
"size": 2736,
"upload_time": "2015-08-12T00:42:58",
"url": "https://files.pythonhosted.org/packages/83/df/0f5dd132200728a86190397e1ea87cd76244e42d39ec5e88efd25b2abd7e/jupyter-1.0.0-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "c6030444c7eb6c05a4d7b1768c72aed7",
"sha256": "d9dc4b3318f310e34c82951ea5d6683f67bed7def4b259fafbfe4f1beb1d8e5f"
},
"downloads": -1,
"filename": "jupyter-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "c6030444c7eb6c05a4d7b1768c72aed7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12916,
"upload_time": "2015-08-12T00:43:08",
"url": "https://files.pythonhosted.org/packages/c9/a9/371d0b8fe37dd231cf4b2cff0a9f0f25e98f3a73c3771742444be27f2944/jupyter-1.0.0.tar.gz"
},
{
"comment_text": "",
"digests": {
"md5": "25142b08e2ad7142b6f920bc8cc8dfeb",
"sha256": "3e1f86076bbb7c8c207829390305a2b1fe836d471ed54be66a3b8c41e7f46cc7"
},
"downloads": -1,
"filename": "jupyter-1.0.0.zip",
"has_sig": false,
"md5_digest": "25142b08e2ad7142b6f920bc8cc8dfeb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16690,
"upload_time": "2015-08-12T00:43:12",
"url": "https://files.pythonhosted.org/packages/fc/21/a372b73e3a498b41b92ed915ada7de2ad5e16631546329c03e484c3bf4e9/jupyter-1.0.0.zip"
}
]
}
Loading

0 comments on commit e61fec7

Please sign in to comment.