Skip to content

Commit

Permalink
Merge pull request #1474 from wingtk/glib-fix-shebang
Browse files Browse the repository at this point in the history
Fix GLib scripts when Python path contains spaces
  • Loading branch information
danyeaw authored Dec 16, 2024
2 parents f7c7766 + 878aacd commit d70c4cf
Show file tree
Hide file tree
Showing 7 changed files with 220 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
Subject: [PATCH] Windows: fix Python path can contain spaces
---
Index: gio/gdbus-2.0/codegen/gdbus-codegen.in
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/gio/gdbus-2.0/codegen/gdbus-codegen.in b/gio/gdbus-2.0/codegen/gdbus-codegen.in
--- a/gio/gdbus-2.0/codegen/gdbus-codegen.in (revision 558cb16f190fef3c08c3e9345e30b10bde1c0aec)
+++ b/gio/gdbus-2.0/codegen/gdbus-codegen.in (revision 5ef74ffcc090e25c970652242a29eefa5b18e67c)
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!/usr/bin/env python3

# GDBus - GLib D-Bus Library
#
Index: gio/gdbus-2.0/codegen/meson.build
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/gio/gdbus-2.0/codegen/meson.build b/gio/gdbus-2.0/codegen/meson.build
--- a/gio/gdbus-2.0/codegen/meson.build (revision 558cb16f190fef3c08c3e9345e30b10bde1c0aec)
+++ b/gio/gdbus-2.0/codegen/meson.build (revision 5ef74ffcc090e25c970652242a29eefa5b18e67c)
@@ -31,7 +31,6 @@
gdbus_codegen_conf.set('VERSION', glib_version)
gdbus_codegen_conf.set('MAJOR_VERSION', major_version)
gdbus_codegen_conf.set('MINOR_VERSION', minor_version)
-gdbus_codegen_conf.set('PYTHON', python.full_path())
gdbus_codegen_conf.set('DATADIR', glib_datadir)

# Install gdbus-codegen executable
Index: glib/gtester-report.in
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/glib/gtester-report.in b/glib/gtester-report.in
--- a/glib/gtester-report.in (revision 558cb16f190fef3c08c3e9345e30b10bde1c0aec)
+++ b/glib/gtester-report.in (revision 5ef74ffcc090e25c970652242a29eefa5b18e67c)
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#! /usr/bin/env python3
# GLib Testing Framework Utility -*- Mode: python; -*-
# Copyright (C) 2007 Imendio AB
# Authors: Tim Janik
Index: glib/meson.build
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/glib/meson.build b/glib/meson.build
--- a/glib/meson.build (revision 558cb16f190fef3c08c3e9345e30b10bde1c0aec)
+++ b/glib/meson.build (revision 5ef74ffcc090e25c970652242a29eefa5b18e67c)
@@ -501,7 +501,6 @@

