Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
e334b16a
Commit
e334b16a
authored
Dec 29, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python/build/download: move file_md5() to verify.py
parent
5626ace2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
download.py
python/build/download.py
+1
-13
verify.py
python/build/verify.py
+13
-0
No files found.
python/build/download.py
View file @
e334b16a
from
build.verify
import
file_md5
import
os
import
hashlib
import
urllib.request
def
file_md5
(
path
):
"""Calculate the MD5 checksum of a file and return it in hexadecimal notation."""
with
open
(
path
,
'rb'
)
as
f
:
m
=
hashlib
.
md5
()
while
True
:
data
=
f
.
read
(
65536
)
if
len
(
data
)
==
0
:
# end of file
return
m
.
hexdigest
()
m
.
update
(
data
)
def
download_and_verify
(
url
,
md5
,
parent_path
):
"""Download a file, verify its MD5 checksum and return the local path."""
...
...
python/build/verify.py
0 → 100644
View file @
e334b16a
import
hashlib
def
file_md5
(
path
):
"""Calculate the MD5 checksum of a file and return it in hexadecimal notation."""
with
open
(
path
,
'rb'
)
as
f
:
m
=
hashlib
.
md5
()
while
True
:
data
=
f
.
read
(
65536
)
if
len
(
data
)
==
0
:
# end of file
return
m
.
hexdigest
()
m
.
update
(
data
)
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