]> git.lizzy.rs Git - cheatdb.git/blob - setup.py
Add non-free warning
[cheatdb.git] / setup.py
1 # Content DB
2 # Copyright (C) 2018  rubenwardy
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
16
17
18 import os, sys, datetime
19
20 if not "FLASK_CONFIG" in os.environ:
21         os.environ["FLASK_CONFIG"] = "../config.cfg"
22
23 test_data = len(sys.argv) >= 2 and sys.argv[1].strip() == "-t"
24
25 from app.models import *
26
27 def defineDummyData(licenses, tags, ruben):
28         ez = User("Shara")
29         ez.github_username = "Ezhh"
30         ez.forums_username = "Shara"
31         ez.rank = UserRank.EDITOR
32         db.session.add(ez)
33
34         not1 = Notification(ruben, ez, "Awards approved", "/packages/rubenwardy/awards/")
35         db.session.add(not1)
36
37         jeija = User("Jeija")
38         jeija.github_username = "Jeija"
39         jeija.forums_username = "Jeija"
40         db.session.add(jeija)
41
42
43         mod = Package()
44         mod.approved = True
45         mod.name = "alpha"
46         mod.title = "Alpha Test"
47         mod.license = licenses["MIT"]
48         mod.type = PackageType.MOD
49         mod.author = ruben
50         mod.tags.append(tags["mapgen"])
51         mod.tags.append(tags["environment"])
52         mod.repo = "https://github.com/ezhh/other_worlds"
53         mod.issueTracker = "https://github.com/ezhh/other_worlds/issues"
54         mod.forums = 16015
55         mod.shortDesc = "The content library should not be used yet as it is still in alpha"
56         mod.desc = "This is the long desc"
57         db.session.add(mod)
58
59         rel = PackageRelease()
60         rel.package = mod
61         rel.title = "v1.0.0"
62         rel.url = "https://github.com/ezhh/handholds/archive/master.zip"
63         rel.approved = True
64         db.session.add(rel)
65
66         mod1 = Package()
67         mod1.approved = True
68         mod1.name = "awards"
69         mod1.title = "Awards"
70         mod1.license = licenses["LGPLv2.1"]
71         mod1.type = PackageType.MOD
72         mod1.author = ruben
73         mod1.tags.append(tags["player_effects"])
74         mod1.repo = "https://github.com/rubenwardy/awards"
75         mod1.issueTracker = "https://github.com/rubenwardy/awards/issues"
76         mod1.forums = 4870
77         mod1.shortDesc = "Adds achievements and an API to register new ones."
78         mod1.desc = """
79 Majority of awards are back ported from Calinou's old fork in Carbone, under same license.
80
81 ```
82 awards.register_achievement("award_mesefind",{
83     title = "First Mese Find",
84     description = "Found some Mese!",
85     trigger = {
86         type   = "dig",          -- award is given when
87         node   = "default:mese", -- this type of node has been dug
88         target = 1,              -- this number of times
89     },
90 })
91 ```
92 """
93
94         rel = PackageRelease()
95         rel.package = mod1
96         rel.title = "v1.0.0"
97         rel.url = "https://github.com/rubenwardy/awards/archive/master.zip"
98         rel.approved = True
99         db.session.add(rel)
100
101         mod2 = Package()
102         mod2.approved = True
103         mod2.name = "mesecons"
104         mod2.title = "Mesecons"
105         mod2.tags.append(tags["tools"])
106         mod2.type = PackageType.MOD
107         mod2.license = licenses["LGPLv3"]
108         mod2.author = jeija
109         mod2.repo = "https://github.com/minetest-mods/mesecons/"
110         mod2.issueTracker = "https://github.com/minetest-mods/mesecons/issues"
111         mod2.forums = 628
112         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."
113         mod2.desc = """
114     ########################################################################
115     ##  __    __   _____   _____   _____   _____   _____   _   _   _____  ##
116     ## |  \  /  | |  ___| |  ___| |  ___| |  ___| |  _  | | \ | | |  ___| ##
117     ## |   \/   | | |___  | |___  | |___  | |     | | | | |  \| | | |___  ##
118     ## | |\__/| | |  ___| |___  | |  ___| | |     | | | | |     | |___  | ##
119     ## | |    | | | |___   ___| | | |___  | |___  | |_| | | |\  |  ___| | ##
120     ## |_|    |_| |_____| |_____| |_____| |_____| |_____| |_| \_| |_____| ##
121     ##                                                                    ##
122     ########################################################################
123
124 MESECONS by Jeija and contributors
125
126 Mezzee-what?
127 ------------
128 [Mesecons](http://mesecons.net/)! They're yellow, they're conductive, and they'll add a whole new dimension to Minetest's gameplay.
129
130 Mesecons is a mod for [Minetest](http://minetest.net/) that implements a ton of items related to digital circuitry, such as wires, buttons, lights, and even programmable controllers. Among other things, there are also pistons, solar panels, pressure plates, and note blocks.
131
132 Mesecons has a similar goal to Redstone in Minecraft, but works in its own way, with different rules and mechanics.
133
134 OK, I want in.
135 --------------
136 Go get it!
137
138 [DOWNLOAD IT NOW](https://github.com/minetest-mods/mesecons/archive/master.zip)
139
140 Now go ahead and install it like any other Minetest mod. Don't know how? Check out [the wonderful page about it](http://wiki.minetest.com/wiki/Mods) over at the Minetest Wiki. For your convenience, here's a quick summary:
141
142 1. If Mesecons is still in a ZIP file, extract the folder inside to somewhere on the computer.
143 2. Make sure that when you open the folder, you can directly find `README.md` in the listing. If you just see another folder, move that folder up one level and delete the old one.
144 3. Open up the Minetest mods folder - usually `/mods/`. If you see the `minetest` or folder inside of that, that is your mod folder instead.
145 4. Copy the Mesecons folder into the mods folder.
146
147 Don't like some parts of Mesecons? Open up the Mesecons folder and delete the subfolder containing the mod you don't want. If you didn't want movestones, for example, all you have to do is delete the `mesecons_movestones` folder and they will no longer be available.
148
149 There are no dependencies - it will work right after installing!
150
151 How do I use this thing?
152 ------------------------
153 How about a [quick overview video](https://www.youtube.com/watch?v=6kmeQj6iW5k)?
154
155 Or maybe a [comprehensive reference](http://mesecons.net/items.html) is your style?
156
157 An overview for the very newest of new beginners? How does [this one](http://uberi.mesecons.net/projects/MeseconsBasics/index.html) look?
158
159 Want to get more into building? Why not check out the [Mesecons Laboratory](http://uberi.mesecons.net/), a website dedicated to advanced Mesecons builders?
160
161 Want to contribute to Mesecons itself? Check out the [source code](https://github.com/minetest-mods/mesecons)!
162
163 Who wrote it anyways?
164 ---------------------
165 These awesome people made Mesecons possible!
166
167 | Contributor     | Contribution                     |
168 | --------------- | -------------------------------- |
169 | Hawk777         | Code for VoxelManip caching      |
170 | Jat15           | Various tweaks.                  |
171 | Jeija           | **Main developer! Everything.**  |
172 | Jordach         | Noteblock sounds.                |
173 | khonkhortistan  | Code, recipes, textures.         |
174 | Kotolegokot     | Nodeboxes for items.             |
175 | minerd247       | Textures.                        |
176 | Nore/Novatux    | Code.                            |
177 | RealBadAngel    | Fixes, improvements.             |
178 | sfan5           | Code, recipes, textures.         |
179 | suzenako        | Piston sounds.                   |
180 | Uberi/Temperest | Code, textures, documentation.   |
181 | VanessaE        | Code, recipes, textures, design. |
182 | Whiskers75      | Logic gates implementation.      |
183
184 There are also a whole bunch of other people helping with everything from code to testing and feedback. Mesecons would also not be possible without their help!
185
186 Alright, how can I use it?
187 --------------------------
188 All textures in this project are licensed under the CC-BY-SA 3.0 (Creative Commons Attribution-ShareAlike 3.0 Generic). That means you can distribute and remix them as much as you want to, under the condition that you give credit to the authors and the project, and that if you remix and release them, they must be under the same or similar license to this one.
189
190 All code in this project is licensed under the LGPL version 3 or later. That means you have unlimited freedom to distribute and modify the work however you see fit, provided that if you decide to distribute it or any modified versions of it, you must also use the same license. The LGPL also grants the additional freedom to write extensions for the software and distribute them without the extensions being subject to the terms of the LGPL, although the software itself retains its license.
191
192 No warranty is provided, express or implied, for any part of the project.
193
194 """
195
196         db.session.add(mod1)
197         db.session.add(mod2)
198
199         mod = Package()
200         mod.approved = True
201         mod.name = "handholds"
202         mod.title = "Handholds"
203         mod.license = licenses["MIT"]
204         mod.type = PackageType.MOD
205         mod.author = ez
206         mod.tags.append(tags["player_effects"])
207         mod.repo = "https://github.com/ezhh/handholds"
208         mod.issueTracker = "https://github.com/ezhh/handholds/issues"
209         mod.forums = 17069
210         mod.shortDesc = "Adds hand holds and climbing thingies"
211         mod.desc = "This is the long desc"
212         db.session.add(mod)
213
214         rel = PackageRelease()
215         rel.package = mod
216         rel.title = "v1.0.0"
217         rel.url = "https://github.com/ezhh/handholds/archive/master.zip"
218         rel.approved = True
219         db.session.add(rel)
220
221         mod = Package()
222         mod.approved = True
223         mod.name = "other_worlds"
224         mod.title = "Other Worlds"
225         mod.license = licenses["MIT"]
226         mod.type = PackageType.MOD
227         mod.author = ez
228         mod.tags.append(tags["mapgen"])
229         mod.tags.append(tags["environment"])
230         mod.repo = "https://github.com/ezhh/other_worlds"
231         mod.issueTracker = "https://github.com/ezhh/other_worlds/issues"
232         mod.forums = 16015
233         mod.shortDesc = "Adds space with asteroids and comets"
234         mod.desc = "This is the long desc"
235         db.session.add(mod)
236
237         mod = Package()
238         mod.approved = True
239         mod.name = "food"
240         mod.title = "Food"
241         mod.license = licenses["LGPLv2.1"]
242         mod.type = PackageType.MOD
243         mod.author = ruben
244         mod.tags.append(tags["player_effects"])
245         mod.repo = "https://github.com/rubenwardy/food/"
246         mod.issueTracker = "https://github.com/rubenwardy/food/issues/"
247         mod.forums = 2960
248         mod.shortDesc = "Adds lots of food and an API to manage ingredients"
249         mod.desc = "This is the long desc"
250         food = mod
251         db.session.add(mod)
252
253         mod = Package()
254         mod.approved = True
255         mod.name = "food_sweet"
256         mod.title = "Sweet Foods"
257         mod.license = licenses["CC0"]
258         mod.type = PackageType.MOD
259         mod.author = ruben
260         mod.tags.append(tags["player_effects"])
261         mod.repo = "https://github.com/rubenwardy/food_sweet/"
262         mod.issueTracker = "https://github.com/rubenwardy/food_sweet/issues/"
263         mod.forums = 9039
264         mod.shortDesc = "Adds sweet food"
265         mod.desc = "This is the long desc"
266         food_sweet = mod
267         db.session.add(mod)
268
269         game1 = Package()
270         game1.approved = True
271         game1.name = "capturetheflag"
272         game1.title = "Capture The Flag"
273         game1.type = PackageType.GAME
274         game1.license = licenses["LGPLv2.1"]
275         game1.author = ruben
276         game1.tags.append(tags["pvp"])
277         game1.tags.append(tags["survival"])
278         game1.tags.append(tags["multiplayer"])
279         game1.repo = "https://github.com/rubenwardy/capturetheflag"
280         game1.issueTracker = "https://github.com/rubenwardy/capturetheflag/issues"
281         game1.forums = 12835
282         game1.shortDesc = "Two teams battle to snatch and return the enemy's flag, before the enemy takes their own!"
283         game1.desc = """
284 As seen on the Capture the Flag server (minetest.rubenwardy.com:30000)
285
286 Uses the CTF PvP Engine.
287 """
288
289         db.session.add(game1)
290
291         rel = PackageRelease()
292         rel.package = game1
293         rel.title = "v1.0.0"
294         rel.url = "https://github.com/rubenwardy/capturetheflag/archive/master.zip"
295         rel.approved = True
296         db.session.add(rel)
297
298
299         mod = Package()
300         mod.approved = True
301         mod.name = "pixelbox"
302         mod.title = "PixelBOX Reloaded"
303         mod.license = licenses["CC0"]
304         mod.type = PackageType.TXP
305         mod.author = ruben
306         mod.forums = 14132
307         mod.shortDesc = "This is an update of the original PixelBOX texture pack by the brillant artist Gambit"
308         mod.desc = "This is the long desc"
309         db.session.add(mod)
310
311         rel = PackageRelease()
312         rel.package = mod
313         rel.title = "v1.0.0"
314         rel.url = "http://mamadou3.free.fr/Minetest/PixelBOX.zip"
315         rel.approved = True
316         db.session.add(rel)
317
318         db.session.commit()
319
320         metas = {}
321         for package in Package.query.filter_by(type=PackageType.MOD).all():
322                 meta = None
323                 try:
324                         meta = metas[package.name]
325                 except KeyError:
326                         meta = MetaPackage(package.name)
327                         db.session.add(meta)
328                         metas[package.name] = meta
329                 package.provides.append(meta)
330
331         dep = Dependency(food_sweet, meta=metas["food"])
332         db.session.add(dep)
333
334
335
336 delete_db = len(sys.argv) >= 2 and sys.argv[1].strip() == "-d"
337 if delete_db and os.path.isfile("db.sqlite"):
338         os.remove("db.sqlite")
339
340 print("Creating database tables...")
341 db.create_all()
342 print("Filling database...")
343
344 ruben = User("rubenwardy")
345 ruben.github_username = "rubenwardy"
346 ruben.forums_username = "rubenwardy"
347 ruben.rank = UserRank.ADMIN
348 db.session.add(ruben)
349
350 tags = {}
351 for tag in ["Inventory", "Mapgen", "Building", \
352                 "Mobs and NPCs", "Tools", "Player effects", \
353                 "Environment", "Transport", "Maintenance", "Plants and farming", \
354                 "PvP", "PvE", "Survival", "Creative", "Puzzle", "Multiplayer", "Singleplayer"]:
355         row = Tag(tag)
356         tags[row.name] = row
357         db.session.add(row)
358
359 licenses = {}
360 for license in ["GPLv2.1", "GPLv3", "LGPLv2.1", "LGPLv3", "AGPLv2.1", "AGPLv3",
361                                 "Apache", "BSD 3-Clause", "BSD 2-Clause", "CC0", "CC-BY-SA",
362                                 "CC-BY", "MIT", "ZLib"]:
363         row = License(license)
364         licenses[row.name] = row
365         db.session.add(row)
366
367 for license in ["CC-BY-NC-SA"]:
368         row = License(license, False)
369         licenses[row.name] = row
370         db.session.add(row)
371
372 if test_data:
373         defineDummyData(licenses, tags, ruben)
374
375 db.session.commit()