base58.py can executed by python3
Add python3 script shebang lint #12972
pull ken2812221 wants to merge 2 commits into bitcoin:master from ken2812221:explicit_python3 changing 2 files +13 −3-
ken2812221 commented at 3:43 AM on April 13, 2018: contributor
- fanquake added the label Scripts and tools on Apr 13, 2018
-
Empact commented at 10:31 AM on April 13, 2018: member
Good candidate for a lint?
-
MarcoFalke commented at 1:37 PM on April 13, 2018: member
To the best of my knowledge, the script is outdated and won't produce test vectors in the current format. Since you are touching this file, might as well fix this in one go?
-
MarcoFalke commented at 1:47 PM on April 13, 2018: member
Also the readme should be updated to reflect the new names, i.e. "src/test/data/key_io_valid.json" and "src/test/data/key_io_invalid.json"
-
practicalswift commented at 2:00 PM on April 13, 2018: contributor
@Empact The linter you're thinking about would check that all
*.pyfiles start with#!/usr/bin/env python3? Anything more? - ken2812221 force-pushed on Apr 13, 2018
-
ken2812221 commented at 2:26 PM on April 13, 2018: contributor
@MarcoFalke since we don't generate testdata dynamically, should we delete this testgen directory?
-
ken2812221 commented at 2:36 PM on April 13, 2018: contributor
I don't know how to deal with
contrib/devtools/test-security-check.py, it seems outdated, and not python3 code -
jnewbery commented at 2:56 PM on April 13, 2018: member
Concept ACK adding the linter, however it should only return an error if there's a
pythonorpython2shebang. It's fine to have no shebang if the module is not intended to be run as a standalone executable.I don't think we should add shebangs to modules which aren't intended to be run as standalone executables.
test-security-check.py was overlooked in #11881. You can convert it to Python3 with the following commit: https://github.com/jnewbery/bitcoin/commit/35cb5dafdd5d08ed536971ae9401c56f98b4f421
-
practicalswift commented at 3:01 PM on April 13, 2018: contributor
@ken2812221 What about this linter?
#!/bin/bash EXIT_CODE=0 for PYTHON_FILE in $(git ls-files -- "*.py"); do if [[ $(head -c 2 "${PYTHON_FILE}") == "#!" && $(head -n 1 "${PYTHON_FILE}") != "#!/usr/bin/env python3" ]]; then echo "Missing shebang \"#!/usr/bin/env python3\" in ${PYTHON_FILE}" EXIT_CODE=1 fi done exit ${EXIT_CODE} - ken2812221 force-pushed on Apr 13, 2018
- ken2812221 force-pushed on Apr 13, 2018
-
ken2812221 commented at 3:31 PM on April 13, 2018: contributor
@practicalswift Seems your lint is flexible
-
ken2812221 commented at 4:20 PM on April 13, 2018: contributor
@jnewbery thanks
-
practicalswift commented at 4:24 PM on April 13, 2018: contributor
utACK 294e59675bf326eb0e81a6685410f25df5619be4
-
in contrib/testgen/base58.py:1 in 294e59675b outdated
0 | @@ -1,3 +1,4 @@ 1 | +#!/usr/bin/env python3
jnewbery commented at 5:24 PM on April 13, 2018:I still don't think base58.py requires a shebang. It's not executable:
→ ls -l contrib/testgen/base58.py -rw-rw-r-- 1 ubuntu ubuntu 3092 Apr 13 14:37 contrib/testgen/base58.pyin contrib/devtools/lint-python-shebang.sh:7 in 294e59675b outdated
0 | @@ -0,0 +1,11 @@ 1 | +#!/bin/bash 2 | + 3 | +EXIT_CODE=0 4 | +for PYTHON_FILE in $(git ls-files -- "*.py"); do 5 | + if [[ $(head -c 2 "${PYTHON_FILE}") == "#!" && 6 | + $(head -n 1 "${PYTHON_FILE}") != "#!/usr/bin/env python3" ]]; then 7 | + echo "Missing shebang \"#!/usr/bin/env python3\" in ${PYTHON_FILE}"
jnewbery commented at 5:24 PM on April 13, 2018:Comment could be clearer. Something like "Shebang must use python3 (not python or python2)"
add lint tool to check python3 shebang 958bf40489[contrib] convert test-security-check to python3 2bff472992ken2812221 force-pushed on Apr 13, 2018ken2812221 renamed this:trivial: Use python3 explicitly
Add python3 script shebang lint
on Apr 13, 2018practicalswift commented at 5:13 AM on April 14, 2018: contributorutACK 2bff472992401b9fecf89622a0151e6fcdab3707
Empact commented at 11:46 PM on April 15, 2018: memberutACK 2bff472
jnewbery commented at 2:31 PM on April 16, 2018: memberutACK 2bff472992401b9fecf89622a0151e6fcdab3707
MarcoFalke merged this on Apr 16, 2018MarcoFalke closed this on Apr 16, 2018MarcoFalke referenced this in commit 07825088f9 on Apr 16, 2018ken2812221 deleted the branch on Apr 17, 2018PastaPastaPasta referenced this in commit 0a894fba66 on Jun 17, 2020PastaPastaPasta referenced this in commit 714beebe07 on Jun 27, 2020zkbot referenced this in commit 43ac2062f9 on Oct 28, 2020zkbot referenced this in commit 84a5830aaa on Nov 9, 2020MarcoFalke locked this on Sep 8, 2021ContributorsLabels
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-20 09:15 UTC
More mirrored repositories can be found on mirror.b10c.me