def gerberise(manufacturer='default'):

    # Open the board's SVG
    svg_in = utils.openBoardSVG()

    # Get Gerber generation settings
    gcd = config.brd['gerber']
    decimals = gcd['decimals']
    digits = gcd['digits'] 
    steps = gcd['steps-per-segment']
    length = gcd['min-segment-length']

    # Get layer data
    xpath_regex = ""
    ns = {'pcbmode':config.cfg['ns']['pcbmode'],
          'svg':config.cfg['ns']['svg']} 


    # Save to file
    base_dir = os.path.join(config.cfg['base-dir'], 
                            config.cfg['locations']['build'], 
                            'production')
    # Create directory if it doesn't exist already
    utils.create_dir(base_dir)
    base_name = "%s_rev_%s" % (config.brd['config']['name'],
                               config.brd['config']['rev'])
 
    filename_info = config.cfg['manufacturers'][manufacturer]['filenames']['gerbers']

    # Process Gerbers for PCB layers and sheets
    #for pcb_layer in utils.getSurfaceLayers():
    for pcb_layer in config.stk['layer-names']:

        # Get the SVG layer corresponding to the PCB layer
        svg_layer = svg_in.find("//svg:g[@pcbmode:pcb-layer='%s']" % (pcb_layer),
                                namespaces=ns)

        # Get masks (must be placed right after pours)
        mask_paths = svg_in.findall(".//svg:defs//svg:mask[@pcbmode:pcb-layer='%s']//svg:path" % pcb_layer,
                                       namespaces=ns)

        sheets = ['conductor', 'soldermask', 'solderpaste', 'silkscreen']
#        sheets = ['conductor']
        for sheet in sheets:
            # Get the SVG layer corresponding to the 'sheet'
            sheet_layer = svg_layer.find(".//svg:g[@pcbmode:sheet='%s']" % (sheet),
                                         namespaces=ns)

            if sheet == 'conductor':
                mask_paths_to_pass = mask_paths
            else:
                mask_paths_to_pass = []

            if sheet_layer != None:
                # Create a Gerber object
                gerber = Gerber(sheet_layer,
                                mask_paths_to_pass,
                                decimals,
                                digits,
                                steps,
                                length)
     
                add = '_%s_%s.%s' % (pcb_layer, sheet,
                                     filename_info[pcb_layer.split('-')[0]][sheet].get('ext') or 'ger')
                filename = os.path.join(base_dir, base_name + add)
     
                with open(filename, "wb") as f:
                    for line in gerber.getGerber():
                        f.write(line)


    # Process module sheets
    sheets = ['outline', 'documentation']
    for sheet in sheets:
        # Get the SVG layer corresponding to the 'sheet'
        sheet_layer = svg_in.find(".//svg:g[@pcbmode:sheet='%s']" % (sheet),
                                  namespaces=ns)            

        # Create a Gerber object
        gerber = Gerber(sheet_layer,
                        [],
                        decimals,
                        digits,
                        steps,
                        length)

        add = '_%s.%s' % (sheet,
                          filename_info['other'][sheet].get('ext') or 'ger')
        filename = os.path.join(base_dir, base_name + add)

        with open(filename, "wb") as f:
            for line in gerber.getGerber(False):
                f.write(line)


    return ['bullshit']
Generate Gerbers for one or more layers
dataset/ETHPy150Open boldport/pcbmode/pcbmode/utils/gerber.py/gerberise