Commit c33e23b6 by Sébastien Eustace

Fix reading bz2 source distribution files

parent 71e89c12
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
- Fixed permission errors when adding/removing git dependencies on Windows. - Fixed permission errors when adding/removing git dependencies on Windows.
- Fixed `Pool` not raising an exception when no package could be found. - Fixed `Pool` not raising an exception when no package could be found.
- Fixed reading `bz2` source distribution.
## [0.12.7] - 2018-11-08 ## [0.12.7] - 2018-11-08
......
...@@ -462,6 +462,9 @@ class PyPiRepository(Repository): ...@@ -462,6 +462,9 @@ class PyPiRepository(Repository):
else: else:
if suffix == ".bz2": if suffix == ".bz2":
gz = BZ2File(str(filepath)) gz = BZ2File(str(filepath))
suffixes = filepath.suffixes
if len(suffixes) > 1 and suffixes[-2] == ".tar":
suffix = ".tar.bz2"
else: else:
gz = GzipFile(str(filepath)) gz = GzipFile(str(filepath))
suffix = ".tar.gz" suffix = ".tar.gz"
......
{
"info": {
"author": "Twisted Matrix Laboratories",
"author_email": "twisted-python@twistedmatrix.com",
"bugtrack_url": null,
"classifiers": [
"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 :: 3.7"
],
"description": "description",
"description_content_type": "",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "http://twistedmatrix.com/",
"keywords": "",
"license": "MIT",
"maintainer": "Glyph Lefkowitz",
"maintainer_email": "glyph@twistedmatrix.com",
"name": "Twisted",
"package_url": "https://pypi.org/project/Twisted/",
"platform": "",
"project_url": "https://pypi.org/project/Twisted/",
"project_urls": {
"Homepage": "http://twistedmatrix.com/"
},
"release_url": "https://pypi.org/project/Twisted/18.9.0/",
"requires_dist": null,
"requires_python": "",
"summary": "An asynchronous networking framework written in Python",
"version": "18.9.0"
},
"last_serial": 4376865,
"releases": {
"18.9.0": [
{
"comment_text": "",
"digests": {
"md5": "20fe2ec156e6e45b0b0d2ff06d9e828f",
"sha256": "294be2c6bf84ae776df2fc98e7af7d6537e1c5e60a46d33c3ce2a197677da395"
},
"downloads": -1,
"filename": "Twisted-18.9.0.tar.bz2",
"has_sig": false,
"md5_digest": "20fe2ec156e6e45b0b0d2ff06d9e828f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3088398,
"upload_time": "2018-10-15T09:11:22",
"url": "https://files.pythonhosted.org/packages/5d/0e/a72d85a55761c2c3ff1cb968143a2fd5f360220779ed90e0fadf4106d4f2/Twisted-18.9.0.tar.bz2"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "20fe2ec156e6e45b0b0d2ff06d9e828f",
"sha256": "294be2c6bf84ae776df2fc98e7af7d6537e1c5e60a46d33c3ce2a197677da395"
},
"downloads": -1,
"filename": "Twisted-18.9.0.tar.bz2",
"has_sig": false,
"md5_digest": "20fe2ec156e6e45b0b0d2ff06d9e828f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3088398,
"upload_time": "2018-10-15T09:11:22",
"url": "https://files.pythonhosted.org/packages/5d/0e/a72d85a55761c2c3ff1cb968143a2fd5f360220779ed90e0fadf4106d4f2/Twisted-18.9.0.tar.bz2"
}
]
}
...@@ -129,3 +129,40 @@ def test_fallback_can_read_setup_to_get_dependencies(): ...@@ -129,3 +129,40 @@ def test_fallback_can_read_setup_to_get_dependencies():
"postgresql_psycopg2cffi": [Dependency("psycopg2cffi", "*")], "postgresql_psycopg2cffi": [Dependency("psycopg2cffi", "*")],
"pymysql": [Dependency("pymysql", "*")], "pymysql": [Dependency("pymysql", "*")],
} }
def test_pypi_repository_supports_reading_bz2_files():
repo = MockRepository(fallback=True)
package = repo.package("twisted", "18.9.0")
assert package.name == "twisted"
assert sorted(package.requires, key=lambda r: r.name) == [
Dependency("attrs", ">=17.4.0"),
Dependency("Automat", ">=0.3.0"),
Dependency("constantly", ">=15.1"),
Dependency("hyperlink", ">=17.1.1"),
Dependency("incremental", ">=16.10.1"),
Dependency("PyHamcrest", ">=1.9.0"),
Dependency("zope.interface", ">=4.4.2"),
]
expected_extras = {
"all_non_platform": [
Dependency("appdirs", ">=1.4.0"),
Dependency("cryptography", ">=1.5"),
Dependency("h2", ">=3.0,<4.0"),
Dependency("idna", ">=0.6,!=2.3"),
Dependency("priority", ">=1.1.0,<2.0"),
Dependency("pyasn1", "*"),
Dependency("pyopenssl", ">=16.0.0"),
Dependency("pyserial", ">=3.0"),
Dependency("service_identity", "*"),
Dependency("soappy", "*"),
]
}
for name, deps in expected_extras.items():
assert expected_extras[name] == sorted(
package.extras[name], key=lambda r: r.name
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment