Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add exe launchers for Python scripts in glib2 and gobject-introspecti…
…on; Reenable G-I for json-glib (#2942) * Add exe launchers to glib2 to fix the upgrade naming conflict as pacman can't see the difference between the new Python script without extension and the old .exe file. * Also add exe laucnhers for gobject-introspection so that meson can execute them. The scripts currently have a broken shebang including an absolute path (also the case on Linux), and fixing that would at least work for meson as it has a shebang parser. But the exe launcher seems less error prone and also works with other tools. * The last update to json-glib disabled introspection due to the above mentioned bug. This reenables it and also enables gtk-doc building while at it. (first package fully build using only mingw tools \o/)
- Loading branch information
Showing
5 changed files
with
72 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| """ | ||
| 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 = "#!/usr/bin/env " + 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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| """ | ||
| 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 = "#!/usr/bin/env " + 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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d394f20There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does python2 must be a dependence for glib2 at runtime or just for compiling/installing? If it must be a dependency, it means python2 must be installed and can't be removed. I want to use other version of python, and can't make MSYS at the begining of PATH evironment variable if python2 is the dependence and installed.
d394f20There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like @ShuguangSun, I wonder whether the python dependency is necessary here at runtime. I am currently using this package as a dependency of Emacs and this pulls in python and all of its dependencies which adds substantially to the package.