Esempio n. 1
0
            print "Press [Enter] to close this window."
            raw_input()
    else:
        if wait:
            if consoleMsg:
                print "\n"
                print "The Overviewer is a console program.  Please open a Windows command prompt"
                print "first and run Overviewer from there.   Further documentation is available at"
                print "http://docs.overviewer.org/\n"
            print "Press [Enter] to close this window."
            raw_input()

    sys.exit(code)


this_dir = util.get_program_path()

# make sure the c_overviewer extension is available
try:
    from overviewer_core import c_overviewer
except ImportError:
    ## if this is a frozen windows package, the following error messages about
    ## building the c_overviewer extension are not appropriate
    if hasattr(sys, "frozen"):
        print "Something has gone wrong importing the c_overviewer extension.  Please"
        print "make sure the 2008 and 2010 redistributable packages from Microsoft"
        print "are installed."
        doExit()

    ## try to find the build extension
    ext = os.path.join(
        print "and will not run on Python 3.0 or later"
    sys.exit(1)

import os
import os.path
import re
import subprocess
import multiprocessing
import time
import logging
import platform
from overviewer_core import util

logging.basicConfig(level=logging.INFO,format="%(asctime)s [%(levelname)s] %(message)s")

this_dir = util.get_program_path()

# make sure the c_overviewer extension is available
try:
    from overviewer_core import c_overviewer
except ImportError:
    ## if this is a frozen windows package, the following error messages about
    ## building the c_overviewer extension are not appropriate
    if hasattr(sys, "frozen"):
        print "Something has gone wrong importing the c_overviewer extension.  Please"
        print "make sure the 2008 and 2010 redistributable packages from Microsoft"
        print "are installed."
        sys.exit(1)


    ## try to find the build extension
import os
from overviewer_core import util
from overviewer_core.files import FileReplacer, get_fs_caps

outputdir = '/var/www/minecraft/map'

# create overviewer.js from the source js files
js_src = os.path.join(util.get_program_path(), "overviewer_core", "data", "js_src")
if not os.path.isdir(js_src):
    js_src = os.path.join(util.get_program_path(), "js_src")
with FileReplacer(os.path.join(outputdir, "overviewer.js"), capabilities=get_fs_caps(outputdir)) as tmpfile:
    with open(tmpfile, "w") as fout:
        # first copy in js_src/overviewer.js
        with open(os.path.join(js_src, "overviewer.js"), 'r') as f:
            fout.write(f.read())
        # now copy in the rest
        for js in os.listdir(js_src):
            if not js.endswith("overviewer.js") and js.endswith(".js"):
                with open(os.path.join(js_src,js)) as f:
                    fout.write(f.read())