import sys
import shutil
import os
from fontTools.ttLib import TTFont
from fontTools.varLib.instancer import instantiateVariableFont
from scripts import (
    update_names,
    update_attribs,
    mkdir
)


instances = [
    {
        "attribs": {"fsSelection": 64, "macStyle": 0, "usWeightClass": 250},
        "axes": {"ital": 0.0, "wdth": 100, "wght": 100},
        "filename": "Roboto-Thin.ttf",
        "names": {
            "1,3,1,1033": "Roboto Thin",
            "16,3,1,1033": "Roboto",
            "17,3,1,1033": "Thin",
            "2,3,1,1033": "Regular",
            "3,3,1,1033": "Google:Roboto Thin:2016",
            "4,3,1,1033": "Roboto Thin",
            "6,3,1,1033": "Roboto-Thin",
        },
    },
    {
        "attribs": {"fsSelection": 513, "macStyle": 2, "usWeightClass": 250, "italicAngle": -12, "caretSlopeRise": 2048, "caretSlopeRun": 435},
        "axes": {"ital": 1.0, "wdth": 100, "wght": 100},
        "filename": "Roboto-ThinItalic.ttf",
        "names": {
            "1,3,1,1033": "Roboto Thin",
            "16,3,1,1033": "Roboto",
            "17,3,1,1033": "Thin Italic",
            "2,3,1,1033": "Italic",
            "3,3,1,1033": "Google:Roboto Thin Italic:2016",
            "4,3,1,1033": "Roboto Thin Italic",
            "6,3,1,1033": "Roboto-ThinItalic",
        },
    },
    {
        "attribs": {"fsSelection": 64, "macStyle": 0, "usWeightClass": 300},
        "axes": {"ital": 0.0, "wdth": 100, "wght": 300},
        "filename": "Roboto-Light.ttf",
        "names": {
            "1,3,1,1033": "Roboto Light",
            "16,3,1,1033": "Roboto",
            "17,3,1,1033": "Light",
            "2,3,1,1033": "Regular",
            "3,3,1,1033": "Google:Roboto Light:2016",
            "4,3,1,1033": "Roboto Light",
            "6,3,1,1033": "Roboto-Light",
        },
    },
    {
        "attribs": {"fsSelection": 64, "macStyle": 0, "usWeightClass": 300, "usWidthClass": 5},
        "axes": {"ital": 0.0, "wdth": 75.0, "wght": 300},
        "filename": "RobotoCondensed-Light.ttf",
        "names": {
            "1,3,1,1033": "Roboto Condensed Light",
            "16,3,1,1033": "Roboto Condensed",
            "17,3,1,1033": "Light",
            "2,3,1,1033": "Regular",
            "3,3,1,1033": "Google:Roboto Condensed Light:2016",
            "4,3,1,1033": "Roboto Condensed Light",
            "6,3,1,1033": "RobotoCondensed-Light",
        },
    },
    {
        "attribs": {"fsSelection": 513, "macStyle": 2, "usWeightClass": 300, "italicAngle": -12, "usWidthClass": 5, "caretSlopeRise": 2048, "caretSlopeRun": 435},
        "axes": {"ital": 1.0, "wdth": 75.0, "wght": 300},
        "filename": "RobotoCondensed-LightItalic.ttf",
        "names": {
            "1,3,1,1033": "Roboto Condensed Light",
            "16,3,1,1033": "Roboto Condensed",
            "17,3,1,1033": "Light Italic",
            "2,3,1,1033": "Italic",
            "3,3,1,1033": "Google:Roboto Condensed Light Italic:2016",
            "4,3,1,1033": "Roboto Condensed Light Italic",
            "6,3,1,1033": "RobotoCondensed-LightItalic",
        },
    },
    {
        "attribs": {"fsSelection": 513, "macStyle": 2, "usWeightClass": 300, "italicAngle": -12, "caretSlopeRise": 2048, "caretSlopeRun": 435},
        "axes": {"ital": 1.0, "wdth": 100, "wght": 300},
        "filename": "Roboto-LightItalic.ttf",
        "names": {
            "1,3,1,1033": "Roboto Light",
            "16,3,1,1033": "Roboto",
            "17,3,1,1033": "Light Italic",
            "2,3,1,1033": "Italic",
            "3,3,1,1033": "Google:Roboto Light Italic:2016",
            "4,3,1,1033": "Roboto Light Italic",
            "6,3,1,1033": "Roboto-LightItalic",
        },
    },
    {
        "attribs": {"fsSelection": 64, "macStyle": 0, "usWeightClass": 400},
        "axes": {"ital": 0.0, "wdth": 100, "wght": 400},
        "filename": "Roboto-Regular.ttf",
        "names": {
            "1,3,1,1033": "Roboto",
            "2,3,1,1033": "Regular",
            "3,3,1,1033": "Google:Roboto Regular:2016",
            "4,3,1,1033": "Roboto",
            "6,3,1,1033": "Roboto-Regular",
        },
    },
    {
            "attribs": {"fsSelection": 64, "macStyle": 0, "usWeightClass": 400, "usWidthClass": 5},
        "axes": {"ital": 0.0, "wdth": 75.0, "wght": 400},
        "filename": "RobotoCondensed-Regular.ttf",
        "names": {
            "1,3,1,1033": "Roboto Condensed",
            "2,3,1,1033": "Regular",
            "3,3,1,1033": "Google:Roboto Condensed Regular:2016",
            "4,3,1,1033": "Roboto Condensed",
            "6,3,1,1033": "RobotoCondensed-Regular",
        },
    },
    {
        "attribs": {"fsSelection": 513, "macStyle": 2, "usWeightClass": 400, "italicAngle": -12, "usWidthClass": 5, "caretSlopeRise": 2048, "caretSlopeRun": 435},
        "axes": {"ital": 1.0, "wdth": 75.0, "wght": 400},
        "filename": "RobotoCondensed-Italic.ttf",
        "names": {
            "1,3,1,1033": "Roboto Condensed",
            "2,3,1,1033": "Italic",
            "3,3,1,1033": "Google:Roboto Condensed Italic:2016",
            "4,3,1,1033": "Roboto Condensed Italic",
            "6,3,1,1033": "RobotoCondensed-Italic",
        },
    },
    {
        "attribs": {"fsSelection": 513, "macStyle": 2, "usWeightClass": 400, "italicAngle": -12, "caretSlopeRise": 2048, "caretSlopeRun": 435},
        "axes": {"ital": 1.0, "wdth": 100, "wght": 400},
        "filename": "Roboto-Italic.ttf",
        "names": {
            "1,3,1,1033": "Roboto",
            "2,3,1,1033": "Italic",
            "3,3,1,1033": "Google:Roboto Italic:2016",
            "4,3,1,1033": "Roboto Italic",
            "6,3,1,1033": "Roboto-Italic",
        },
    },
    {
        "attribs": {"fsSelection": 64, "macStyle": 0, "usWeightClass": 500, "usWidthClass": 5},
        "axes": {"ital": 0.0, "wdth": 75.0, "wght": 500},
        "filename": "RobotoCondensed-Medium.ttf",
        "names": {
            "1,3,1,1033": "Roboto Condensed Medium",
            "2,3,1,1033": "Regular",
            "3,3,1,1033": "Google:Roboto Condensed Medium:2016",
            "4,3,1,1033": "Roboto Condensed Medium",
            "6,3,1,1033": "RobotoCondensed-Medium",
            "16,3,1,1033": "Roboto Condensed",
            "17,3,1,1033": "Medium",
        },
    },
    {
        "attribs": {"fsSelection": 64, "macStyle": 0, "usWeightClass": 500},