mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Supply sha256 checksum to mocked PyPI
This commit is contained in:
+1
-1
Submodule tests/pypi updated: 1881ecb454...77faecd45e
@@ -16,7 +16,7 @@ from six.moves import xmlrpc_client
|
||||
from flask import Flask, redirect, abort, render_template, send_file, jsonify
|
||||
|
||||
|
||||
ReleaseTuple = collections.namedtuple("ReleaseTuple", ["path", "requires_python"])
|
||||
ReleaseTuple = collections.namedtuple("ReleaseTuple", ["path", "requires_python", "hash"])
|
||||
|
||||
app = Flask(__name__)
|
||||
session = requests.Session()
|
||||
@@ -86,13 +86,17 @@ class Package(object):
|
||||
path_to_binary = os.path.abspath(path_to_binary)
|
||||
path, release = os.path.split(path_to_binary)
|
||||
requires_python = ""
|
||||
hash_value = ""
|
||||
if path_to_binary.endswith(".whl"):
|
||||
pkg = distlib.wheel.Wheel(path_to_binary)
|
||||
md_dict = pkg.metadata.todict()
|
||||
requires_python = md_dict.get("requires_python", "")
|
||||
if requires_python.count(".") > 1:
|
||||
requires_python, _, _ = requires_python.rpartition(".")
|
||||
self.releases[release] = ReleaseTuple(path_to_binary, requires_python)
|
||||
if os.path.isfile(path_to_binary + ".sha256"):
|
||||
with open(path_to_binary + ".sha256") as f:
|
||||
hash_value = f.read().strip()
|
||||
self.releases[release] = ReleaseTuple(path_to_binary, requires_python, hash_value)
|
||||
self._package_dirs.add(ReleaseTuple(path, requires_python))
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<body>
|
||||
<h1>Links for {{ package.name }}</h1>
|
||||
{% for release, value in package.releases.items() %}
|
||||
<a href="/{{ package.name }}/{{ release }}"{%- if value.requires_python %} data-requires-python="{{ value.requires_python }}"{% endif %}>{{ release }}</a>
|
||||
<a href="/{{ package.name }}/{{ release }}{%- if value.hash %}#sha256={{ value.hash }}{% endif %}"{%- if value.requires_python %} data-requires-python="{{ value.requires_python }}"{% endif %}>{{ release }}</a>
|
||||
<br>
|
||||
{% endfor %}
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user