import os
import shutil
import time
import opengl
import shared
def create_directory(dir):
if not os.path.exists(dir):
os.makedirs(dir)
output_dir = "htdocs/"
print "Resetting output dir..."
while os.path.exists(output_dir):
try:
shutil.rmtree(output_dir);
except:
pass # It gives an error sometimes. If it didn't work try again.
while not os.path.exists(output_dir):
try:
create_directory(output_dir)
except:
pass # It gives an error sometimes. If it didn't work try again.
f = []
d = []
for (dirpath, dirnames, filenames) in os.walk("html/copy"):
dirpath = dirpath[10:]
d.append(dirpath)
for file in filenames:
if file[0] == '.':
continue
f.append(dirpath + "/" + file)
for directory in d:
create_directory(output_dir + directory)
for file in f:
shutil.copy("html/copy/" + file, output_dir + file)
print "Copied " + str(len(f)) + " files"
print "Reading templates..."
header_fp = open("html/header.html")
header = header_fp.read()
header_fp.close()
footer_fp = open("html/footer.html")
footer = footer_fp.read()
footer_fp.close()
print "Done."
unhandled_commands = opengl.commands_version_flat.keys()
def spew_category(name, commands):
commands.sort()
api_commands = ""
commands_list = ""
category_versions = []
for command in commands:
versions_available = opengl.commands_version_flat[command]
versions_available.sort()
classes = "command"
for v in versions_available:
classes += " " + v.replace(".", "")
if not v in category_versions:
category_versions.append(v)
latest_present = versions_available[-1][0:3]
commands_list += "