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 0x7f3a539257d0>, '_dist_version_url': <function _dist_version_url at 0x7f3a53925758>, '_find_pkg_info': <function _find_pkg_info at 0x7f3a53925668>, '_find_pip_info': <function _find_pip_info at 0x7f3a539256e0>, '_is_git_dirty': <function _is_git_dirty at 0x7f3a53925848>, '__dict__': <attribute '__dict__' of 'AGPLVersionChecker' objects>, '__weakref__': <attribute '__weakref__' of 'AGPLVersionChecker' objects>, 'find_package_version': <function find_package_version at 0x7f3a53925578>, '_is_git_clone': <property object at 0x7f3a5398f2b8>})¶
-
__module__
= 'awslimitchecker.versioncheck'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
_dist_version_url
(dist)[source]¶ 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_git_info
()[source]¶ Find information about the git repository, if this file is in a clone.
Returns: information about the git clone Return type: dict
-
_find_pip_info
()[source]¶ 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_pkg_info
()[source]¶ Find information about the installed awslimitchecker from pkg_resources.
Returns: information from pkg_resources about ‘awslimitchecker’ Return type: dict
-
_is_git_clone
¶ Attempt to determine whether this package is installed via git or not.
Return type: bool Returns: True if installed via git, False otherwise
-
_is_git_dirty
()[source]¶ Determine if the git clone has uncommitted changes or is behind origin
Returns: True if clone is dirty, False otherwise Return type: bool
-
find_package_version
()[source]¶ 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 Raises: subprocess.CalledProcessError Returns: command output Return type: string
-
awslimitchecker.versioncheck.
_get_git_commit
()[source]¶ Get the current (short) git commit hash of the current directory.
Returns: short git hash Return type: string