Generates a product.equation file for the given product name.
    It generates it from the <product_name>.config file in the products folder.
    For that you need to have your project imported to featureIDE and set the correct settings.
321077
def config_to_equation(poi=None):
    
    from . import utils

    container_dir, product_name = tasks.get_poi_tuple(poi=poi)
    info_object = utils.get_feature_ide_paths(container_dir, product_name)
    feature_list = list()

    try:
        print('*** Processing ', info_object.config_file_path)
        with open(info_object.config_file_path, 'r') as config_file:

            config_file = config_file.readlines()
            for line in config_file:
                # in FeatureIDE we cant use '.' for the paths to sub-features so we used '__'
                # e.g. django_productline__features__development
                if len(line.split('__')) <= 2:
                    line = line
                else:
                    line = line.replace('__', '.')

                if line.startswith('abstract_'):
                    # we skipp abstract features; this is a special case as featureIDE does not work with abstract
                    # sub trees / leafs.
                    line = ''

                feature_list.append(line)
    except IOError:
        print('{} does not exist. Make sure your config file exists.'.format(info_object.config_file_path))

    feature_list = tasks.get_ordered_feature_list(info_object, feature_list)

    try:
        with open(info_object.equation_file_path, 'w') as eq_file:
            eq_file.writelines(feature_list)
        print('*** Successfully generated product.equation')
    except IOError:
        print('product.equation file not found. Please make sure you have a valid product.equation in your chosen product')

    # finally performing the validation of the product equation
    tasks.validate_product_equation()
