Merge branch 'contribs' of git://github.com/eminence/Minecraft-Overviewer
This commit is contained in:
@@ -1,3 +1,13 @@
|
|||||||
|
"""Simple Benchmarking script.
|
||||||
|
|
||||||
|
Usage and example:
|
||||||
|
|
||||||
|
$ python contrib/benchmark.py World4/
|
||||||
|
Rendering 50 chunks...
|
||||||
|
Took 20.290062 seconds or 0.405801 seconds per chunk, or 2.464261 chunks per second
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
import chunk
|
import chunk
|
||||||
import world
|
import world
|
||||||
import tempfile
|
import tempfile
|
||||||
@@ -8,12 +18,6 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
# Simple Benchmarking script. Usage and example:
|
|
||||||
|
|
||||||
# $ python contrib/benchmark.py World4/
|
|
||||||
# Rendering 50 chunks...
|
|
||||||
# Took 20.290062 seconds or 0.405801 seconds per chunk, or 2.464261 chunks per second
|
|
||||||
|
|
||||||
|
|
||||||
# create a new, empty, cache dir
|
# create a new, empty, cache dir
|
||||||
cachedir = tempfile.mkdtemp(prefix="benchmark_cache", dir=".")
|
cachedir = tempfile.mkdtemp(prefix="benchmark_cache", dir=".")
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
"""Produces block counts
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
import world, chunk
|
import world, chunk
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
"""Deletes files from the old chunk-based cache"""
|
||||||
|
|
||||||
|
|
||||||
usage = "python contrib/%prog [OPTIONS] <World # / Name / Path to World>"
|
usage = "python contrib/%prog [OPTIONS] <World # / Name / Path to World>"
|
||||||
|
|
||||||
description = """
|
description = """
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
Updates overviewer.dat file sign info
|
||||||
|
|
||||||
This script will scan through every chunk looking for signs and write out an
|
This script will scan through every chunk looking for signs and write out an
|
||||||
updated overviewer.dat file. This can be useful if your overviewer.dat file
|
updated overviewer.dat file. This can be useful if your overviewer.dat file
|
||||||
is either out-of-date or non-existant.
|
is either out-of-date or non-existant.
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
"""
|
||||||
|
Very basic player.dat inspection script
|
||||||
|
"""
|
||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from overviewer_core.nbt import load
|
from overviewer_core.nbt import load
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
Generate a region list to rerender certain chunks
|
||||||
|
|
||||||
This is used to force the regeneration of any chunks that contain a certain
|
This is used to force the regeneration of any chunks that contain a certain
|
||||||
blockID. The output is a chunklist file that is suitable to use with the
|
blockID. The output is a chunklist file that is suitable to use with the
|
||||||
--chunklist option to overviewer.py.
|
--chunklist option to overviewer.py.
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
"Test Render Script"
|
||||||
|
|
||||||
import os, shutil, tempfile, time, sys, math, re
|
import os, shutil, tempfile, time, sys, math, re
|
||||||
from subprocess import Popen, PIPE, STDOUT, CalledProcessError
|
from subprocess import Popen, PIPE, STDOUT, CalledProcessError
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
'''
|
||||||
|
Validate a region file
|
||||||
|
|
||||||
|
TODO description here'''
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
overviewer_dir = os.path.split(os.path.split(os.path.abspath(__file__))[0])[0]
|
overviewer_dir = os.path.split(os.path.split(os.path.abspath(__file__))[0])[0]
|
||||||
|
|||||||
78
contribManager.py
Executable file
78
contribManager.py
Executable file
@@ -0,0 +1,78 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# The contrib manager is used to help control the contribs script
|
||||||
|
# that are shipped with overviewer in Windows packages
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os.path
|
||||||
|
sys.path.append("overviewer_core")
|
||||||
|
import nbt
|
||||||
|
import ast
|
||||||
|
|
||||||
|
scripts=dict( # keys are names, values are scripts
|
||||||
|
benchmark = "benchmark.py",
|
||||||
|
findSigns = "findSigns.py",
|
||||||
|
validate = "validateRegionFile.py",
|
||||||
|
playerInspect = "playerInspect.py"
|
||||||
|
)
|
||||||
|
|
||||||
|
# you can symlink or hardlink contribManager.py to another name to have it
|
||||||
|
# automatically find the right script to run. For example:
|
||||||
|
# > ln -s contribManager.py validate.exe
|
||||||
|
# > chmod +x validate.exe
|
||||||
|
# > ./validate.exe -h
|
||||||
|
|
||||||
|
|
||||||
|
# figure out what script to execute
|
||||||
|
argv=os.path.basename(sys.argv[0])
|
||||||
|
|
||||||
|
if argv[-4:] == ".exe":
|
||||||
|
argv=argv[0:-4]
|
||||||
|
if argv[-3:] == ".py":
|
||||||
|
argv=argv[0:-3]
|
||||||
|
|
||||||
|
|
||||||
|
usage="""Usage:
|
||||||
|
%s --list-contribs | <script name> <arguments>
|
||||||
|
|
||||||
|
Executes a contrib script.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
--list-contribs Lists the supported contrib scripts
|
||||||
|
|
||||||
|
""" % os.path.basename(sys.argv[0])
|
||||||
|
|
||||||
|
if argv in scripts.keys():
|
||||||
|
script = scripts[argv]
|
||||||
|
sys.argv[0] = script
|
||||||
|
else:
|
||||||
|
if "--list-contribs" in sys.argv:
|
||||||
|
for contrib in scripts.keys():
|
||||||
|
# use an AST to extract the docstring for this module
|
||||||
|
script = scripts[contrib]
|
||||||
|
with open(os.path.join("contrib",script)) as f:
|
||||||
|
d = f.read()
|
||||||
|
node=ast.parse(d, script);
|
||||||
|
docstring = ast.get_docstring(node)
|
||||||
|
if docstring:
|
||||||
|
docstring = docstring.strip().splitlines()[0]
|
||||||
|
else:
|
||||||
|
docstring="(no description found. add one by adding a docstring to %s)" % script
|
||||||
|
print "%s : %s" % (contrib, docstring)
|
||||||
|
sys.exit(0)
|
||||||
|
if len(sys.argv) > 1 and sys.argv[1] in scripts.keys():
|
||||||
|
script = scripts[sys.argv[1]]
|
||||||
|
sys.argv = [script] + sys.argv[2:]
|
||||||
|
else:
|
||||||
|
print usage
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
torun = os.path.join("contrib", script)
|
||||||
|
|
||||||
|
if not os.path.exists(torun):
|
||||||
|
print "Script '%s' is missing!" % script
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
execfile(torun)
|
||||||
|
|
||||||
3
setup.py
3
setup.py
@@ -95,10 +95,11 @@ if py2exe is not None:
|
|||||||
# py2exe likes a very particular type of version number:
|
# py2exe likes a very particular type of version number:
|
||||||
setup_kwargs['version'] = util.findGitVersion().replace("-",".")
|
setup_kwargs['version'] = util.findGitVersion().replace("-",".")
|
||||||
|
|
||||||
setup_kwargs['console'] = ['overviewer.py']
|
setup_kwargs['console'] = ['overviewer.py', 'contribManager.py']
|
||||||
setup_kwargs['data_files'] = [('', doc_files)]
|
setup_kwargs['data_files'] = [('', doc_files)]
|
||||||
setup_kwargs['data_files'] += recursive_data_files('overviewer_core/data/textures', 'textures')
|
setup_kwargs['data_files'] += recursive_data_files('overviewer_core/data/textures', 'textures')
|
||||||
setup_kwargs['data_files'] += recursive_data_files('overviewer_core/data/web_assets', 'web_assets')
|
setup_kwargs['data_files'] += recursive_data_files('overviewer_core/data/web_assets', 'web_assets')
|
||||||
|
setup_kwargs['data_files'] += recursive_data_files('contrib', 'contrib')
|
||||||
setup_kwargs['zipfile'] = None
|
setup_kwargs['zipfile'] = None
|
||||||
if platform.system() == 'Windows' and '64bit' in platform.architecture():
|
if platform.system() == 'Windows' and '64bit' in platform.architecture():
|
||||||
b = 3
|
b = 3
|
||||||
|
|||||||
Reference in New Issue
Block a user