]> git.lizzy.rs Git - cheatdb.git/blobdiff - setup.py
Fix release auto-approval
[cheatdb.git] / setup.py
index 22b80cf03e6058d75e00d4142743077b6e02091b..4fd5ff162571416e4254adc13e6a0b9b5ba7370f 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -20,9 +20,12 @@ import os, sys, datetime
 if not "FLASK_CONFIG" in os.environ:
        os.environ["FLASK_CONFIG"] = "../config.cfg"
 
-test_data = len(sys.argv) >= 2 and sys.argv[1].strip() == "-t"
+delete_db = len(sys.argv) >= 2 and sys.argv[1].strip() == "-d"
+create_db = not (len(sys.argv) >= 2 and sys.argv[1].strip() == "-o")
+test_data = len(sys.argv) >= 2 and sys.argv[1].strip() == "-t" or not create_db
 
 from app.models import *
+from app.utils import make_flask_user_password
 
 def defineDummyData(licenses, tags, ruben):
        ez = User("Shara")
@@ -36,6 +39,7 @@ def defineDummyData(licenses, tags, ruben):
 
        jeija = User("Jeija")
        jeija.github_username = "Jeija"
+       jeija.forums_username = "Jeija"
        db.session.add(jeija)
 
 
@@ -51,7 +55,7 @@ def defineDummyData(licenses, tags, ruben):
        mod.repo = "https://github.com/ezhh/other_worlds"
        mod.issueTracker = "https://github.com/ezhh/other_worlds/issues"
        mod.forums = 16015
-       mod.shortDesc = "The content library should not be used yet as it is still in alpha"
+       mod.short_desc = "The content library should not be used yet as it is still in alpha"
        mod.desc = "This is the long desc"
        db.session.add(mod)
 
@@ -73,7 +77,7 @@ def defineDummyData(licenses, tags, ruben):
        mod1.repo = "https://github.com/rubenwardy/awards"
        mod1.issueTracker = "https://github.com/rubenwardy/awards/issues"
        mod1.forums = 4870
-       mod1.shortDesc = "Adds achievements and an API to register new ones."
+       mod1.short_desc = "Adds achievements and an API to register new ones."
        mod1.desc = """
 Majority of awards are back ported from Calinou's old fork in Carbone, under same license.
 
@@ -108,7 +112,7 @@ awards.register_achievement("award_mesefind",{
        mod2.repo = "https://github.com/minetest-mods/mesecons/"
        mod2.issueTracker = "https://github.com/minetest-mods/mesecons/issues"
        mod2.forums = 628
-       mod2.shortDesc = "Mesecons adds everything digital, from all kinds of sensors, switches, solar panels, detectors, pistons, lamps, sound blocks to advanced digital circuitry like logic gates and programmable blocks."
+       mod2.short_desc = "Mesecons adds everything digital, from all kinds of sensors, switches, solar panels, detectors, pistons, lamps, sound blocks to advanced digital circuitry like logic gates and programmable blocks."
        mod2.desc = """
     ########################################################################
     ##  __    __   _____   _____   _____   _____   _____   _   _   _____  ##
@@ -206,7 +210,7 @@ No warranty is provided, express or implied, for any part of the project.
        mod.repo = "https://github.com/ezhh/handholds"
        mod.issueTracker = "https://github.com/ezhh/handholds/issues"
        mod.forums = 17069
-       mod.shortDesc = "Adds hand holds and climbing thingies"
+       mod.short_desc = "Adds hand holds and climbing thingies"
        mod.desc = "This is the long desc"
        db.session.add(mod)
 
@@ -229,7 +233,7 @@ No warranty is provided, express or implied, for any part of the project.
        mod.repo = "https://github.com/ezhh/other_worlds"
        mod.issueTracker = "https://github.com/ezhh/other_worlds/issues"
        mod.forums = 16015
