Exemple #1
0
def virtualenv_requirements(version_info=sys.version_info):
    """
    Generate Python version specific virtualenv package requirements.

    The requirements are returned as setuptools/pip compatible requirement
    specification strings.

    """
    if version_info < (2, 5):
        # 'virtualenv' release 1.8 dropped Python 2.4.x compatibility.
        yield requirement_spec("virtualenv",
            ("<", lowest_version_string_with_prefix("1.8")))
    elif version_info < (2, 6):
        # 'virtualenv' release 1.10 dropped Python 2.5.x compatibility.
        yield requirement_spec("virtualenv",
            ("<", lowest_version_string_with_prefix("1.10")))
    else:
        yield requirement_spec("virtualenv")
Exemple #2
0
def virtualenv_requirements(version_info=sys.version_info):
    """
    Generate Python version specific virtualenv package requirements.

    The requirements are returned as setuptools/pip compatible requirement
    specification strings.

    """
    if version_info < (2, 5):
        # 'virtualenv' release 1.8 dropped Python 2.4.x compatibility.
        yield requirement_spec("virtualenv",
                               ("<", lowest_version_string_with_prefix("1.8")))
    elif version_info < (2, 6):
        # 'virtualenv' release 1.10 dropped Python 2.5.x compatibility.
        yield requirement_spec(
            "virtualenv", ("<", lowest_version_string_with_prefix("1.10")))
    else:
        yield requirement_spec("virtualenv")
Exemple #3
0
def six_requirements(version_info=sys.version_info):
    """
    Generate Python version specific six package requirements.

    The requirements are returned as setuptools/pip compatible requirement
    specification strings.

    """
    if version_info < (2, 5):
        # 'six' release 1.5 dropped Python 2.4.x compatibility.
        yield requirement_spec("six",
            ("<", lowest_version_string_with_prefix("1.5")))
    else:
        yield requirement_spec("six")
Exemple #4
0
def six_requirements(version_info=sys.version_info):
    """
    Generate Python version specific six package requirements.

    The requirements are returned as setuptools/pip compatible requirement
    specification strings.

    """
    if version_info < (2, 5):
        # 'six' release 1.5 dropped Python 2.4.x compatibility.
        yield requirement_spec("six",
                               ("<", lowest_version_string_with_prefix("1.5")))
    else:
        yield requirement_spec("six")
def _avoid_setuptools_zipped_egg_upgrade_issue(env, ez_setup):
    """
    Avoid the setuptools self-upgrade issue.

    setuptools versions prior to version 3.5.2 have a bug that can cause their
    upgrade installations to fail when installing a new zipped egg distribution
    over an existing zipped egg setuptools distribution with the same name.

    The following Python versions are not affected by this issue:
      Python 2.4 - use setuptools 1.4.2 - installs itself as a non-zipped egg
      Python 2.6+ - use setuptools versions not affected by this issue
    That just leaves Python versions 2.5.x to worry about.

    This problem occurs because of an internal stale cache issue causing the
    upgrade to read data from the new zip archive at a location calculated
    based on the original zip archive's content, effectively causing such read
    operations to either succeed (if read content had not changed its
    location), fail with a 'bad local header' exception or even fail silently
    and return incorrect data.

    To avoid the issue, we explicitly uninstall the previously installed
    setuptools distribution before installing its new version.

    """
    if env.sys_version_info[:2] != (2, 5):
        return  # only Python 2.5.x affected by this
    if not env.setuptools_zipped_egg:
        return  # setuptools not pre-installed as a zipped egg
    pv_new = parse_version(ez_setup.setuptools_version())
    if pv_new != parse_version(env.setuptools_version):
        return  # issue avoided since zipped egg archive names will not match
    fixed_version = utility.lowest_version_string_with_prefix("3.5.2")
    if pv_new >= parse_version(fixed_version):
        return  # issue fixed in setuptools
    # We could check for pip and use it for a cleaner setuptools uninstall if
    # available, but YAGNI since only Python 2.5.x environments are affected by
    # the zipped egg upgrade issue.
    os.remove(env.setuptools_zipped_egg)
