[game-data-packager] 01/02: Add a script to open URLs, replacing our use of xdg-open

Simon McVittie smcv at debian.org
Sun Oct 9 22:31:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository game-data-packager.

commit 386f785921ca260ba73659891d021e4330ae3ba6
Author: Simon McVittie <smcv at debian.org>
Date:   Sun Oct 9 23:18:45 2016 +0100

    Add a script to open URLs, replacing our use of xdg-open
    
    Unlike xdg-open, this one can escape from inside a Flatpak
    using GLib's portal integration, which will hopefully be useful
    when I've taught g-d-p to build Flatpak extensions.
---
 Makefile            |  1 +
 data/etqw.yaml      |  9 +++++----
 data/quake4.yaml    |  9 +++++----
 debian/copyright    |  8 ++++++++
 debian/copyright.in |  8 ++++++++
 runtime/openurl.py  | 21 +++++++++++++++++++++
 6 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 2bb60b9..47fa316 100644
--- a/Makefile
+++ b/Makefile
@@ -122,6 +122,7 @@ install:
 
 	install -d                                             $(DESTDIR)$(runtimedir)/
 	install runtime/launcher.py                            $(DESTDIR)$(runtimedir)/gdp-launcher
+	install runtime/openurl.py                             $(DESTDIR)$(runtimedir)/gdp-openurl
 	install -m0644 out/*.desktop                           $(DESTDIR)$(runtimedir)/
 	install -m0644 runtime/confirm-binary-only.txt         $(DESTDIR)$(runtimedir)/
 	install -m0644 runtime/missing-data.txt                $(DESTDIR)$(runtimedir)/
diff --git a/data/etqw.yaml b/data/etqw.yaml
index b1b9886..3e8d054 100644
--- a/data/etqw.yaml
+++ b/data/etqw.yaml
@@ -35,12 +35,12 @@ packages:
     version: "1.5"
     depends:
       - etqw-data
+      - game-data-packager-runtime
       - libc.so.6 (>= 2.2.4)
       - libgcc_s.so.1 (>= 4.1.2)
       - libjpeg.so.62
       - libSDL-1.2.so.0 (>= 1.2.10)
       - libstdc++.so.6 (>= 4.1.2)
-      - deb: xdg-utils
     suggests:
       - etqw-pb-bin
     install:
@@ -51,9 +51,10 @@ packages:
     - patch 1.4 to 1.5 - licenses
     symlinks:
       $prefix/lib/etqw/base: $assets/etqw/base
-      # The bundled implementation isn't great, and xdg-open is
-      # binary-compatible
-      $prefix/lib/etqw/openurl.sh: /usr/bin/xdg-open
+      # The bundled implementation is some horrible shell script, and the
+      # one provided by gdp-runtime can open URLs on the host system from
+      # inside a Flatpak.
+      $prefix/lib/etqw/openurl.sh: $assets/game-data-packager-runtime/gdp-openurl
 
   etqw-data:
     version: "1.5"
diff --git a/data/quake4.yaml b/data/quake4.yaml
index bd8a941..d6638b8 100644
--- a/data/quake4.yaml
+++ b/data/quake4.yaml
@@ -36,13 +36,13 @@ packages:
     architecture: i386
     version: "1.4.2"
     depends:
+      - game-data-packager-runtime
       - libc.so.6 (>= 2.2.4)
       - libgcc_s.so.1 (>= 4.1.2)
       - libSDL-1.2.so.0 (>= 1.2.10)
       - libstdc++.so.6 (>= 4.1.2)
       - deb: quake4-data | quake4-censored-de-data
         generic: quake4-any-data
-      - deb: xdg-utils
     suggests:
       - quake4-pb-bin
     install:
@@ -50,9 +50,10 @@ packages:
     symlinks:
       $prefix/lib/quake4/q4base: $assets/quake4/q4base
       $prefix/lib/quake4/q4mp: $assets/quake4/q4mp
-      # The bundled implementation isn't great, and xdg-open is
-      # binary-compatible
-      $prefix/lib/quake4/openurl.sh: /usr/bin/xdg-open
+      # The bundled implementation is some horrible shell script, and the
+      # one provided by gdp-runtime can open URLs on the host system from
+      # inside a Flatpak.
+      $prefix/lib/quake4/openurl.sh: $assets/game-data-packager-runtime/gdp-openurl
       $prefix/lib/quake4/version.info: $assets/quake4/version.info
       $prefix/lib/quake4/q4icon.bmp: $assets/quake4/q4icon.bmp
 
diff --git a/debian/copyright b/debian/copyright
index ec89ddf..9cb7f0e 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -43,6 +43,14 @@ License: GPL-2+
  /usr/share/common-licenses/GPL-2.
 
 Files:
+ runtime/openurl.py
+Copyright:
+ © 2016 Simon McVittie
+License: ikiwiki-basewiki
+  Redistribution and use in source and compiled forms, with or without
+  modification, are permitted under any circumstances. No warranty.
+
+Files:
  data/draci.xpm
 Copyright:
  © 1995 NoSense
diff --git a/debian/copyright.in b/debian/copyright.in
index 3943bf0..d0809d3 100644
--- a/debian/copyright.in
+++ b/debian/copyright.in
@@ -41,6 +41,14 @@ License: GPL-2+
  /usr/share/common-licenses/GPL-2.
 
 Files:
+ runtime/openurl.py
+Copyright:
+ © 2016 Simon McVittie
+License: ikiwiki-basewiki
+  Redistribution and use in source and compiled forms, with or without
+  modification, are permitted under any circumstances. No warranty.
+
+Files:
  data/draci.xpm
 Copyright:
  © 1995 NoSense
diff --git a/runtime/openurl.py b/runtime/openurl.py
new file mode 100755
index 0000000..f4be3cf
--- /dev/null
+++ b/runtime/openurl.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python3
+# encoding=utf-8
+
+# Open a URL. Command-line compatible with the openurl.sh provided with
+# Quake 4, but a lot simpler, and with Flatpak support (via GLib and
+# xdg-desktop-portal).
+
+# Copyright © 2016 Simon McVittie <smcv at debian.org>
+# Redistribution and use in source and compiled forms, with or without
+# modification, are permitted under any circumstances. No warranty.
+
+import argparse
+
+from gi.repository import Gio
+
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser(description='Open a URL')
+    parser.add_argument('url')
+    args = parser.parse_args()
+
+    Gio.AppInfo.launch_default_for_uri(args.url)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list