Skip to content

Commit 102db09

Browse files
authored
v1.20.4 CI (#132)
* v1.20.4 * compat blake2b hash 2.x
1 parent 6df2a5b commit 102db09

File tree

3 files changed

+32
-18
lines changed

3 files changed

+32
-18
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ on:
44
push:
55
branches: ["main"]
66
pull_request:
7-
branches: ["main"]
7+
branches: ["main", "1.x"]
88
workflow_dispatch:
99

1010
jobs:
1111
tests:
12-
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }}"
12+
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
1313
runs-on: ${{ matrix.os }}
1414

1515
strategy:
@@ -25,36 +25,40 @@ jobs:
2525
python-version: "3.7"
2626

2727
steps:
28-
- uses: "actions/checkout@v3"
29-
- uses: "actions/setup-python@v4"
28+
- uses: actions/checkout@v3
29+
- uses: actions/setup-python@v4
3030
with:
31-
python-version: "${{ matrix.python-version }}"
32-
- name: "Install dependencies"
31+
python-version: ${{ matrix.python-version }}
32+
- name: Install dependencies
3333
run: |
3434
python -VV
3535
python -m pip install -r requirements-dev.txt
3636
37-
- name: "Run tests for ${{ matrix.python-version }} on ${{ matrix.os }}"
37+
- name: Run tests for ${{ matrix.python-version }} on ${{ matrix.os }}
3838
run: python -m pytest
3939

4040
- name: Upload coverage to Codecov
41-
uses: "codecov/codecov-action@v3"
41+
uses: codecov/codecov-action@v3
42+
with:
43+
token: ${{ secrets.CODECOV_TOKEN }}
4244

4345
tests-27:
44-
name: "Python 2.7 on ubuntu-20.04"
46+
name: Python 2.7 on ubuntu-20.04
4547
runs-on: ubuntu-20.04
4648
container:
4749
image: python:2.7-buster
4850

4951
steps:
50-
- uses: "actions/checkout@v3"
51-
- name: "Install dependencies"
52+
- uses: actions/checkout@v3
53+
- name: Install dependencies
5254
run: |
5355
python -VV
5456
python -m pip install -r requirements-dev.txt
5557
56-
- name: "Run tests for Python 2.7 on ubuntu-20.04"
58+
- name: Run tests for Python 2.7 on ubuntu-20.04
5759
run: python -m pytest
5860

5961
- name: Upload coverage to Codecov
60-
uses: "codecov/codecov-action@v3"
62+
uses: codecov/codecov-action@v3
63+
with:
64+
token: ${{ secrets.CODECOV_TOKEN }}

johnnydep/pipper.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@
3333

3434
def compute_checksum(target, algorithm="sha256", blocksize=2 ** 13):
3535
hashtype = getattr(hashlib, algorithm)
36-
if algorithm == "blake2b":
37-
hash_ = hashtype(digest_size=32)
38-
else:
39-
hash_ = hashtype()
36+
hash_ = hashtype()
4037
log.debug("computing checksum", target=target, algorithm=algorithm)
4138
with open(target, "rb") as f:
4239
for chunk in iter(lambda: f.read(blocksize), b""):
@@ -46,6 +43,18 @@ def compute_checksum(target, algorithm="sha256", blocksize=2 ** 13):
4643
return result
4744

4845

46+
def _warehouse_hash(target):
47+
try:
48+
blake2b = hashlib.blake2b
49+
except AttributeError:
50+
# Python < 3.6
51+
import pyblake2
52+
blake2b = pyblake2.blake2b
53+
with open(target, "rb") as f:
54+
b2b = blake2b(f.read(), digest_size=32)
55+
return b2b.hexdigest()
56+
57+
4958
def _get_pip_version():
5059
# try to get pip version without actually importing pip
5160
# setuptools gets upset if you import pip before importing setuptools..
@@ -213,7 +222,7 @@ def get(dist_name, index_url=None, env=None, extra_index_url=None, tmpdir=None,
213222
except ValueError:
214223
pass
215224
else:
216-
b2b = compute_checksum(whl, "blake2b")
225+
b2b = _warehouse_hash(whl)
217226
path = "/".join([b2b[:2], b2b[2:4], b2b[4:], os.path.basename(whl)])
218227
urls = {x for x in out.split() if x.startswith("http") and x.endswith(path)}
219228
if len(urls) == 1:

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"colorama ; python_version < '3.7' or platform_system == 'Windows'", # structlog
2626
"cachetools",
2727
"oyaml",
28+
"pyblake2 ; python_version < '3.6'",
2829
"toml",
2930
"pip",
3031
"packaging >= 17, != 22",

0 commit comments

Comments
 (0)