Files
MINGW-packages/mingw-w64-itstool/pyscript2exe.py
JPeterMugaas 159f6af0b9 fix pyscript2exe.py so that it provides the propper shabbang just like setuptools and then change the sshabbang for the user's particular system
mingw-w64-glib2
mingw-w64-gobject-introspection
mingw-w64-gtk-doc
mingw-w64-itstool

Note that the shabbang should be a file name and not "/usr/bin/env python2.exe" or something like that.  The env command is for accessing something in the environment.  I think this could be effecting some Gnome-build scripts.
2019-06-05 16:57:24 -04:00

21 lines
606 B
Python

"""
Creates an exe launcher for Python scripts for the executing interpreter.
foobar.py -> foobar.exe + foobar-script.py
"""
import sys
import re
import os
from setuptools.command.easy_install import get_win_launcher
path = sys.argv[1]
with open(path, "rb") as f:
data = f.read()
with open(path, "wb") as f:
shebang = "#!" + os.path.join(sys.prefix, 'bin',os.path.basename(sys.executable))
f.write(re.sub(b"^#![^\n\r]*", shebang.encode(), data))
root, ext = os.path.splitext(path)
with open(root + ".exe", "wb") as f:
f.write(get_win_launcher("cli"))
os.rename(path, root + "-script.py")