Exemple #6
0
def _avoid_setuptools_zipped_egg_upgrade_issue(env, ez_setup):
    """
    Avoid the setuptools self-upgrade issue.

    setuptools versions prior to version 3.5.2 have a bug that can cause their
    upgrade installations to fail when installing a new zipped egg distribution
    over an existing zipped egg setuptools distribution with the same name.

    The following Python versions are not affected by this issue:
      Python 2.4 - use setuptools 1.4.2 - installs itself as a non-zipped egg
      Python 2.6+ - use setuptools versions not affected by this issue
    That just leaves Python versions 2.5.x to worry about.

    This problem occurs because of an internal stale cache issue causing the
    upgrade to read data from the new zip archive at a location calculated
    based on the original zip archive's content, effectively causing such read
    operations to either succeed (if read content had not changed its
    location), fail with a 'bad local header' exception or even fail silently
    and return incorrect data.

    To avoid the issue, we explicitly uninstall the previously installed
    setuptools distribution before installing its new version.

    """
    if env.sys_version_info[:2] != (2, 5):
        return  # only Python 2.5.x affected by this
    if not env.setuptools_zipped_egg:
        return  # setuptools not pre-installed as a zipped egg
    pv_new = parse_version(ez_setup.setuptools_version())
    if pv_new != parse_version(env.setuptools_version):
        return  # issue avoided since zipped egg archive names will not match
    fixed_version = utility.lowest_version_string_with_prefix("3.5.2")
    if pv_new >= parse_version(fixed_version):
        return  # issue fixed in setuptools
    # We could check for pip and use it for a cleaner setuptools uninstall if
    # available, but YAGNI since only Python 2.5.x environments are affected by
    # the zipped egg upgrade issue.
    os.remove(env.setuptools_zipped_egg)
Exemple #7
0
def pytest_requirements(version_info=None, ctypes_version=_Unspecified):
    """
    Generate Python version specific pytest package requirements.

    The requirements are returned as setuptools/pip compatible requirement
    specification strings.

    As a slight optimization, specify no Python version information to indicate
    that the requirements are being listed for the current Python environment.

    Missing ctypes installation should be indicated by setting ctypes_version
    parameter to None, while not specifying it indicates that no ctypes version
    information is provided.

    """
    current_environment = version_info is None
    if current_environment:
        version_info = sys.version_info

    pytest_version = None
    if version_info < (2, 5):
        pytest_version = (
            (">=", _first_supported_pytest_version),
            ("<", _first_unsupported_pytest_version_on_Python_24))
        yield requirement_spec("py",
            ("<", _first_unsupported_py_version_on_Python_24))
        #IDEA: In this case we could run the pytest installation separately
        # from all the other pip based installations and have it not install
        # pytest scripts. Since in general there is no 'setup.py install' or
        # 'pip' command-line argument that can say 'do not install scripts',
        # this would most likely need to use a pip command-line option like
        # '--install-option="--install-scripts=..."' to make the scripts be
        # installed into a temporary folder and then remove that folder after
        # the installation. An alternative would be to use easy_install which
        # does support the --exclude-scripts command-line option. N.B. This
        # could work for the project's Python environment setup scripts but not
        # when installing the the project's using its setup script as that
        # script expects to set up all the required packages itself.

    # pytest on Windows depends on the colorama package, and that package has
    # several accidental backward compatibility issues we have to work around
    # when using Python 2.5.
    elif version_info < (2, 6):
        if sys.platform == "win32":
            # colorama releases [0.1.11 - 0.3.2> do not work unless the ctypes
            # module is available, but that module is not included in 64-bit
            # CPython distributions (tested using Python 2.5.4). Some of those
            # versions fail to install, while others only fail at run-time.
            # Pull request https://github.com/tartley/colorama/pull/4 resolves
            # this issue for colorama release 0.3.2.
            if ctypes_version is _Unspecified:
                assert current_environment
                try:
                    from ctypes import __version__ as ctypes_version
                except ImportError:
                    ctypes_version = None
            if ctypes_version is None:
                # We could try to install an external 'ctypes' package from
                # PyPI here, but that would require an old C++ compiler and so
                # would not be highly likely to work in any concurrent
                # development environment.
                #
                #TODO: When using colorama releases older than 0.1.11, you
                # might get atexit() errors on process shutdown after running
                # the project's 'setup.py test' command and having it
                # automatically install the colorama package in the process.
                # The error itself is benign and there are no other effects to
                # it other than the error message getting displayed. The whole
                # issue is caused by colorama's atexit handler getting called
                # multiple times due to some internal setuptools module loading
                # and unloading. We found no easy workaround to this so update
                # this code to use the colorama package version 0.3.2+ as soon
                # as it gets released. When this is done, also remove a related
                # setup.py comment.
                v_bad_low = lowest_version_string_with_prefix("0.1.11")
                v_bad_high = "0.3.2"
                version_spec = ("<", v_bad_low), (">=", v_bad_high)
            else:
                # colorama 0.3.1 release accidentally uses the 'with' keyword
                # without a corresponding __future__ import in its setup.py
                # script.
                version_spec = ("!=", "0.3.1"),
            yield requirement_spec("colorama", *version_spec)

        yield requirement_spec("py",
            ("<", _first_unsupported_py_version_on_Python_25))

        pytest_version = (
            (">=", _first_supported_pytest_version),
            ("<", _first_unsupported_pytest_version_on_Python_25))

    # Python 3.0 & 3.1 stdlib does not include the argparse module which pytest
    # requires, even though it does not list it explicitly among its
    # requirements. Python 3.x series introduced the argparse module in its 3.2
    # release so it needs to be installed manually in 3.0.x & 3.1.x releases.
    # Tested that pytest 2.5.2+ requires py 1.4.20+ which in turn requires the
    # argparse module but does not specify this dependency explicitly.
    elif (3,) <= version_info < (3, 2):
        # pytest versions prior to 2.6.0 are not compatible with Python 3.1,
        # mostly due to accidental incompatibilities introduced because that is
        # not one of the officially supported platforms for pytest and so does
        # not get regular testing. Development version 2.6.0 has been tested
        # with this project and found to work correctly.
        #TODO: Once pytest 2.6.0 has been officially released change the pytest
        # requirement to ("==", "2.6.0").
        pytest_version = (">=", lowest_version_string_with_prefix("2.6.0")),
        missing_argparse = True
        if current_environment:
            try:
                import argparse
                missing_argparse = False
            except ImportError:
                pass
        if missing_argparse:
            yield requirement_spec("argparse")

    if not pytest_version:
        pytest_version = (">=", _first_supported_pytest_version),
    yield requirement_spec("pytest", *pytest_version)
