chore(python,example): exampleにshebangを付けてexecutableにする#1077
Conversation
|
https://github.com/VOICEVOX/voicevox_core/actions/runs/14678209867/job/41197509281?pr=1077 error: could not compile `proc-macro2` (lib) due to 3 previous errors |
|
個人的には一般的な気がしています。Bashと同じような感覚。ONNX Runtimeなんかでも結構あったはず。 逆に付けないことによるデメリットとして、MSYS環境(e.g. Git Bash)にてシェルスクリプトとして実行されうるというのもあるはずかなと。 ❯ echo 'print("hi")' > ./a.py
❯ # MSYSだと、Git側のfilemodeに関わらずそのまま実行可能になってしまう
❯ ./a.py
./a.py: line 1: syntax error near unexpected token `"hi"'
./a.py: line 1: `print("hi")' |
|
|
9c859b1 to
1e4316c
Compare
1e4316c to
a2e2f3d
Compare
|
うーーーん! あとシバンつけることに対してちょっとセカンドオピニオンが欲しい。 |
This reverts commit a2e2f3d.
|
あ、そっか |
|
あ、いやcmdやPowerShellだったら |
sevenc-nanashi
left a comment
There was a problem hiding this comment.
shebang追加だけなら大丈夫だと思います。
#1077 の続き。 このリポジトリ内のすべてのファイルに対し、以下のチェックを義務付ける。 ```bash if has_shebang && ! is_executable; then echo 'A shebanged file must be executable (note: if you are using Windows, please change the filemode with `git update-index --chmod+x`)' exit 1 fi if is_shellscript && ! is_executable; then echo 'A shell script file must be executable (note: if you are using Windows, please change the filemode with `git update-index --chmod+x`)' exit 1 fi if is_executable && ! has_shebang; then echo 'An executable blob must have a shebang' exit 1 fi ```
|
|
|
いや、Python exampleは |
内容
run{,-asyncio}.pyにshebangを付け、filemodeも
100755(GIT_FILEMODE_BLOB_EXECUTABLE)にする。shebangを
python3ではなくpythonにしているのは、仮想環境を前提にしたいから。関連 Issue
その他