[game-data-packager] 07/11: Expand ${assets} at install-time in launcher (runtime) data
Simon McVittie
smcv at debian.org
Wed Jan 13 00:06:51 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 b254ee7f58957392f79e3ce9efb256e44c3cdf60
Author: Simon McVittie <smcv at debian.org>
Date: Wed Jan 13 00:05:21 2016 +0000
Expand ${assets} at install-time in launcher (runtime) data
This means we can drop the special-case for where Arch installs Doom,
which appears to have been just to support the .desktop file.
---
Makefile | 13 +++++++--
game_data_packager/games/doom_common.py | 5 +---
...evels.desktop => doom2-masterlevels.desktop.in} | 2 +-
...unreal-gold.yaml => launch-unreal-gold.yaml.in} | 8 +++---
.../{launch-unreal.yaml => launch-unreal.yaml.in} | 6 ++--
...{unreal-gold.desktop => unreal-gold.desktop.in} | 4 +--
runtime/{unreal.desktop => unreal.desktop.in} | 4 +--
tools/expand_vars.py | 32 ++++++++++++++++++++++
8 files changed, 55 insertions(+), 19 deletions(-)
diff --git a/Makefile b/Makefile
index fb0b1e7..e9f6449 100644
--- a/Makefile
+++ b/Makefile
@@ -25,10 +25,13 @@ png += out/memento-mori.png
svgz := $(patsubst ./data/%.svg,./out/%.svgz,$(filter-out ./data/memento-mori-2.svg,$(wildcard ./data/*.svg)))
in_yaml := $(wildcard ./data/*.yaml)
json := $(patsubst ./data/%.yaml,./out/vfs/%.json,$(in_yaml))
+json += $(patsubst ./runtime/%.yaml.in,./out/%.json,$(wildcard ./runtime/*.yaml.in))
copyright := $(patsubst ./data/%,./out/%,$(wildcard ./data/*.copyright))
dot_in := $(patsubst ./data/%,./out/%,$(wildcard ./data/*.in))
+desktop := $(patsubst ./runtime/%.in,./out/%,$(wildcard ./runtime/*.desktop.in))
default: $(png) $(svgz) $(json) $(copyright) $(dot_in) \
+ $(desktop) \
out/bash_completion out/changelog.gz out/copyright \
out/game-data-packager out/vfs.zip out/memento-mori-2.svg
@@ -85,10 +88,14 @@ out/%.png: data/%.svg
out/%.svgz: out/%.svg
gzip -nc $< > $@
-out/launch-%.json: runtime/launch-%.yaml
+out/launch-%.json: out/launch-%.yaml
mkdir -p out
$(PYTHON) tools/yaml2json.py $< $@
+out/%: runtime/%.in
+ mkdir -p out
+ PYTHONPATH=. $(PYTHON) tools/expand_vars.py $< $@
+
clean:
rm -f ./out/bash_completion
rm -f ./out/changelog.gz
@@ -132,7 +139,7 @@ install:
install -m0644 out/vfs.zip $(DESTDIR)$(datadir)/game-data-packager/
install runtime/launcher.py $(DESTDIR)$(datadir)/game-data-packager/gdp-launcher
- install -m0644 runtime/*.desktop $(DESTDIR)$(datadir)/game-data-packager/
+ install -m0644 out/*.desktop $(DESTDIR)$(datadir)/game-data-packager/
install -m0644 runtime/confirm-binary-only.txt $(DESTDIR)$(datadir)/game-data-packager/
install -m0644 runtime/missing-data.txt $(DESTDIR)$(datadir)/game-data-packager/
install -m0644 out/launch-*.json $(DESTDIR)$(datadir)/game-data-packager/
@@ -155,7 +162,7 @@ endif
mkdir -p $(DESTDIR)/usr/share/applications
mkdir -p $(DESTDIR)/usr/share/pixmaps
install -m0755 runtime/doom2-masterlevels.py $(DESTDIR)$(bindir)/doom2-masterlevels
- install -m0644 runtime/doom2-masterlevels.desktop $(DESTDIR)/usr/share/applications/
+ install -m0644 out/doom2-masterlevels.desktop $(DESTDIR)/usr/share/applications/
install -m0644 doc/doom2-masterlevels.6 $(DESTDIR)/usr/share/man/man6/
install -m0644 out/doom-common.png $(DESTDIR)/usr/share/pixmaps/doom2-masterlevels.png
diff --git a/game_data_packager/games/doom_common.py b/game_data_packager/games/doom_common.py
index a2fb992..e09094b 100644
--- a/game_data_packager/games/doom_common.py
+++ b/game_data_packager/games/doom_common.py
@@ -77,10 +77,7 @@ class DoomGameData(GameData):
}
for package in self.packages.values():
- if FORMAT == 'arch':
- package.install_to = 'usr/share/games/doom'
- else:
- package.install_to = '$assets/doom'
+ package.install_to = '$assets/doom'
engine = package.engine or self.engine
engine = engine.split('|')[-1].strip()
package.program = package_map.get(engine, engine)
diff --git a/runtime/doom2-masterlevels.desktop b/runtime/doom2-masterlevels.desktop.in
similarity index 78%
rename from runtime/doom2-masterlevels.desktop
rename to runtime/doom2-masterlevels.desktop.in
index 3cbf41b..0b3b272 100644
--- a/runtime/doom2-masterlevels.desktop
+++ b/runtime/doom2-masterlevels.desktop.in
@@ -2,7 +2,7 @@
Name=Doom 2: Master Levels
GenericName=First Person Shooter Game
Exec=doom2-masterlevels
-TryExec=/usr/share/games/doom/doom2-masterlevels-tryexec
+TryExec=/$assets/doom2-masterlevels-tryexec
Icon=doom2-masterlevels
Terminal=false
Type=Application
diff --git a/runtime/launch-unreal-gold.yaml b/runtime/launch-unreal-gold.yaml.in
similarity index 63%
rename from runtime/launch-unreal-gold.yaml
rename to runtime/launch-unreal-gold.yaml.in
index 62a4303..f950bc9 100644
--- a/runtime/launch-unreal-gold.yaml
+++ b/runtime/launch-unreal-gold.yaml.in
@@ -8,12 +8,12 @@ required_files:
base_directories:
- /usr/lib/unreal-gold
- /usr/lib/unreal
- - /usr/share/games/unreal-gold
- - /usr/share/games/unreal
- - /usr/share/games/unreal-ut99-shared
+ - /$assets/unreal-gold
+ - /$assets/unreal
+ - /$assets/unreal-ut99-shared
link_files: true
copy_files: ["*.ini"]
-working_directory: ${XDG_DATA_HOME}/unreal-gold/System
+working_directory: $${XDG_DATA_HOME}/unreal-gold/System
library_path: ["."]
argv: [./UnrealLinux.bin]
...
diff --git a/runtime/launch-unreal.yaml b/runtime/launch-unreal.yaml.in
similarity index 70%
rename from runtime/launch-unreal.yaml
rename to runtime/launch-unreal.yaml.in
index dcc7806..c400e32 100644
--- a/runtime/launch-unreal.yaml
+++ b/runtime/launch-unreal.yaml.in
@@ -8,11 +8,11 @@ required_files:
base_directories:
- /usr/lib/unreal-classic
- /usr/lib/unreal
- - /usr/share/games/unreal
- - /usr/share/games/unreal-ut99-shared
+ - /$assets/unreal
+ - /$assets/unreal-ut99-shared
link_files: true
copy_files: ["*.ini"]
-working_directory: ${XDG_DATA_HOME}/unreal/System
+working_directory: $${XDG_DATA_HOME}/unreal/System
library_path: ["."]
argv: [./UnrealLinux.bin]
...
diff --git a/runtime/unreal-gold.desktop b/runtime/unreal-gold.desktop.in
similarity index 78%
rename from runtime/unreal-gold.desktop
rename to runtime/unreal-gold.desktop.in
index da5f0cd..d326833 100644
--- a/runtime/unreal-gold.desktop
+++ b/runtime/unreal-gold.desktop.in
@@ -1,8 +1,8 @@
[Desktop Entry]
Version=1.0
Name=Unreal Gold
-Exec=/usr/games/unreal-gold
-TryExec=/usr/games/unreal-gold
+Exec=${bindir}/unreal-gold
+TryExec=${bindir}/unreal-gold
Icon=unreal
Terminal=false
Type=Application
diff --git a/runtime/unreal.desktop b/runtime/unreal.desktop.in
similarity index 81%
rename from runtime/unreal.desktop
rename to runtime/unreal.desktop.in
index b2b0dce..b591ff2 100644
--- a/runtime/unreal.desktop
+++ b/runtime/unreal.desktop.in
@@ -1,8 +1,8 @@
[Desktop Entry]
Version=1.0
Name=Unreal
-Exec=/usr/games/unreal
-TryExec=/usr/games/unreal
+Exec=${bindir}/unreal
+TryExec=${bindir}/unreal
Icon=unreal
Terminal=false
Type=Application
diff --git a/tools/expand_vars.py b/tools/expand_vars.py
new file mode 100644
index 0000000..90195f7
--- /dev/null
+++ b/tools/expand_vars.py
@@ -0,0 +1,32 @@
+#!/usr/bin/python3
+# encoding=utf-8
+#
+# Copyright © 2016 Simon McVittie <smcv at debian.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# You can find the GPL license text on a Debian system under
+# /usr/share/common-licenses/GPL-2.
+
+import os
+import sys
+
+from game_data_packager.packaging import (get_native_packaging_system)
+
+def main(f, out):
+ data = open(f, encoding='utf-8').read()
+ data = get_native_packaging_system().substitute(data,
+ 'unknown-package-name')
+ open(out + '.tmp', 'w', encoding='utf-8').write(data)
+ os.rename(out + '.tmp', out)
+
+if __name__ == '__main__':
+ main(sys.argv[1], sys.argv[2])
+
--
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