def run_pre_publishers():
    from anima.env import mayaEnv
    m_env = mayaEnv.Maya()

    version = m_env.get_current_version()

    # check if we have a proper version
    if not version:
        return

    # check if it is a Representation
    from anima.repr import Representation
    if Representation.repr_separator in version.take_name:
        return

    if version.is_published:
        from anima.publish import (run_publishers, staging, PRE_PUBLISHER_TYPE,
                                   POST_PUBLISHER_TYPE)
        # before doing anything run all publishers
        type_name = ''
        if version.task.type:
            type_name = version.task.type.name

        # before running use the staging area to store the current version
        staging['version'] = version
        run_publishers(type_name)
        # do not forget to clean up the staging area
        staging.clear()
    else:
        # run some of the publishers
        from anima.env.mayaEnv.publish import PublishError
        from anima.env.mayaEnv import publish as publish_scripts
        try:
            publish_scripts.check_node_names_with_bad_characters()
        except PublishError as e:
            # pop up a message box with the error
            pm.confirmDialog(
                title='SaveError',
                message=str(''.join([i for i in unicode(e) if ord(i) < 128])),
                button=['Ok']
            )
            raise e
runs pre publishers if the current scene is a published version
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/auxiliary.py/run_pre_publishers