Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
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/
$ $EDITOR .git/hooks/pre-commit
...
...
@@ -36,7 +44,6 @@ import hashlib
import
os
import
shutil
import
sys
import
tempfile
# Note: this is an intentionally very restrictive and primitive
# ConfigParser-ish parser.
...
...
@@ -62,7 +69,11 @@ def main():
try
:
outfile
=
os
.
fdopen
(
outfile_fd
,
'w'
)
write
=
outfile
.
write
if
sys
.
version_info
<=
(
3
,):
nextLine
=
iter
(
infile
).
next
else
:
nextLine
=
iter
(
infile
).
__next__
while
True
:
try
:
line
=
nextLine
()
...
...
@@ -80,7 +91,8 @@ def main():
os
.
path
.
join
(
infile_dirname
,
*
hash_file_path
.
split
(
'/'
)
)
),
'rb'
,
).
read
()
).
hexdigest
(),
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