awslimitchecker.versioncheck module

class awslimitchecker.versioncheck.AGPLVersionChecker[source]

Bases: object

__dict__ = dict_proxy({'__module__': 'awslimitchecker.versioncheck', '__doc__': None, '_find_git_info': <function _find_git_info at 0x7ff847e957d0>, '_dist_version_url': <function _dist_version_url at 0x7ff847e95758>, '_find_pkg_info': <function _find_pkg_info at 0x7ff847e95668>, '_find_pip_info': <function _find_pip_info at 0x7ff847e956e0>, '_is_git_dirty': <function _is_git_dirty at 0x7ff847e95848>, '__dict__': <attribute '__dict__' of 'AGPLVersionChecker' objects>, '__weakref__': <attribute '__weakref__' of 'AGPLVersionChecker' objects>, 'find_package_version': <function find_package_version at 0x7ff847e95578>, '_is_git_clone': <property object at 0x7ff847eff2b8>})
__module__ = 'awslimitchecker.versioncheck'

list of weak references to the object (if defined)


Get version and homepage for a pkg_resources.Distribution

Parameters:dist – the pkg_resources.Distribution to get information for
Returns:2-tuple of (version, homepage URL)
Return type:tuple

Find information about the git repository, if this file is in a clone.

Returns:information about the git clone
Return type:dict

Try to find information about the installed awslimitchecker from pip. This should be wrapped in a try/except.

Returns:information from pip about ‘awslimitchecker’
Return type:dict

Find information about the installed awslimitchecker from pkg_resources.

Returns:information from pkg_resources about ‘awslimitchecker’
Return type:dict

Attempt to determine whether this package is installed via git or not.

Return type:bool
Returns:True if installed via git, False otherwise

Determine if the git clone has uncommitted changes or is behind origin

Returns:True if clone is dirty, False otherwise
Return type:bool

Find the installed version of the specified package, and as much information about it as possible (source URL, git ref or tag, etc.)

This attempts, to the best of our ability, to find out if the package was installed from git, and if so, provide information on the origin of that git repository and status of the clone. Otherwise, it uses pip and pkg_resources to find the version and homepage of the installed distribution.

This class is not a sure-fire method of identifying the source of the distribution or ensuring AGPL compliance; it simply helps with this process _iff_ a modified version is installed from an editable git URL _and_ all changes are pushed up to the publicly-visible origin.

Returns a dict with keys ‘version’, ‘tag’, ‘commit’, and ‘url’. Values are strings or None.

Parameters:package_name (str) – name of the package to find information for
Returns:information about the installed version of the package
Return type:dict
awslimitchecker.versioncheck._check_output(args, stderr=None)[source]

Python version compatibility wrapper for subprocess.check_output

Parameters:stderr – what to do with STDERR - None or an appropriate argument to subprocess.check_output / subprocess.Popen
Returns:command output
Return type:string

Get the current (short) git commit hash of the current directory.

Returns:short git hash
Return type:string

Get the git tag for the specified commit, or None

Parameters:commit (string) – git commit hash to get the tag for
Returns:tag name pointing to commit
Return type:string

Get the origin URL for the git repository.

Returns:repository origin URL
Return type:string