view tests/hghaveaddon.py @ 6861:a868f00e8915 stable

tests: account for "egg-info" files in test-check-sdist.t These changes are related to the "egg-info" directory inside the tarball. Apparently the newer versions of whatever `setup.py sdist` is using now adds this directory with various meta information about the package, so now we have 5 more files in the tarball. The exact files are: hg_evolve.egg-info/ hg_evolve.egg-info/PKG-INFO hg_evolve.egg-info/SOURCES.txt hg_evolve.egg-info/dependency_links.txt hg_evolve.egg-info/top_level.txt
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 09 Sep 2024 17:28:07 +0400
parents e41b99cec0c2
children 9638dd0fb4ea
line wrap: on
line source

import hghave

@hghave.check("docgraph-ext", "Extension to generate graph from repository")
def docgraph():
    try:
        import hgext.docgraph
        hgext.docgraph.cmdtable # trigger import
    except ImportError:
        try:
            import hgext3rd.docgraph
            hgext3rd.docgraph.cmdtable # trigger import
        except ImportError:
            return False
    return True

@hghave.check("flake8", "Flake8 python linter")
def has_flake8():
    try:
        import flake8

        flake8.__version__
    except ImportError:
        return False
    else:
        return True

@hghave.check("check-manifest", "check-manifest MANIFEST.in checking tool")
def has_check_manifest():
    return hghave.matchoutput('check-manifest --version 2>&1',
                              br'check-manifest version')

@hghave.check("default-cg3", "changegroup3 by default")
def has_default_changegroup3():
    from mercurial import configitems

    try:
        return configitems.coreitems[b'experimental'][b'changegroup3'].default
    except (AttributeError, KeyError):
        return False