1126250
public static void generate() {

		// If the GeoPackage does not exist create it
		if (!geoPackageFile.exists()) {
			if (!GeoPackageManager.create(geoPackageFile)) {
				throw new GeoPackageException(
						"Failed to create GeoPackage file: "
								+ geoPackageFile.getAbsolutePath());
			}
		}

		// Open the GeoPackage
		geoPackage = GeoPackageManager.open(geoPackageFile);

		// Default the EPSG
		if (epsg == null) {
			epsg = new Long(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
		}

		// Set the projection and default bounding box as needed
		Projection bboxProjection = null;
		if (boundingBox != null) {
			bboxProjection = ProjectionFactory.getProjection(epsg);
		} else {
			boundingBox = new BoundingBox();
			bboxProjection = ProjectionFactory
					.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
		}

		// Bound degree tiles to Web Mercator limits
		if (bboxProjection.isUnit(Units.DEGREES)) {
			boundingBox = TileBoundingBoxUtils
					.boundDegreesBoundingBoxWithWebMercatorLimits(boundingBox);
		}

		// Transform to the URL projection bounding box
		Projection urlProjection = ProjectionFactory.getProjection(urlEpsg);
		ProjectionTransform transform = bboxProjection
				.getTransformation(urlProjection);
		BoundingBox urlBoundingBox = boundingBox.transform(transform);

		UrlTileGenerator tileGenerator = new UrlTileGenerator(geoPackage,
				tileTable, url, minZoom, maxZoom, urlBoundingBox, urlProjection);

		if (compressFormat != null) {
			tileGenerator.setCompressFormat(compressFormat);
			if (compressQuality != null) {
				tileGenerator.setCompressQuality(compressQuality);
			}
		}

		if (googleTiles) {
			tileGenerator.setGoogleTiles(true);
		}

		if (tms) {
			tileGenerator.setTileFormat(TileFormatType.TMS);
		}

		int count = tileGenerator.getTileCount();

		LOGGER.log(
				Level.INFO,
				"GeoPackage: "
						+ geoPackage.getName()
						+ ", Tile Table: "
						+ tileTable
						+ ", URL: "
						+ url
						+ ", Min Zoom: "
						+ minZoom
						+ ", Max Zoom: "
						+ maxZoom
						+ (compressFormat != null ? ", Compress Format: "
								+ compressFormat : "")
						+ (compressQuality != null ? ", Compress Quality: "
								+ compressQuality : "")
						+ (googleTiles ? ", Google Tiles" : "")
						+ (boundingBox != null ? ", Min Lon: "
								+ boundingBox.getMinLongitude() + ", Min Lat: "
								+ boundingBox.getMinLatitude() + ", Max Lon: "
								+ boundingBox.getMaxLongitude() + ", Max Lat: "
								+ boundingBox.getMaxLatitude() : "")
						+ (epsg != null ? ", EPSG: " + epsg : "")
						+ ", URL EPSG: " + urlEpsg + ", Expected Tile Count: "
						+ count);

		tileGenerator.setProgress(progress);

		LOGGER.log(Level.INFO, "Generating Tiles...");

		try {
			tileGenerator.generateTiles();
		} catch (IOException | SQLException e) {
			throw new GeoPackageException("Exception while generating tiles", e);
		}

		finish();
	}
595938
def _find_or_create_version(self, product):
        
        tag = self.options["tag"]

        label = self.project_config.get_version_for_tag(tag)
        result = self._call_api(
            "GET", "/versions", params={"product": product["id"], "label": label}
        )
        if len(result["data"]) == 0:
            version = self._call_api(
                "POST",
                "/versions",
                json={
                    "product": product["url"],
                    "label": label,
                    "description": self.options.get("description", ""),
                    "is_production": True,
                    "commit_ish": tag,
                    "is_listed": False,
                },
            )
            self.logger.info("Created {}".format(version["url"]))
        else:
            version = result["data"][0]
            self.logger.info("Found {}".format(version["url"]))
        return version
905586
def _add_products(self, tile, show_all=False):
        """"""

        products = tile.products
        unique_id = tile.unique_id
        base_path = tile.output_folder

        for prod_path, prod_type in products.items():
            # We need to handle include_directories and tilebus_definitions
            # specially since those are stored reversed in module_settings.json
            # for historical reasons.  Currently we don't support resolving
            # tilebus_definitions or include_directories in ProductResolver
            if prod_path == 'tilebus_definitions' or prod_path == 'include_directories':
                continue

            if prod_type in self.IGNORED_PRODUCTS:
                continue

            prod_base = os.path.basename(prod_path)
            if prod_type not in self._product_map:
                self._product_map[prod_type] = {}

            prod_map = self._product_map[prod_type]
            if prod_base not in prod_map:
                prod_map[prod_base] = []

            full_path = os.path.normpath(os.path.join(base_path, prod_path))
            info = ProductInfo(prod_base, full_path, unique_id, not show_all and prod_base not in self._product_filter)
            prod_map[prod_base].append(info)
192035
def generate_file_name(self):
        """"""
        if not self.project:
            raise UnderDefined("project name not given")

        out_data_dir = prms.Paths.outdatadir
        project_dir = os.path.join(out_data_dir, self.project)
        file_name = "cellpy_batch_%s.json" % self.name
        self.file_name = os.path.join(project_dir, file_name)
110401
public static void generate() {

		// Open the GeoPackage with the feature table
		featureGeoPackage = GeoPackageManager.open(featureGeoPackageFile);

		// Check if the tile table is to be created in the same GeoPackage file
		if (featureGeoPackageFile.equals(tileGeoPackageFile)) {
			tileGeoPackage = featureGeoPackage;
		} else {

			// If the GeoPackage does not exist create it
			if (!tileGeoPackageFile.exists()) {
				if (!GeoPackageManager.create(tileGeoPackageFile)) {
					throw new GeoPackageException(
							"Failed to create GeoPackage file: "
									+ tileGeoPackageFile.getAbsolutePath());
				}
			}

			// Open the GeoPackage
			tileGeoPackage = GeoPackageManager.open(tileGeoPackageFile);
		}

		FeatureDao featureDao = featureGeoPackage.getFeatureDao(featureTable);

		// Index the feature table if needed
		FeatureTableIndex featureIndex = new FeatureTableIndex(
				featureGeoPackage, featureDao);
		if (!featureIndex.isIndexed()) {
			int numFeatures = featureDao.count();
			LOGGER.log(Level.INFO,
					"Indexing GeoPackage '" + featureGeoPackage.getName()
							+ "' feature table '" + featureTable + "' with "
							+ numFeatures + " features");
			Progress indexProgress = new Progress("Feature Indexer",
					LOG_INDEX_FREQUENCY, LOG_INDEX_TIME_FREQUENCY);
			indexProgress.setMax(numFeatures);
			featureIndex.setProgress(indexProgress);
			int indexed = featureIndex.index();
			LOGGER.log(Level.INFO,
					"Indexed GeoPackage '" + featureGeoPackage.getName()
							+ "' feature table '" + featureTable + "', "
							+ indexed + " features");
		}
		featureIndex.close();

		// Create the feature tiles
		FeatureTiles featureTiles = new DefaultFeatureTiles(featureGeoPackage,
				featureDao);
		if (ignoreGeoPackageStyles) {
			featureTiles.ignoreFeatureTableStyles();
		}
		if (maxFeaturesPerTile != null) {
			featureTiles.setMaxFeaturesPerTile(maxFeaturesPerTile);
			featureTiles.setMaxFeaturesTileDraw(new NumberFeaturesTile());
		}

		// Set the tile styles
		if (tileWidth != null) {
			featureTiles.setTileWidth(tileWidth);
		}
		if (tileHeight != null) {
			featureTiles.setTileHeight(tileHeight);
		}
		if (tileScale != null) {
			featureTiles.setScale(tileScale);
		}
		if (pointRadius != null) {
			featureTiles.setPointRadius(pointRadius);
		}
		if (pointColor != null) {
			featureTiles.setPointColor(pointColor);
		}
		if (icon != null) {
			featureTiles.setPointIcon(icon);
		}
		if (lineStrokeWidth != null) {
			featureTiles.setLineStrokeWidth(lineStrokeWidth);
		}
		if (lineColor != null) {
			featureTiles.setLineColor(lineColor);
		}
		if (polygonStrokeWidth != null) {
			featureTiles.setPolygonStrokeWidth(polygonStrokeWidth);
		}
		if (polygonColor != null) {
			featureTiles.setPolygonColor(polygonColor);
		}
		if (fillPolygon != null) {
			featureTiles.setFillPolygon(fillPolygon);
		}
		if (polygonFillColor != null) {
			featureTiles.setPolygonFillColor(polygonFillColor);
		}
		featureTiles.setSimplifyGeometries(simplifyGeometries);

		// Calculate the tile overlap with the new settings
		featureTiles.calculateDrawOverlap();

		// Default the EPSG
		if (epsg == null) {
			epsg = new Long(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
		}

		BoundingBox webMercatorBoundingBox = null;
		Projection webMercatorProjection = ProjectionFactory
				.getProjection(ProjectionConstants.EPSG_WEB_MERCATOR);

		// Set the projection and default bounding box as needed
		Projection projection = null;
		if (boundingBox != null) {

			projection = ProjectionFactory.getProjection(epsg);

			// Bound WGS84 tiles to Web Mercator limits
			if (projection.isUnit(Units.DEGREES)) {
				boundingBox = TileBoundingBoxUtils
						.boundDegreesBoundingBoxWithWebMercatorLimits(boundingBox);
			}

			// Transform to a Web Mercator bounding box
			ProjectionTransform transform = projection
					.getTransformation(webMercatorProjection);
			webMercatorBoundingBox = boundingBox.transform(transform);

		} else {
			projection = ProjectionFactory
					.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
		}

		// Create the tile generator
		FeatureTileGenerator tileGenerator = new FeatureTileGenerator(
				tileGeoPackage, tileTable, featureTiles, featureGeoPackage,
				minZoom, maxZoom, webMercatorBoundingBox, webMercatorProjection);

		if (compressFormat != null) {
			tileGenerator.setCompressFormat(compressFormat);
			if (compressQuality != null) {
				tileGenerator.setCompressQuality(compressQuality);
			}
		}

		if (googleTiles) {
			tileGenerator.setGoogleTiles(true);
		}

		int count = tileGenerator.getTileCount();

		LOGGER.log(
				Level.INFO,
				"Feature GeoPackage: "
						+ featureGeoPackage.getName()
						+ ", Feature Table: "
						+ featureTable
						+ ", Tile GeoPackage: "
						+ tileGeoPackage.getName()
						+ ", Tile Table: "
						+ tileTable
						+ ", Min Zoom: "
						+ minZoom
						+ ", Max Zoom: "
						+ maxZoom
						+ (maxFeaturesPerTile != null ? ", Max Features Per Tile: "
								+ maxFeaturesPerTile
								: "")
						+ (compressFormat != null ? ", Compress Format: "
								+ compressFormat : "")
						+ (compressQuality != null ? ", Compress Quality: "
								+ compressQuality : "")
						+ (googleTiles ? ", Google Tiles" : "")
						+ (boundingBox != null ? ", Min Lon: "
								+ boundingBox.getMinLongitude() + ", Min Lat: "
								+ boundingBox.getMinLatitude() + ", Max Lon: "
								+ boundingBox.getMaxLongitude() + ", Max Lat: "
								+ boundingBox.getMaxLatitude() : "")
						+ (epsg != null ? ", EPSG: " + epsg : "")
						+ ", Expected Tile Count: " + count);

		StringBuilder tileStyle = new StringBuilder();
		if (tileWidth != null) {
			tileStyle.append(", Width: ").append(tileWidth);
		}
		if (tileHeight != null) {
			tileStyle.append(", Height: ").append(tileHeight);
		}
		if (pointRadius != null) {
			tileStyle.append(", Point Radius: ").append(pointRadius);
		}
		if (pointColor != null) {
			tileStyle.append(", Point Color: ").append(colorString(pointColor));
		}
		if (icon != null) {
			tileStyle.append(", Point Icon (height=").append(icon.getHeight())
					.append(", width=").append(icon.getWidth())
					.append(", xoffset=").append(icon.getXOffset())
					.append(", yoffset=").append(icon.getYOffset()).append(")");
		}
		if (lineStrokeWidth != null) {
			tileStyle.append(", Line Stroke Width: ").append(lineStrokeWidth);
		}
		if (lineColor != null) {
			tileStyle.append(", Line Color: ").append(colorString(lineColor));
		}
		if (polygonStrokeWidth != null) {
			tileStyle.append(", Polygon Stroke Width: ").append(
					polygonStrokeWidth);
		}
		if (polygonColor != null) {
			tileStyle.append(", Polygon Color: ").append(
					colorString(polygonColor));
		}
		if (fillPolygon != null && fillPolygon) {
			tileStyle.append(", Fill Polygon");
		}
		if (polygonFillColor != null) {
			tileStyle.append(", Polygon Fill Color: ").append(
					colorString(polygonFillColor));
		}
		if (simplifyGeometries) {
			tileStyle.append(", Simplify Geometries");
		}
		if (tileStyle.length() == 0) {
			tileStyle.append(", Default Settings");
		}
		LOGGER.log(Level.INFO, "Tile Attributes" + tileStyle);

		tileGenerator.setProgress(progress);

		LOGGER.log(Level.INFO, "Generating Tiles...");

		try {
			tileGenerator.generateTiles();
		} catch (IOException | SQLException e) {
			throw new GeoPackageException("Exception while generating tiles", e);
		}

		finish();
	}
893367
def create_project(project_name, skel="basic"):
    
    project_dir = get_project_dir_path(project_name)
    app_tpl = pkg_resources.resource_string(__name__, '%s/app.py' % (SKELETON_DIR))
    propel_tpl = pkg_resources.resource_string(__name__, '%s/propel.yml' % (SKELETON_DIR))
    config_tpl = pkg_resources.resource_string(__name__, '%s/config.py' % (SKELETON_DIR))
    model_tpl = pkg_resources.resource_string(__name__, '%s/model.py' % (SKELETON_DIR))
    manage_tpl = pkg_resources.resource_string(__name__, '%s/juicy.py' % (SKELETON_DIR))

    app_file = "%s/app_%s.py" % (CWD, project_name)
    requirements_txt = "%s/requirements.txt" % CWD
    propel_yml = "%s/propel.yml" % CWD
    config_py = "%s/config.py" % APPLICATION_DIR
    model_py = "%s/model.py" % APPLICATION_DIR
    manage_py = "%s/juicy.py" % CWD

    dirs = [
        APPLICATION_DIR,
        APPLICATION_DATA_DIR,
        project_dir
    ]
    for d in dirs:
        if not os.path.isdir(d):
            os.makedirs(d)

    files = [
        ("%s/__init__.py" % APPLICATION_DIR, "# Juice"),
        (config_py, config_tpl),
        (model_py, model_tpl),
        (app_file, app_tpl.format(project_name=project_name)),
        (requirements_txt, "%s==%s" % (__title__, __version__)),
        (propel_yml, propel_tpl.format(project_name=project_name)),
        (manage_py, manage_tpl)
    ]
    for f in files:
        if not os.path.isfile(f[0]):
            with open(f[0], "wb") as f0:
                f0.write(f[1])

    copy_resource("%s/skel/%s/" % (SKELETON_DIR, skel), project_dir)
    copy_resource("%s/%s/" % (SKELETON_DIR, "_data"), APPLICATION_DATA_DIR)
823964
def explain_features():
    '''
    '''
    from ape import tasks
    import featuremonkey
    import os

    featurenames = featuremonkey.get_features_from_equation_file(os.environ['PRODUCT_EQUATION_FILENAME'])

    for featurename in featurenames:
        tasks.explain_feature(featurename)
856387
def product_path(cls, project, location, product):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/locations/{location}/products/{product}",
            project=project,
            location=location,
            product=product,
        )
157985
def generatePlugin(sourcePath, buildPath = None):
    
    if ( buildPath is None ):
        buildPath = BUILD_PATH
        
    pkg_name = projex.packageFromPath(sourcePath)
    module = os.path.basename(sourcePath).split('.')[0]
    if module != '__init__':
        pkg_name += '.' + module
    
    try:
        __import__(pkg_name)
    except ImportError, e:
        logging.exception(e)
        return
    
    module = sys.modules.get(pkg_name)
    if not module:
        return
        
    if not hasattr(module, '__designer_plugins__'):
        logger.info('%s has no __designer_plugins__ defined.' % pkg_name)
        return
    
    if not os.path.exists(buildPath):
        os.mkdir(buildPath)
    
    for plug in module.__designer_plugins__:
        output_path = os.path.join(buildPath, 
                                   '%splugin.py' % plug.__name__.lower())
        
        # generate the options
        options = {}
        options['module'] = pkg_name
        options['class']  = plug.__name__
        
        # save the plugin
        f = open(output_path, 'w')
        f.write(PLUGIN_DEF % options)
        f.close()
555282
def import_formulas(self):
        
        # TODO: unit tests!
        # TODO: move this to somewhere else and call it "importy", maybe
        # core.__init__.py since a lot of modules might use it.
        module = self.meta.module  # module read from parameters
        package = getattr(self.meta, 'package', None)  # package read from meta
        name = package + module if package else module  # concat pkg + name
        path = getattr(self.meta, 'path', None)  # path read from parameters
        # import module using module and package
        mod = None
        # SEE ALSO: http://docs.python.org/2/library/imp.html#examples
        try:
            # fast path: see if module was already imported
            mod = sys.modules[name]
        except KeyError:
            try:
                # import module specified in parameters
                mod = importlib.import_module(module, package)
            except ImportError as err:
                if not path:
                    msg = ('%s could not be imported either because it was not '
                           'on the PYTHONPATH or path was not given.')
                    LOGGER.exception(msg, name)
                    raise err
                else:
                    # import module using path
                    # expand ~, environmental variables and make path absolute
                    if not os.path.isabs(path):
                        path = os.path.expanduser(os.path.expandvars(path))
                        path = os.path.abspath(path)
                    # paths must be a list
                    paths = [path]
                    # imp does not find hierarchical module names, find and load
                    # packages recursively, then load module, see last paragraph
                    # https://docs.python.org/2/library/imp.html#imp.find_module
                    pname = ''  # full dotted name of package to load
                    # traverse namespace
                    while name:
                        # if dot in name get first package
                        if '.' in name:
                            pkg, name = name.split('.', 1)
                        else:
                            pkg, name = name, None  # pkg is the module
                        # Find package or module by name and path
                        fp, filename, desc = imp.find_module(pkg, paths)
                        # full dotted name of package to load
                        pname = pkg if not pname else '%s.%s' % (pname, pkg)
                        LOGGER.debug('package name: %s', pname)
                        # try to load the package or module
                        try:
                            mod = imp.load_module(pname, fp, filename, desc)
                        finally:
                            if fp:
                                fp.close()
                        # append package paths for imp.find_module
                        if name:
                            paths = mod.__path__
        formulas = {}  # an empty list of formulas
        formula_param = self.parameters  # formulas key
        # FYI: iterating over dictionary is equivalent to iterkeys()
        if isinstance(formula_param, (list, tuple, dict)):
            # iterate through formulas
            for f in formula_param:
                formulas[f] = getattr(mod, f)
        elif isinstance(formula_param, basestring):
            # only one formula
            # FYI: use basestring to test for str and unicode
            # SEE: http://docs.python.org/2/library/functions.html#basestring
            formulas[formula_param] = getattr(mod, formula_param)
        else:
            # autodetect formulas assuming first letter is f
            formulas = {f: getattr(mod, f) for f in dir(mod) if f[:2] == 'f_'}
        if not len(formulas):
            for f in dir(mod):
                mod_attr = getattr(mod, f)
                if inspect.isfunction(mod_attr):
                    formulas[f] = mod_attr
        return formulas
792277
def explain_feature(featurename):
    '''
    '''

    import os
    import featuremonkey
    import importlib
    import subprocess

    def guess_version(feature_module):
        if hasattr(feature_module, '__version__'):
            return feature_module.__version__
        if hasattr(feature_module, 'get_version'):
            return feature_module.get_version()
        return ('unable to determine version:'
                ' please add __version__ or get_version()'
                ' to this feature module!')

    def git_rev(module):
        stdout, stderr = subprocess.Popen(
            ["git", "rev-parse", "HEAD"],
            cwd=os.path.dirname(module.__file__),
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE
        ).communicate()
        if 'Not a git repo' in stderr:
            return '-'
        else:
            return stdout.strip()

    def git_changes(module):
        stdout = subprocess.Popen(
            ["git", "diff", "--name-only"],
            cwd=os.path.dirname(module.__file__),
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE
        ).communicate()[0]
        return stdout.strip() or '-'

    if featurename in featuremonkey.get_features_from_equation_file(os.environ['PRODUCT_EQUATION_FILENAME']):
        print()
        print(featurename)
        print('-' * 60)
        print()
        is_subfeature = '.features.' in featurename
        try:
            feature_module = importlib.import_module(featurename)
        except ImportError:
            print('Error: unable to import feature "%s"' % featurename)

        print('Location: %s' % os.path.dirname(feature_module.__file__))
        print()
        if is_subfeature:
            print('Version: see parent feature')
            print()
        else:
            print('Version: %s' % str(guess_version(feature_module)))
            print()
            print('git: %s' % git_rev(feature_module))
            print()
            print('git changed: %s' % '\n\t\t'.join(git_changes(feature_module).split('\n')))
    else:
        print('No feature named ' + featurename)
9669
def create_project(self, name, **kwargs):
        
        data = self._wrap_dict("project", kwargs)
        data["customer"]["name"] = name
        return self.post("/projects.json", data=data)
1042713
def _create_product_map(self):
        """"""

        self._product_map = {}

        for dep in self._tile.dependencies:
            try:
                dep_tile = IOTile(os.path.join('build', 'deps', dep['unique_id']))
            except (ArgumentError, EnvironmentError):
                raise BuildError("Could not find required dependency", name=dep['name'])

            self._add_products(dep_tile)

        self._add_products(self._tile, show_all=True)
843241
def create_product (self, name, location='GLO', unit='kg', **kwargs):

        

        new_product = item_factory(name=name, location=location, unit=unit, type='product', **kwargs)

        if not self.exists_in_database(new_product['code']):
            self.add_to_database(new_product)
            #print ('{} added to database'.format(name))
            return self.get_exchange(name)
        else:
            #print('{} already exists in this database'.format(name))
            return False
761511
def generate_project(self):
        
        # checks needed properties
        if not self.name or not self.destdir or \
               not os.path.isdir(self.destdir):
            raise ValueError("Empty or invalid property values: run with 'help' command")

        _log("Generating project '%s'" % self.name)
        _log("Destination directory is: '%s'" % self.destdir)

        top = os.path.join(self.destdir, self.name)
        src = os.path.join(top, self.src_name)
        resources = os.path.join(top, self.res_name)
        utils = os.path.join(src, "utils")

        if self.complex:
            models = os.path.join(src, "models")
            ctrls = os.path.join(src, "ctrls")
            views = os.path.join(src, "views")
        else: models = ctrls = views = src

        res = self.__generate_tree(top, src, resources, models, ctrls, views, utils)
        res = self.__generate_classes(models, ctrls, views) or res
        res = self.__mksrc(os.path.join(utils, "globals.py"), templates.glob) or res

        if self.complex: self.templ.update({'model_import' : "from models.application import ApplModel",
                                            'ctrl_import' : "from ctrls.application import ApplCtrl",
                                            'view_import' : "from views.application import ApplView"})
        else: self.templ.update({'model_import' : "from ApplModel import ApplModel",
                                 'ctrl_import' : "from ApplCtrl import ApplCtrl",
                                 'view_import' : "from ApplView import ApplView"})

        res = self.__mksrc(os.path.join(top, "%s.py" % self.name), templates.main) or res

        # builder file
        if self.builder:
            res = self.__generate_builder(resources) or res

        if self.dist_gtkmvc3: res = self.__copy_framework(os.path.join(resources, "external")) or res

        if not res: _log("No actions were taken")
        else: _log("Done")
        return res
101182
function getProduct(guesses) {
      return reduce(guesses, function(result, guess) {
        var pattern = guess.pattern || qualify(guess);
        if (!result && (result =
              RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) ||
              RegExp('\\b' + pattern + ' *\\w+-[\\w]*', 'i').exec(ua) ||
              RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua)
            )) {
          // Split by forward slash and append product version if needed.
          if ((result = String((guess.label && !RegExp(pattern, 'i').test(guess.label)) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) {
            result[0] += ' ' + result[1];
          }
          // Correct character case and cleanup string.
          guess = guess.label || guess;
          result = format(result[0]
            .replace(RegExp(pattern, 'i'), guess)
            .replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ')
            .replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2'));
        }
        return result;
      });
    }