Skip to content

Commit

Permalink
Fix spaces in scripts shebang
Browse files Browse the repository at this point in the history
  • Loading branch information
Secrus committed Sep 25, 2024
1 parent 150ff09 commit a64d5cb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
24 changes: 6 additions & 18 deletions src/poetry/masonry/builders/editable.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from pathlib import Path
from typing import TYPE_CHECKING

from installer.scripts import Script
from installer.utils import get_launcher_kind
from poetry.core.masonry.builders.builder import Builder
from poetry.core.masonry.builders.sdist import SdistBuilder
from poetry.core.masonry.utils.package_include import PackageInclude
Expand All @@ -27,15 +29,6 @@
from poetry.poetry import Poetry
from poetry.utils.env import Env

SCRIPT_TEMPLATE = """\
#!{python}
import sys
from {module} import {callable_holder}
if __name__ == '__main__':
sys.exit({callable_}())
"""

WINDOWS_CMD_TEMPLATE = """\
@echo off\r\n"{python}" "%~dp0\\{script}" %*\r\n
"""
Expand Down Expand Up @@ -176,21 +169,16 @@ def _add_scripts(self) -> list[Path]:

raise ValueError(msg)

callable_holder = callable_.split(".", 1)[0]

script_file = scripts_path.joinpath(name)
self._debug(
f" - Adding the <c2>{name}</c2> script to <b>{scripts_path}</b>"
)
with script_file.open("w", encoding="utf-8") as f:
f.write(
decode(
SCRIPT_TEMPLATE.format(
python=self._env.python,
module=module,
callable_holder=callable_holder,
callable_=callable_,
)
str(
Script(name, module, callable_, "console")
.generate(str(self._env.python), get_launcher_kind())[1]
.decode()
)
)

Expand Down
18 changes: 12 additions & 6 deletions tests/masonry/builders/test_editable_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,32 +212,38 @@ def test_builder_installs_proper_files_for_standard_packages(

baz_script = f"""\
#!{tmp_venv.python}
# -*- coding: utf-8 -*-
import re
import sys
from bar import baz
if __name__ == '__main__':
if __name__ == "__main__":
sys.argv[0] = re.sub(r"(-script\\.pyw|\\.exe)?$", "", sys.argv[0])
sys.exit(baz.boom.bim())
"""

assert baz_script == tmp_venv._bin_dir.joinpath("baz").read_text(encoding="utf-8")

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS aarch64 (Python 3.9) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project_legacy] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw0/test_builder_installs_proper_f0/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw0/test_builder_installs_proper_f0/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS aarch64 (Python 3.9) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw0/test_builder_installs_proper_f1/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw0/test_builder_installs_proper_f1/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS aarch64 (Python 3.10) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project_legacy] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw2/test_builder_installs_proper_f1/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw2/test_builder_installs_proper_f1/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS aarch64 (Python 3.10) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw2/test_builder_installs_proper_f2/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw2/test_builder_installs_proper_f2/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS aarch64 (Python 3.11) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project_legacy] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f0/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f0/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS aarch64 (Python 3.11) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f2/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f2/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS aarch64 (Python 3.12) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw0/test_builder_installs_proper_f0/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw0/test_builder_installs_proper_f0/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS aarch64 (Python 3.12) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project_legacy] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw0/test_builder_installs_proper_f2/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw0/test_builder_installs_proper_f2/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS x86_64 (Python 3.10) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw2/test_builder_installs_proper_f0/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw2/test_builder_installs_proper_f0/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS x86_64 (Python 3.10) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project_legacy] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f0/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f0/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS aarch64 (Python 3.8) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f1/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f1/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS aarch64 (Python 3.8) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project_legacy] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f2/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f2/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS x86_64 (Python 3.11) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f0/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f0/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS x86_64 (Python 3.11) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project_legacy] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f2/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f2/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS x86_64 (Python 3.12) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw3/test_builder_installs_proper_f0/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw3/test_builder_installs_proper_f0/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS x86_64 (Python 3.12) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project_legacy] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw3/test_builder_installs_proper_f1/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw3/test_builder_installs_proper_f1/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS x86_64 (Python 3.8) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw0/test_builder_installs_proper_f1/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw0/test_builder_installs_proper_f1/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS x86_64 (Python 3.8) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project_legacy] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw0/test_builder_installs_proper_f2/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw0/test_builder_installs_proper_f2/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS x86_64 (Python 3.9) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f0/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f0/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

Check failure on line 224 in tests/masonry/builders/test_editable_builder.py

View workflow job for this annotation

GitHub Actions / macOS x86_64 (Python 3.9) / pytest

test_builder_installs_proper_files_for_standard_packages[simple_project_legacy] assert '#!/private/v...boom.bim())\n' == "#!/bin/sh\n'...boom.bim())\n" - #!/bin/sh - '''exec' /private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f2/venv/bin/python "$0" "$@" ? ^^^^^^^^^ ---------- + #!/private/var/folders/nj/wh528zms06j9t8y7bmlvpmjm0000gn/T/pytest-of-runner/pytest-0/popen-gw1/test_builder_installs_proper_f2/venv/bin/python ? ^^ - ' ''' # -*- coding: utf-8 -*- import re import sys from bar import baz if __name__ == "__main__": sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) sys.exit(baz.boom.bim())

foo_script = f"""\
#!{tmp_venv.python}
# -*- coding: utf-8 -*-
import re
import sys
from foo import bar
if __name__ == '__main__':
if __name__ == "__main__":
sys.argv[0] = re.sub(r"(-script\\.pyw|\\.exe)?$", "", sys.argv[0])
sys.exit(bar())
"""

assert foo_script == tmp_venv._bin_dir.joinpath("foo").read_text(encoding="utf-8")

fox_script = f"""\
#!{tmp_venv.python}
# -*- coding: utf-8 -*-
import re
import sys
from fuz.foo import bar
if __name__ == '__main__':
if __name__ == "__main__":
sys.argv[0] = re.sub(r"(-script\\.pyw|\\.exe)?$", "", sys.argv[0])
sys.exit(bar.baz())
"""

Expand Down

0 comments on commit a64d5cb

Please sign in to comment.