Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos
Commits
700655a2
Commit
700655a2
authored
Dec 12, 2021
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update-hash: python3 support
also mention automatic installation method
parent
ede3f1a1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
update-hash
update-hash
+17
-5
No files found.
update-hash
View file @
700655a2
#!/usr/bin/env python
2
#!/usr/bin/env python
"""
"""
Suggested installation:
Helper script to update buildout.hash.cfg
Usage:
$ ./update-hash [BUILDOUT_HASH_CFG]
Automatic installation using husky, from the root of the repository:
$ npm install
Manual installation:
$ cp update-hash .git/hooks/
$ cp update-hash .git/hooks/
$ $EDITOR .git/hooks/pre-commit
$ $EDITOR .git/hooks/pre-commit
...
@@ -36,7 +44,6 @@ import hashlib
...
@@ -36,7 +44,6 @@ import hashlib
import
os
import
os
import
shutil
import
shutil
import
sys
import
sys
import
tempfile
# Note: this is an intentionally very restrictive and primitive
# Note: this is an intentionally very restrictive and primitive
# ConfigParser-ish parser.
# ConfigParser-ish parser.
...
@@ -62,7 +69,11 @@ def main():
...
@@ -62,7 +69,11 @@ def main():
try
:
try
:
outfile
=
os
.
fdopen
(
outfile_fd
,
'w'
)
outfile
=
os
.
fdopen
(
outfile_fd
,
'w'
)
write
=
outfile
.
write
write
=
outfile
.
write
if
sys
.
version_info
<=
(
3
,):
nextLine
=
iter
(
infile
).
next
nextLine
=
iter
(
infile
).
next
else
:
nextLine
=
iter
(
infile
).
__next__
while
True
:
while
True
:
try
:
try
:
line
=
nextLine
()
line
=
nextLine
()
...
@@ -80,7 +91,8 @@ def main():
...
@@ -80,7 +91,8 @@ def main():
os
.
path
.
join
(
os
.
path
.
join
(
infile_dirname
,
infile_dirname
,
*
hash_file_path
.
split
(
'/'
)
*
hash_file_path
.
split
(
'/'
)
)
),
'rb'
,
).
read
()
).
read
()
).
hexdigest
(),
).
hexdigest
(),
eol
,
eol
,
...
...
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