# Buggy code
def get_builder(*args, **kwargs):
    """Intelligently returns an appropriate builder instance"""

    if sys.platform == "win32":
        from .windows import WindowsBuilder

        cls = WindowsBuilder
    elif sys.platform == "darwin":
        from .macos import MacOSBuilder

        cls = MacOSBuilder
    elif sys.platform == "linux":
        from .debian import DebianBuilder, DebianStretchBuilder, UbuntuXenialBuilder
        from ._external import distro

        dist_id, dist_version, dist_codename = distro.linux_distribution(
            full_distribution_name=False
        )
        if dist_id == "debian" and (
            dist_codename == "stretch"
            or dist_codename == "sid"
            or dist_version == "testing"
        ):
            cls = DebianStretchBuilder
        elif dist_id == "ubuntu":
            cls = UbuntuXenialBuilder
        else:
            from .linux import LinuxStaticBuilder

            cls = LinuxStaticBuilder
    else:
        raise BuilderException(
            "Unsupported sys.platform value'{}'".format(sys.platform)
        )
    return cls(*args, **kwargs)


# Traceback (NameError)
Now at patch ../patches/ungoogled-chromium/remove-get-help-button.patch
2016-09-29 16:58:58,672 - INFO: Running gyp command...
2016-09-29 16:58:58,673 - DEBUG: Appending resources/common/gyp_flags
2016-09-29 16:58:58,673 - DEBUG: Appending resources/linux_static/gyp_flags
2016-09-29 16:58:58,673 - DEBUG: GYP command: build/gyp_chromium --depth=. --check -Denable_rlz=0 -Duse_official_google_api_keys=0 -Dproprietary_codecs=1 -Dfieldtrial_testing_like_official_build=1 -Denable_hangout_services_extension=0 -Ddisable_newlib=1 -Denable_webrtc=0 -Dremoting=0 -Ddefault_apps_list_linux_dest=[] -Ddisable_nacl=1 -Dtracing_like_official_build=1 -Ddisable_fatal_linker_warnings=1 -Denable_prod_wallet_service=0 -Denable_google_now=0 -Denable_automation=0 -Denable_one_click_signin=0 -Dremove_webcore_debug_symbols=1 -Ddisable_pnacl=1 -Dbuildtype=Official -Dwerror= -Denable_hotwording=0 -Denable_pre_sync_backup=0 -Dffmpeg_branding=Chrome -Dfastbuild=2 -Dlinux_strip_binary=1 -Denable_hidpi=1 -Denable_wifi_bootstrapping=0 -Denable_remoting_host=0 -Ddefault_apps_list=[] -Dsafe_browsing=0
Traceback (most recent call last):
File "build/gyp_chromium", line 12, in <module>
execfile(__file__ + '.py')
NameError: name 'execfile' is not defined
2016-09-29 16:58:58,694 - ERROR: GYP command returned non-zero exit code: 1

# Fixed code
def get_builder(*args, **kwargs):
    """Intelligently returns an appropriate builder instance"""

    if sys.platform == "win32":
        from .windows import WindowsBuilder

        cls = WindowsBuilder
    elif sys.platform == "darwin":
        from .macos import MacOSBuilder

        cls = MacOSBuilder
    elif sys.platform == "linux":
        from ._external import distro

        dist_id, dist_version, dist_codename = distro.linux_distribution(
            full_distribution_name=False
        )
        if dist_id == "debian" and (
            dist_codename == "stretch"
            or dist_codename == "sid"
            or dist_version == "testing"
        ):
            from .debian import DebianStretchBuilder

            cls = DebianStretchBuilder
        elif dist_id == "ubuntu":
            from .debian import UbuntuXenialBuilder

            cls = UbuntuXenialBuilder
        elif dist_id == "arch":
            from .archlinux import ArchLinuxBuilder

            cls = ArchLinuxBuilder
        else:
            from .linux import LinuxStaticBuilder

            cls = LinuxStaticBuilder
    else:
        raise BuilderException(
            "Unsupported sys.platform value'{}'".format(sys.platform)
        )
    return cls(*args, **kwargs)