Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
setuptools_frontend.py109 linesDownload Raw Back to messages
1from __future__ import annotations2 3from babel.messages import frontend4 5try:6    # See: https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html7    from setuptools import Command8 9    try:10        from setuptools.errors import BaseError, OptionError, SetupError11    except ImportError:  # Error aliases only added in setuptools 59 (2021-11).12        OptionError = SetupError = BaseError = Exception13 14except ImportError:15    from distutils.cmd import Command16    from distutils.errors import DistutilsSetupError as SetupError17 18 19def check_message_extractors(dist, name, value):20    """Validate the ``message_extractors`` keyword argument to ``setup()``.21 22    :param dist: the distutils/setuptools ``Distribution`` object23    :param name: the name of the keyword argument (should always be24                 "message_extractors")25    :param value: the value of the keyword argument26    :raise `DistutilsSetupError`: if the value is not valid27    """28    assert name == "message_extractors"29    if not isinstance(value, dict):30        raise SetupError(31            'the value of the "message_extractors" parameter must be a dictionary',32        )33 34 35class compile_catalog(frontend.CompileCatalog, Command):36    """Catalog compilation command for use in ``setup.py`` scripts.37 38    If correctly installed, this command is available to Setuptools-using39    setup scripts automatically. For projects using plain old ``distutils``,40    the command needs to be registered explicitly in ``setup.py``::41 42        from babel.messages.setuptools_frontend import compile_catalog43 44        setup(45            ...46            cmdclass = {'compile_catalog': compile_catalog}47        )48 49    .. versionadded:: 0.950    """51 52 53class extract_messages(frontend.ExtractMessages, Command):54    """Message extraction command for use in ``setup.py`` scripts.55 56    If correctly installed, this command is available to Setuptools-using57    setup scripts automatically. For projects using plain old ``distutils``,58    the command needs to be registered explicitly in ``setup.py``::59 60        from babel.messages.setuptools_frontend import extract_messages61 62        setup(63            ...64            cmdclass = {'extract_messages': extract_messages}65        )66    """67 68 69class init_catalog(frontend.InitCatalog, Command):70    """New catalog initialization command for use in ``setup.py`` scripts.71 72    If correctly installed, this command is available to Setuptools-using73    setup scripts automatically. For projects using plain old ``distutils``,74    the command needs to be registered explicitly in ``setup.py``::75 76        from babel.messages.setuptools_frontend import init_catalog77 78        setup(79            ...80            cmdclass = {'init_catalog': init_catalog}81        )82    """83 84 85class update_catalog(frontend.UpdateCatalog, Command):86    """Catalog merging command for use in ``setup.py`` scripts.87 88    If correctly installed, this command is available to Setuptools-using89    setup scripts automatically. For projects using plain old ``distutils``,90    the command needs to be registered explicitly in ``setup.py``::91 92        from babel.messages.setuptools_frontend import update_catalog93 94        setup(95            ...96            cmdclass = {'update_catalog': update_catalog}97        )98 99    .. versionadded:: 0.9100    """101 102 103COMMANDS = {104    "compile_catalog": compile_catalog,105    "extract_messages": extract_messages,106    "init_catalog": init_catalog,107    "update_catalog": update_catalog,108}109 
codekingpro/portable-devtools · Team Ai