Update wiki and ci stuff

This commit is contained in:
Mike A. Trethewey
2020-03-08 15:52:05 -07:00
parent d5b80380f2
commit 04404714d9
5 changed files with 66 additions and 47 deletions

View File

@@ -22,7 +22,7 @@ from Rules import set_rules
from Dungeons import create_dungeons, fill_dungeons, fill_dungeons_restrictive, dungeon_regions
from Fill import distribute_items_cutoff, distribute_items_staleness, distribute_items_restrictive, flood_items, balance_multiworld_progression
from ItemList import generate_itempool, difficulties, fill_prizes
from Utils import output_path, parse_player_names, print_wiki_doors_by_room
from Utils import output_path, parse_player_names, print_wiki_doors_by_region, print_wiki_doors_by_room
__version__ = '0.0.18.4d'
@@ -258,6 +258,7 @@ def main(args, seed=None):
logger.info('Total Time: %s', time.perf_counter() - start)
# print_wiki_doors_by_room(dungeon_regions,world,1)
# print_wiki_doors_by_region(dungeon_regions,world,1)
return world

View File

@@ -207,7 +207,6 @@ def read_entrance_data(old_rom='Zelda no Densetsu - Kamigami no Triforce (Japan)
def print_wiki_doors_by_region(d_regions, world, player):
for d, region_list in d_regions.items():
tile_map = {}
for region in region_list:
@@ -222,27 +221,31 @@ def print_wiki_doors_by_region(d_regions, world, player):
if tile not in tile_map:
tile_map[tile] = []
tile_map[tile].append(r)
print('<!-- ' + d + ' -->')
print('{| class="wikitable"')
print('|-')
print('! Room')
print('! Supertile')
print('! Doors')
toprint = ""
toprint += ('<!-- ' + d + ' -->') + "\n"
toprint += ('== Room List ==') + "\n"
toprint += "\n"
toprint += ('{| class="wikitable"') + "\n"
toprint += ('|-') + "\n"
toprint += ('! Room !! Supertile !! Doors') + "\n"
for tile, region_list in tile_map.items():
tile_done = False
for region in region_list:
print('|-')
print('| '+region.name)
toprint += ('|-') + "\n"
toprint += ('| {{Dungeon Room|{{PAGENAME}}|' + region.name + '}}') + "\n"
if not tile_done:
listlen = len(region_list)
link = '| {{UnderworldMapLink|'+str(tile)+'}}'
print(link if listlen < 2 else '| rowspan = '+str(listlen)+' '+link)
toprint += (link if listlen < 2 else '| rowspan = '+str(listlen)+' '+link) + "\n"
tile_done = True
strs_to_print = []
for ext in region.exits:
strs_to_print.append(ext.name)
print('| '+' <br /> '.join(strs_to_print))
print('|}')
strs_to_print.append('{{Dungeon Door|{{PAGENAME}}|' + ext.name + '}}')
toprint += ('| '+'<br />'.join(strs_to_print))
toprint += "\n"
toprint += ('|}') + "\n"
with open(os.path.join(".","resources", "user", "regions-" + d + ".txt"),"w+") as f:
f.write(toprint)
def print_wiki_doors_by_room(d_regions, world, player):
for d, region_list in d_regions.items():

View File

@@ -115,6 +115,9 @@ def prepare_filename(BUILD_FILENAME):
# find a binary file if it's executable
# failing that, assume it's over 10MB
def find_binary(listdir):
FILENAME_CHECKS = [ "Gui", "DungeonRandomizer" ]
FILESIZE_CHECK = (10 * 1024 * 1024) # 10MB
BUILD_FILENAMES = []
executable = stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH
for filename in os.listdir(listdir):
@@ -122,10 +125,11 @@ def find_binary(listdir):
if os.path.splitext(filename)[1] != ".py":
st = os.stat(filename)
mode = st.st_mode
big = st.st_size > (4.7 * 1024 * 1024) # 10MB
big = st.st_size > FILESIZE_CHECK
if (mode & executable) or big:
if "GUI" in filename or "Gui" in filename or "DungeonRandomizer" in filename:
BUILD_FILENAMES.append(filename)
for check in FILENAME_CHECKS:
if check in filename:
BUILD_FILENAMES.append(filename)
return BUILD_FILENAMES
if __name__ == "__main__":

View File

@@ -1,15 +1,20 @@
import subprocess # do stuff at the shell level
def git_clean():
excludes = [
".vscode", # vscode IDE files
".idea", # idea IDE files
"*.json", # keep JSON files for that one time I just nuked all that I was working on, oops
"*app*version.*" # keep appversion files
]
excludes = ['--exclude={0}'.format(exclude) for exclude in excludes]
# clean the git slate
subprocess.check_call([
subprocess.check_call([
"git", # run a git command
"clean", # clean command
"-dfx", # d: directories, f: files, x: ignored files
"--exclude=.vscode", # keep vscode IDE files
"--exclude=.idea", # keep idea IDE files
"--exclude=*.json", # keep JSON files for that one time I just nuked all that I was working on, oops
"--exclude=*app*version.*"]) # keep appversion files
*excludes])
if __name__ == "__main__":
git_clean()

View File

@@ -8,17 +8,14 @@ from shutil import copy, make_archive, move, rmtree # file manipulation
env = common.prepare_env() # get env vars
# make temp dir to put binary in
if not os.path.isdir(os.path.join("..","artifact")):
os.mkdir(os.path.join("..","artifact"))
# make temp dir for other stuff
if not os.path.isdir(os.path.join("..","build")):
os.mkdir(os.path.join("..","build"))
# make dir to put the archive in
if not os.path.isdir(os.path.join("..","deploy")):
os.mkdir(os.path.join("..","deploy"))
dirs = [
os.path.join("..", "artifact"), # temp dir for binary
os.path.join("..", "build"), # temp dir for other stuff
os.path.join("..", "deploy") # dir for archive
]
for dirname in dirs:
if not os.path.isdir(dirname):
os.makedirs(dirname)
# make dirs for each os
for dirname in ["linux","macos","windows"]:
@@ -27,12 +24,16 @@ for dirname in ["linux","macos","windows"]:
# sanity check permissions for working_dirs.json
dirpath = "."
for dirname in ["resources","user"]:
dirpath += '/' + dirname
os.chmod(dirpath,0o755)
for dirname in ["resources","user","meta","manifests"]:
dirpath += os.path.join(dirpath,dirname)
if os.path.isdir(dirpath):
os.chmod(dirpath,0o755)
# nuke travis file if it exists
if os.path.isfile(os.path.join(".",".travis.yml")):
os.remove(os.path.join(".",".travis.yml"))
for travis in [ os.path.join(".", ".travis.yml"), os.path.join(".", ".travis.off") ]:
if os.path.isfile(travis):
os.remove(travis)
# nuke test suite if it exists
if os.path.isdir(os.path.join(".","tests")):
distutils.dir_util.remove_tree(os.path.join(".","tests"))
@@ -66,12 +67,18 @@ if len(BUILD_FILENAMES) > 0:
git_clean()
# mv dirs from source code
dirs = [os.path.join(".",".git"), os.path.join(".",".github"), os.path.join(".",".gitignore"), os.path.join(".","html"), os.path.join(".","resources","ci")]
for dir in dirs:
if os.path.isdir(dir):
dirs = [
os.path.join(".",".git"),
os.path.join(".",".github"),
os.path.join(".",".gitignore"),
os.path.join(".","html"),
os.path.join(".","resources","ci")
]
for dirname in dirs:
if os.path.isdir(dirname):
move(
dir,
os.path.join("..","build",dir)
dirname,
os.path.join("..", "build", dirname)
)
for BUILD_FILENAME in BUILD_FILENAMES:
@@ -88,8 +95,7 @@ if len(BUILD_FILENAMES) > 0:
# .zip if windows
# .tar.gz otherwise
ZIP_FILENAME = os.path.join("..","deploy",os.path.splitext(BUILD_FILENAME)[0])
ZIP_FILENAME = os.path.join("..","deploy","ALttPDoorRandomizer")
ZIP_FILENAME = os.path.join("..","deploy",env["REPO_NAME"]) if len(BUILD_FILENAMES) > 1 else os.path.join("..","deploy",os.path.splitext(BUILD_FILENAME)[0])
if env["OS_NAME"] == "windows":
make_archive(ZIP_FILENAME,"zip")
ZIP_FILENAME += ".zip"
@@ -110,12 +116,12 @@ for BUILD_FILENAME in BUILD_FILENAMES:
print("Build Filename: " + BUILD_FILENAME)
print("Build Filesize: " + common.file_size(BUILD_FILENAME))
else:
print("No Build to prepare")
print("No Build to prepare: " + BUILD_FILENAME)
if not ZIP_FILENAME == "":
print("Zip Filename: " + ZIP_FILENAME)
print("Zip Filesize: " + common.file_size(ZIP_FILENAME))
else:
print("No Zip to prepare")
print("No Zip to prepare: " + ZIP_FILENAME)
print("Git tag: " + env["GITHUB_TAG"])