def handle_install_binaries(dist, attr, value):
    "Handles the install_binaries= setup() keyword arg"

    assert_string_list(dist, attr, value)

    script_args = ''.join(getattr(dist, 'script_args', []))

    if 'install' in script_args:
        if not ('single-version-externally-managed' in script_args
                or getattr(dist, 'single_version_externally_managed', 0)
                or getattr(dist, 'old_and_unmanageable', 0)):
            #
            # If none of those options are set, setuptools will run
            # easy_install.  easy_install, in turn, will install as an egg, and
            # doesn't run its sub_commands, so we can't install our binaries
            # (without much hackery).
            #
            # pip sets single_version_externally_managed.
            #

            log.warn('Warning: "easy_install" and "setup.py install" are'
                     ' unlikely to install binaries correctly')
            log.warn('Run "pip install <package or directory>" instead')

    from setuptools.command.install import install
    install.sub_commands.append(
        ('install_binaries', lambda *a: True))
Example #2
0
def validate_cmake_scripts(dist, attr, value):
    """ Validation for cmake_scripts keyword """
    assert_string_list(dist, attr, value)
    if (value):
        setuptools.command.build_ext.build_ext = build_ext
        distutils.command.build.build = build
        setuptools.command.install_lib.install_lib = cmd_install_lib
        set_has_ext_modules(dist)
Example #3
0
def validate_cmake_scripts(dist, attr, value):
    """ Validation for cmake_scripts keyword """
    assert_string_list(dist, attr, value)
    if (value):
        setuptools.command.build_ext.build_ext = build_ext
        distutils.command.build.build = build
        setuptools.command.install_lib.install_lib = cmd_install_lib
        set_has_ext_modules(dist)
Example #4
0
def validate_postinstall_scripts(dist, attr, value):
    """ Validation for postinstall_scripts keyword"""
    try:
        assert_string_list(dist, attr, value)

        if (value):
            # Change commands
            setuptools.command.install.install = install

    except (TypeError, ValueError, AttributeError, AssertionError):
        raise DistutilsSetupError(
            "%r must be a list of strings (got %r)" % (attr, value))
Example #5
0
def validate_postinstall_scripts(dist, attr, value):
    """ Validation for postinstall_scripts keyword"""
    try:
        assert_string_list(dist, attr, value)

        if (value):
            # Change commands
            setuptools.command.install.install = install

    except (TypeError, ValueError, AttributeError, AssertionError):
        raise DistutilsSetupError("%r must be a list of strings (got %r)" %
                                  (attr, value))
Example #6
0
def validate_share_dirs(dist, attr, value):
    """ Validation for shared directories keywords"""
    try:
        assert_string_list(dist, attr, list(value.keys()))
        assert_string_list(dist, attr, list(value.values()))

        if (value):
            # Change commands
            setuptools.command.build_py.build_py = build_py
            setuptools.command.install.install = install
            set_has_ext_modules(dist)

    except (TypeError, ValueError, AttributeError, AssertionError):
        raise DistutilsSetupError(
            "%r must be a dict of strings (got %r)" % (attr, value))
Example #7
0
def validate_share_dirs(dist, attr, value):
    """ Validation for shared directories keywords"""
    try:
        assert_string_list(dist, attr, list(value.keys()))
        assert_string_list(dist, attr, list(value.values()))

        if (value):
            # Change commands
            setuptools.command.build_py.build_py = build_py
            setuptools.command.install.install = install
            set_has_ext_modules(dist)

    except (TypeError, ValueError, AttributeError, AssertionError):
        raise DistutilsSetupError("%r must be a dict of strings (got %r)" %
                                  (attr, value))