-       mod.shortDesc = "Adds space with asteroids and comets"
+       mod.short_desc = "Adds space with asteroids and comets"
        mod.desc = "This is the long desc"
        db.session.add(mod)
 
@@ -244,7 +248,7 @@ No warranty is provided, express or implied, for any part of the project.
        mod.repo = "https://github.com/rubenwardy/food/"
        mod.issueTracker = "https://github.com/rubenwardy/food/issues/"
        mod.forums = 2960
-       mod.shortDesc = "Adds lots of food and an API to manage ingredients"
+       mod.short_desc = "Adds lots of food and an API to manage ingredients"
        mod.desc = "This is the long desc"
        food = mod
        db.session.add(mod)
@@ -260,8 +264,9 @@ No warranty is provided, express or implied, for any part of the project.
        mod.repo = "https://github.com/rubenwardy/food_sweet/"
        mod.issueTracker = "https://github.com/rubenwardy/food_sweet/issues/"
        mod.forums = 9039
-       mod.shortDesc = "Adds sweet food"
+       mod.short_desc = "Adds sweet food"
        mod.desc = "This is the long desc"
+       food_sweet = mod
        db.session.add(mod)
 
        game1 = Package()
@@ -277,7 +282,7 @@ No warranty is provided, express or implied, for any part of the project.
        game1.repo = "https://github.com/rubenwardy/capturetheflag"
        game1.issueTracker = "https://github.com/rubenwardy/capturetheflag/issues"
        game1.forums = 12835
-       game1.shortDesc = "Two teams battle to snatch and return the enemy's flag, before the enemy takes their own!"
+       game1.short_desc = "Two teams battle to snatch and return the enemy's flag, before the enemy takes their own!"
        game1.desc = """
 As seen on the Capture the Flag server (minetest.rubenwardy.com:30000)
 
@@ -302,7 +307,7 @@ Uses the CTF PvP Engine.
        mod.type = PackageType.TXP
        mod.author = ruben
        mod.forums = 14132
-       mod.shortDesc = "This is an update of the original PixelBOX texture pack by the brillant artist Gambit"
+       mod.short_desc = "This is an update of the original PixelBOX texture pack by the brillant artist Gambit"
        mod.desc = "This is the long desc"
        db.session.add(mod)
 
@@ -326,16 +331,23 @@ Uses the CTF PvP Engine.
                        metas[package.name] = meta
                package.provides.append(meta)
 
+       dep = Dependency(food_sweet, meta=metas["food"])
+       db.session.add(dep)
+
 
-delete_db = len(sys.argv) >= 2 and sys.argv[1].strip() == "-d"
 if delete_db and os.path.isfile("db.sqlite"):
        os.remove("db.sqlite")
 
-print("Creating database tables...")
-db.create_all()
+
+if create_db:
+       print("Creating database tables...")
+       db.create_all()
+
 print("Filling database...")
 
 ruben = User("rubenwardy")
+ruben.active = True
+ruben.password = make_flask_user_password("tuckfrump")
 ruben.github_username = "rubenwardy"
 ruben.forums_username = "rubenwardy"
 ruben.rank = UserRank.ADMIN
@@ -353,11 +365,16 @@ for tag in ["Inventory", "Mapgen", "Building", \
 licenses = {}
 for license in ["GPLv2.1", "GPLv3", "LGPLv2.1", "LGPLv3", "AGPLv2.1", "AGPLv3",
                                "Apache", "BSD 3-Clause", "BSD 2-Clause", "CC0", "CC-BY-SA",
-                               "CC-BY", "CC-BY-NC-SA", "MIT", "ZLib"]:
+                               "CC-BY", "MIT", "ZLib", "Other (Free)"]:
        row = License(license)
        licenses[row.name] = row
        db.session.add(row)
 
+for license in ["CC-BY-NC-SA", "Other (Non-free)"]:
+       row = License(license, False)
+       licenses[row.name] = row
+       db.session.add(row)
+
 if test_data:
        defineDummyData(licenses, tags, ruben)