python-docutils: create .exe launchers for all scripts
and port to build/installer while at it motivated by virt-manager calling them without an interpreter The next docutils will have a central .exe launcher and the old scripts will be deprecated, so this should fix itself over time.
This commit is contained in:
19
mingw-w64-python-docutils/pyscript2exe.py
Normal file
19
mingw-w64-python-docutils/pyscript2exe.py
Normal file
@@ -0,0 +1,19 @@
|
||||
"""
|
||||
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:
|
||||
f.write(re.sub(b"^#![^\n\r]*", b'', 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")
|
||||
Reference in New Issue
Block a user