Exemplo n.º 1
0
def state_info(step):

	"""Return string with information about the state of configuration and input dataset."""

	s = ("platform = %s\n\nnumber of CPUs = %d\n\npython = %s\n\nstep = %d\n\n"
	        % (platform.platform(), get_ncpus(), platform.python_version(), step))

	d = {}
	for field in CONFIG_FIELDS:
		try:
			d[field] = config.__getattribute__(field)
		except AttributeError:
			pass

	s += "config = \\\n" + pprint.pformat(d)

	if len(config.files) != 0:
		ds = gdal.Open(config.files[0][2], gdal.GA_ReadOnly)
		if ds is None:
			s += "\n\nGDAL can not open the input dataset!"
		else:
			info = dataset_info(ds)
			s += "\n\ndataset = \\\n" + pprint.pformat(info)

	return s
Exemplo n.º 2
0
def state_info(step):
    """Return string with information about the state of configuration and input dataset."""

    s = ("platform = %s\n\nnumber of CPUs = %d\n\npython = %s\n\nstep = %d\n\n"
         % (platform.platform(), get_ncpus(), platform.python_version(), step))

    d = {}
    for field in CONFIG_FIELDS:
        try:
            d[field] = config.__getattribute__(field)
        except AttributeError:
            pass

    s += "config = \\\n" + pprint.pformat(d)

    if len(config.files) != 0:
        ds = gdal.Open(config.files[0][2], gdal.GA_ReadOnly)
        if ds is None:
            s += "\n\nGDAL can not open the input dataset!"
        else:
            info = dataset_info(ds)
            s += "\n\ndataset = \\\n" + pprint.pformat(info)

    return s
Exemplo n.º 3
0
# coding=UTF8

import config, codecs, datetime, os
from jinja2 import Environment, FileSystemLoader


env = Environment(loader=FileSystemLoader(".", encoding="utf-8"))
con = config.__getattribute__("config")

# Create folder estructure
out = con["outFolder"]

if not os.path.exists(out):
    os.makedirs(out)

createFolder = out+"/create_databases"
    
if not os.path.exists(createFolder):
    os.makedirs(createFolder)

# Create database creation script for each user
template = env.get_template("create_databases.sql.jinja")

for u in con["users"]:
    # Create user folder
    userFolder = createFolder+"/"+u["name"]

    if not os.path.exists(userFolder):
        os.makedirs(userFolder)

    # Create a new context with all the information needed
# coding=UTF8

# Make into the build folder database scripts. Parameters:
# - config profile from the config file

# TODO: more customized: config module profiles 

import config, codecs, sys
reload(config)
from jinja2 import Environment, FileSystemLoader
import os

env = Environment(loader=FileSystemLoader("src", encoding="utf-8"))

# Config parameters
con = config.__getattribute__(sys.argv[1])

# Create build folder
buildFolder = con["buildfolderprefix"]+"-"+sys.argv[1]
if not os.path.exists(buildFolder):
    os.makedirs(buildFolder)

# Recreate folder structure
for root, dirs, files in os.walk("src"):
    for d in dirs:
        if not os.path.exists(buildFolder+'/'+d):
            os.makedirs(buildFolder+'/'+d)

# Create additional folders
if "createfolders" in con:
    for folder in con["createfolders"]:
Exemplo n.º 5
0
# coding=UTF8

# Make into the build folder database scripts. Parameters:
# - config profile from the config file

# TODO: more customized: build folder and config module profiles 

import config, codecs, sys
reload(config)
from jinja2 import Environment, FileSystemLoader
import os

env = Environment(loader=FileSystemLoader("src", encoding="utf-8"))

# Create new folders
for folder in config.test["createfolders"]:
    if not os.path.exists(folder):
        os.makedirs(folder)

# Build from sources        
for root, dirs, files in os.walk("src"):
    for f in files:
        template = env.get_template(f)
        fout = codecs.open("build/"+f, "w", "utf-8")
        fout.write(template.render(c=config.__getattribute__(sys.argv[1])))
        fout.close()