Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
3e9d1b39
Commit
3e9d1b39
authored
Mar 28, 2014
by
Dave St.Germain
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3097 from edx/dcs/paver-reqs
Reduce false cache misses when evaluating prerequisites
parents
2561c010
59333915
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
16 deletions
+7
-16
pavelib/prereqs.py
+7
-16
No files found.
pavelib/prereqs.py
View file @
3e9d1b39
...
@@ -18,16 +18,6 @@ PYTHON_REQ_FILES = [
...
@@ -18,16 +18,6 @@ PYTHON_REQ_FILES = [
]
]
def
read_in_chunks
(
infile
,
chunk_size
=
1024
*
64
):
"""
Yield a chunk of size `chunksize` from `infile` (a file handle).
"""
chunk
=
infile
.
read
(
chunk_size
)
while
chunk
:
yield
chunk
chunk
=
infile
.
read
(
chunk_size
)
def
compute_fingerprint
(
path_list
):
def
compute_fingerprint
(
path_list
):
"""
"""
Hash the contents of all the files and directories in `path_list`.
Hash the contents of all the files and directories in `path_list`.
...
@@ -38,17 +28,18 @@ def compute_fingerprint(path_list):
...
@@ -38,17 +28,18 @@ def compute_fingerprint(path_list):
for
path
in
path_list
:
for
path
in
path_list
:
# For directories, create a hash based on the filenames in the directory
# For directories, create a hash based on the modification times
# of first-level subdirectories
if
os
.
path
.
isdir
(
path
):
if
os
.
path
.
isdir
(
path
):
for
_
,
_
,
filenames
in
os
.
walk
(
path
):
for
dirname
in
sorted
(
os
.
listdir
(
path
)):
for
name
in
filenames
:
p
=
os
.
path
.
join
(
path
,
dirname
)
hasher
.
update
(
name
)
if
os
.
path
.
isdir
(
p
):
hasher
.
update
(
str
(
os
.
stat
(
p
)
.
st_mtime
))
# For files, hash the contents of the file
# For files, hash the contents of the file
if
os
.
path
.
isfile
(
path
):
if
os
.
path
.
isfile
(
path
):
with
open
(
path
,
"rb"
)
as
file_handle
:
with
open
(
path
,
"rb"
)
as
file_handle
:
for
chunk
in
read_in_chunks
(
file_handle
):
hasher
.
update
(
file_handle
.
read
())
hasher
.
update
(
chunk
)
return
hasher
.
hexdigest
()
return
hasher
.
hexdigest
()
...
...
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