report_conf = configuration_data()
report_conf.set('GLIB_VERSION', glib_version)
-report_conf.set('PYTHON', python.full_path())
configure_file(
input: 'gtester-report.in',
output: 'gtester-report',
Index: gobject/glib-genmarshal.in
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/gobject/glib-genmarshal.in b/gobject/glib-genmarshal.in
--- a/gobject/glib-genmarshal.in (revision 558cb16f190fef3c08c3e9345e30b10bde1c0aec)
+++ b/gobject/glib-genmarshal.in (revision 5ef74ffcc090e25c970652242a29eefa5b18e67c)
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!/usr/bin/env python3

# pylint: disable=too-many-lines, missing-docstring, invalid-name

Index: gobject/glib-mkenums.in
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in
--- a/gobject/glib-mkenums.in (revision 558cb16f190fef3c08c3e9345e30b10bde1c0aec)
+++ b/gobject/glib-mkenums.in (revision 5ef74ffcc090e25c970652242a29eefa5b18e67c)
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!/usr/bin/env python3

# If the code below looks horrible and unpythonic, do not panic.
#
Index: gobject/meson.build
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/gobject/meson.build b/gobject/meson.build
--- a/gobject/meson.build (revision 558cb16f190fef3c08c3e9345e30b10bde1c0aec)
+++ b/gobject/meson.build (revision 5ef74ffcc090e25c970652242a29eefa5b18e67c)
@@ -85,7 +85,6 @@

python_tools_conf = configuration_data()
python_tools_conf.set('VERSION', glib_version)
-python_tools_conf.set('PYTHON', python.full_path())

foreach tool: python_tools
tool_bin = configure_file(
106 changes: 106 additions & 0 deletions gvsbuild/patches/glib/004-fix-python-path-can-contain-spaces.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
Subject: [PATCH] Windows: fix Python path can contain spaces
---
Index: gio/gdbus-2.0/codegen/gdbus-codegen.in
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/gio/gdbus-2.0/codegen/gdbus-codegen.in b/gio/gdbus-2.0/codegen/gdbus-codegen.in
--- a/gio/gdbus-2.0/codegen/gdbus-codegen.in (revision 558cb16f190fef3c08c3e9345e30b10bde1c0aec)
+++ b/gio/gdbus-2.0/codegen/gdbus-codegen.in (revision 5ef74ffcc090e25c970652242a29eefa5b18e67c)
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!/usr/bin/env python3

# GDBus - GLib D-Bus Library
#
Index: gio/gdbus-2.0/codegen/meson.build
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/gio/gdbus-2.0/codegen/meson.build b/gio/gdbus-2.0/codegen/meson.build
--- a/gio/gdbus-2.0/codegen/meson.build (revision 558cb16f190fef3c08c3e9345e30b10bde1c0aec)
+++ b/gio/gdbus-2.0/codegen/meson.build (revision 5ef74ffcc090e25c970652242a29eefa5b18e67c)
@@ -31,7 +31,6 @@
gdbus_codegen_conf.set('VERSION', glib_version)
gdbus_codegen_conf.set('MAJOR_VERSION', major_version)
gdbus_codegen_conf.set('MINOR_VERSION', minor_version)
-gdbus_codegen_conf.set('PYTHON', python.full_path())
gdbus_codegen_conf.set('DATADIR', glib_datadir)

# Install gdbus-codegen executable
Index: glib/gtester-report.in
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/glib/gtester-report.in b/glib/gtester-report.in
--- a/glib/gtester-report.in (revision 558cb16f190fef3c08c3e9345e30b10bde1c0aec)
+++ b/glib/gtester-report.in (revision 5ef74ffcc090e25c970652242a29eefa5b18e67c)
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#! /usr/bin/env python3
# GLib Testing Framework Utility -*- Mode: python; -*-
# Copyright (C) 2007 Imendio AB
# Authors: Tim Janik
Index: glib/meson.build
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/glib/meson.build b/glib/meson.build
--- a/glib/meson.build (revision 558cb16f190fef3c08c3e9345e30b10bde1c0aec)
+++ b/glib/meson.build (revision 5ef74ffcc090e25c970652242a29eefa5b18e67c)
@@ -501,7 +501,6 @@

report_conf = configuration_data()
report_conf.set('GLIB_VERSION', glib_version)
-report_conf.set('PYTHON', python.full_path())
configure_file(
input: 'gtester-report.in',
output: 'gtester-report',
Index: gobject/glib-genmarshal.in
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/gobject/glib-genmarshal.in b/gobject/glib-genmarshal.in
--- a/gobject/glib-genmarshal.in (revision 558cb16f190fef3c08c3e9345e30b10bde1c0aec)
+++ b/gobject/glib-genmarshal.in (revision 5ef74ffcc090e25c970652242a29eefa5b18e67c)
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!/usr/bin/env python3

# pylint: disable=too-many-lines, missing-docstring, invalid-name

Index: gobject/glib-mkenums.in
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in
--- a/gobject/glib-mkenums.in (revision 558cb16f190fef3c08c3e9345e30b10bde1c0aec)
+++ b/gobject/glib-mkenums.in (revision 5ef74ffcc090e25c970652242a29eefa5b18e67c)
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!/usr/bin/env python3

# If the code below looks horrible and unpythonic, do not panic.
#
Index: gobject/meson.build
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/gobject/meson.build b/gobject/meson.build
--- a/gobject/meson.build (revision 558cb16f190fef3c08c3e9345e30b10bde1c0aec)
+++ b/gobject/meson.build (revision 5ef74ffcc090e25c970652242a29eefa5b18e67c)
@@ -85,7 +85,6 @@

python_tools_conf = configuration_data()
python_tools_conf.set('VERSION', glib_version)
-python_tools_conf.set('PYTHON', python.full_path())

foreach tool: python_tools
tool_bin = configure_file(
12 changes: 8 additions & 4 deletions gvsbuild/projects/glib.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ def __init__(self):
],
patches=[
"001-glib-package-installation-directory.patch",
"0001-gsocket-windows-check-event-before-calling-WSAEnumNe.patch",
"0001-gpoll-windows-use-a-threadpool-when-polling-large-nu.patch",
"002-gsocket-windows-check-event-before-calling-WSAEnumNe.patch",
"003-gpoll-windows-use-a-threadpool-when-polling-large-nu.patch",
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4391
"004-fix-python-path-can-contain-spaces.patch",
],
)
self.add_param("-Dman-pages=disabled")
Expand Down Expand Up @@ -72,8 +74,10 @@ def __init__(self):
dependencies=["glib-base"],
patches=[
"001-glib-package-installation-directory.patch",
"0001-gsocket-windows-check-event-before-calling-WSAEnumNe.patch",
"0001-gpoll-windows-use-a-threadpool-when-polling-large-nu.patch",
"002-gsocket-windows-check-event-before-calling-WSAEnumNe.patch",
"003-gpoll-windows-use-a-threadpool-when-polling-large-nu.patch",
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4391
"004-fix-python-path-can-contain-spaces.patch",
],
)
self.add_param("-Dman-pages=disabled")
Expand Down

0 comments on commit d70c4cf

Please sign in to comment.