Exemple #8
0
"""

import sys

from suds_devel.parse_version import parse_version
from suds_devel.utility import (lowest_version_string_with_prefix,
    requirement_spec)


class _Unspecified:
    pass


_first_unsupported_py_version_on_Python_24 = (
    lowest_version_string_with_prefix("1.4.16"))
_first_unsupported_py_version_on_Python_25 = (
    lowest_version_string_with_prefix("1.4.24"))

# pytest versions prior to 2.4.0 do not support non-string 'skipif'
# expressions.
_first_supported_pytest_version = "2.4.0"
_first_unsupported_pytest_version_on_Python_24 = (
    lowest_version_string_with_prefix("2.4.2"))
# pytest version 2.6.0 actually supports Python 2.5 but has some internal
# issues causing it to break our our tests, while version 2.6.1 fails to
# install on Python 2.5 all together.
_first_unsupported_pytest_version_on_Python_25 = (
    lowest_version_string_with_prefix("2.6.0"))

Exemple #9
0
def pytest_requirements(version_info=None, ctypes_version=_Unspecified):
    """
    Generate Python version specific pytest package requirements.

    The requirements are returned as setuptools/pip compatible requirement
    specification strings.

    As a slight optimization, specify no Python version information to indicate
    that the requirements are being listed for the current Python environment.

    Missing ctypes installation should be indicated by setting ctypes_version
    parameter to None, while not specifying it indicates that no ctypes version
    information is provided.

    """
    current_environment = version_info is None
    if current_environment:
        version_info = sys.version_info

    pytest_version = None
    if version_info < (2, 5):
        pytest_version = ((">=", _first_supported_pytest_version),
                          ("<",
                           _first_unsupported_pytest_version_on_Python_24))
        yield requirement_spec(
            "py", ("<", _first_unsupported_py_version_on_Python_24))
        #IDEA: In this case we could run the pytest installation separately
        # from all the other pip based installations and have it not install
        # pytest scripts. Since in general there is no 'setup.py install' or
        # 'pip' command-line argument that can say 'do not install scripts',
        # this would most likely need to use a pip command-line option like
        # '--install-option="--install-scripts=..."' to make the scripts be
        # installed into a temporary folder and then remove that folder after
        # the installation. An alternative would be to use easy_install which
        # does support the --exclude-scripts command-line option. N.B. This
        # could work for the project's Python environment setup scripts but not
        # when installing the the project's using its setup script as that
        # script expects to set up all the required packages itself.

    # pytest on Windows depends on the colorama package, and that package has
    # several accidental backward compatibility issues we have to work around
    # when using Python 2.5.
    elif version_info < (2, 6):
        if sys.platform == "win32":
            # colorama releases [0.1.11 - 0.3.2> do not work unless the ctypes
            # module is available, but that module is not included in 64-bit
            # CPython distributions (tested using Python 2.5.4). Some of those
            # versions fail to install, while others only fail at run-time.
            # Pull request https://github.com/tartley/colorama/pull/4 resolves
            # this issue for colorama release 0.3.2.
            if ctypes_version is _Unspecified:
                assert current_environment
                try:
                    from ctypes import __version__ as ctypes_version
                except ImportError:
                    ctypes_version = None
            if ctypes_version is None:
                # We could try to install an external 'ctypes' package from
                # PyPI here, but that would require an old C++ compiler and so
                # would not be highly likely to work in any concurrent
                # development environment.
                #
                #TODO: When using colorama releases older than 0.1.11, you
                # might get atexit() errors on process shutdown after running
                # the project's 'setup.py test' command and having it
                # automatically install the colorama package in the process.
                # The error itself is benign and there are no other effects to
                # it other than the error message getting displayed. The whole
                # issue is caused by colorama's atexit handler getting called
                # multiple times due to some internal setuptools module loading
                # and unloading. We found no easy workaround to this so update
                # this code to use the colorama package version 0.3.2+ as soon
                # as it gets released. When this is done, also remove a related
                # setup.py comment.
                v_bad_low = lowest_version_string_with_prefix("0.1.11")
                v_bad_high = "0.3.2"
                version_spec = ("<", v_bad_low), (">=", v_bad_high)
            else:
                # colorama 0.3.1 release accidentally uses the 'with' keyword
                # without a corresponding __future__ import in its setup.py
                # script.
                version_spec = ("!=", "0.3.1"),
            yield requirement_spec("colorama", *version_spec)

        yield requirement_spec(
            "py", ("<", _first_unsupported_py_version_on_Python_25))

        pytest_version = ((">=", _first_supported_pytest_version),
                          ("<",
                           _first_unsupported_pytest_version_on_Python_25))

    # Python 3.0 & 3.1 stdlib does not include the argparse module which pytest
    # requires, even though it does not list it explicitly among its
    # requirements. Python 3.x series introduced the argparse module in its 3.2
    # release so it needs to be installed manually in 3.0.x & 3.1.x releases.
    # Tested that pytest 2.5.2+ requires py 1.4.20+ which in turn requires the
    # argparse module but does not specify this dependency explicitly.
    elif (3, ) <= version_info < (3, 2):
        # pytest versions prior to 2.6.0 are not compatible with Python 3.1,
        # mostly due to accidental incompatibilities introduced because that is
        # not one of the officially supported platforms for pytest and so does
        # not get regular testing. Development version 2.6.0 has been tested
        # with this project and found to work correctly.
        #TODO: Once pytest 2.6.0 has been officially released change the pytest
        # requirement to ("==", "2.6.0").
        pytest_version = (">=", lowest_version_string_with_prefix("2.6.0")),
        missing_argparse = True
        if current_environment:
            try:
                import argparse
                missing_argparse = False
            except ImportError:
                pass
        if missing_argparse:
            yield requirement_spec("argparse")

    if not pytest_version:
        pytest_version = (">=", _first_supported_pytest_version),
    yield requirement_spec("pytest", *pytest_version)
Exemple #10
0
"""

import sys

from suds_devel.parse_version import parse_version
from suds_devel.utility import (lowest_version_string_with_prefix,
                                requirement_spec)


class _Unspecified:
    pass


_first_unsupported_py_version_on_Python_24 = (
    lowest_version_string_with_prefix("1.4.16"))
_first_unsupported_py_version_on_Python_25 = (
    lowest_version_string_with_prefix("1.4.24"))

# pytest versions prior to 2.4.0 do not support non-string 'skipif'
# expressions.
_first_supported_pytest_version = "2.4.0"
_first_unsupported_pytest_version_on_Python_24 = (
    lowest_version_string_with_prefix("2.4.2"))
# pytest version 2.6.0 actually supports Python 2.5 but has some internal
# issues causing it to break our our tests, while version 2.6.1 fails to
# install on Python 2.5 all together.
_first_unsupported_pytest_version_on_Python_25 = (
    lowest_version_string_with_prefix("2.6.0"))