summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authornicoo <nicoo@mur.at>2021-06-19 21:11:28 +0200
committernicoo <nicoo@mur.at>2021-06-19 21:15:44 +0200
commit5e06828dff0fe6b97cc215826872788b55c77397 (patch)
tree1aa2358f7382e249f234265605a08e2d5ecc4b2f /pkgs/games
parent0747387223edf1aa5beaedf48983471315d95e16 (diff)
downloadnixpkgs-5e06828dff0fe6b97cc215826872788b55c77397.tar
nixpkgs-5e06828dff0fe6b97cc215826872788b55c77397.tar.gz
nixpkgs-5e06828dff0fe6b97cc215826872788b55c77397.tar.bz2
nixpkgs-5e06828dff0fe6b97cc215826872788b55c77397.tar.lz
nixpkgs-5e06828dff0fe6b97cc215826872788b55c77397.tar.xz
nixpkgs-5e06828dff0fe6b97cc215826872788b55c77397.tar.zst
nixpkgs-5e06828dff0fe6b97cc215826872788b55c77397.zip
factorio: Fix bug in update.py
Prior to this change, `update.py` fails with `KeyError: 'alpha'` when upstream
does not have a version in the `experimental` channel:

	./update.py --username XXXXXXXX --token "$(wl-paste)"
	Traceback (most recent call last):
	  File "./update.py", line 180, in <module>
	    app.run(main)
	  File "/nix/store/854z51wg8fj1s6ghxasp1xxx8khb3r8v-python3-3.8.9-env/lib/python3.8/site-packages/absl/app.py", line 303, in run
	    _run_main(main, args)
	  File "/nix/store/854z51wg8fj1s6ghxasp1xxx8khb3r8v-python3-3.8.9-env/lib/python3.8/site-packages/absl/app.py", line 251, in _run_main
	    sys.exit(main(argv))
	  File "./update.py", line 162, in main
	    new_our_versions = generate_our_versions(factorio_versions)
	  File "./update.py", line 92, in generate_our_versions
	    version = factorio_versions[release_channel.name][release_type.name]
	KeyError: 'alpha'

I chose to make it so that the versions in nixpkgs' `factorio-*` packages are
either experimental (when available) or stable, as this seems like the most
coherent approach
Diffstat (limited to 'pkgs/games')
-rwxr-xr-xpkgs/games/factorio/update.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkgs/games/factorio/update.py b/pkgs/games/factorio/update.py
index b1cdce6b4aa..3806ba3614f 100755
--- a/pkgs/games/factorio/update.py
+++ b/pkgs/games/factorio/update.py
@@ -80,6 +80,12 @@ def fetch_versions() -> FactorioVersionsJSON:
 def generate_our_versions(factorio_versions: FactorioVersionsJSON) -> OurVersionJSON:
     rec_dd = lambda: defaultdict(rec_dd)
     output = rec_dd()
+
+    # Deal with times where there's no experimental version
+    for rc in RELEASE_CHANNELS:
+        if not factorio_versions[rc.name]:
+            factorio_versions[rc.name] = factorio_versions['stable']
+
     for system in SYSTEMS:
         for release_type in RELEASE_TYPES:
             for release_channel in RELEASE_CHANNELS: