From 94927cbbc0b2aa90583690164b93191801923ad2 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Mon, 2 Nov 2020 14:21:24 +0200 Subject: [PATCH] add a get-up-and-running script See: https://sourceforge.net/p/pysolfc/discussion/503709/thread/b37cd50f/ --- README.md | 8 ++++++- scripts/linux-install.py | 48 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100755 scripts/linux-install.py diff --git a/README.md b/README.md index 2e186eae..e418a070 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,12 @@ After following steps similar to these (on #### Step 1 - install the dependencies +On Fedora you can do: + +``` +sudo dnf builddep PySolFC +``` + On Mageia you can do: ``` @@ -75,7 +81,7 @@ cd PySolFC gmake test gmake rules ln -s data/images images -tar -xvf PySolFC-Cardsets-2.0.tar.bz2 # Need to be downloaded from sourceforge +tar -xvf PySolFC-Cardsets-2.0.tar.bz2 # Needs to be downloaded from sourceforge mkdir -p ~/.PySolFC rmdir ~/.PySolFC/cardsets ln -s "`pwd`/PySolFC-Cardsets-2.0" ~/.PySolFC/cardsets diff --git a/scripts/linux-install.py b/scripts/linux-install.py new file mode 100755 index 00000000..dd92a2d0 --- /dev/null +++ b/scripts/linux-install.py @@ -0,0 +1,48 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# vim:fenc=utf-8 +# +# Copyright © 2020 Shlomi Fish < https://www.shlomifish.org/ > +# +# Licensed under the terms of the MIT license. + +""" + +""" + +import os +import os.path +import subprocess +from subprocess import check_call + + +def main(): + os.environ['TEST_TAGS'] = " SKIP_GTK SKIP_PY2 " + try: + subprocess.check_call(["gmake", "test", "rules"]) + except subprocess.CalledProcessError: + subprocess.check_call(["make", "test", "rules"]) + + if not os.path.exists("./images"): + os.symlink("./data/images/", "./images") + home = os.environ['HOME'] + dot_pysol = home + "/.PySolFC" + dot_pysol_cardsets = dot_pysol + "/cardsets" + if not os.path.exists("./images"): + os.symlink("./data/images/", "./images") + if not os.path.exists(dot_pysol): + os.mkdir(dot_pysol) + if not os.path.exists(dot_pysol_cardsets): + cardsets_dir = "PySolFC-Cardsets-2.0" + if not os.path.exists(cardsets_dir): + arc = cardsets_dir + ".tar.gz" + if not os.path.exists(arc): + check_call([ + "wget", + "https://github.com/shlomif/" + + "PySolFC-Cardsets/archive/2.0/" + arc]) + subprocess.check_call(["tar", "-xvf", arc]) + os.symlink(dot_pysol_cardsets, os.getcwd() + "/" + cardsets_dir) + + +main()