summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2018-07-02 15:48:25 +0300
committerIvan Kanakarakis <ivan.kanak@gmail.com>2018-07-03 04:23:38 +0300
commit0f262931f2817f6c147d896a61e63af8825f1a51 (patch)
tree032175a752a1b5ee3e8fd448af9d8d9729958b99 /src
parent9c7b0014ccc4229031813ddcc5f6790b59540df5 (diff)
downloadpysaml2-0f262931f2817f6c147d896a61e63af8825f1a51.tar.gz
Retrieve pacakge version from pkg_resources
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/saml2/__init__.py15
-rw-r--r--src/saml2/version.py10
2 files changed, 20 insertions, 5 deletions
diff --git a/src/saml2/__init__.py b/src/saml2/__init__.py
index 3eb959fa..e8ae901f 100644
--- a/src/saml2/__init__.py
+++ b/src/saml2/__init__.py
@@ -17,10 +17,11 @@
provides methods and functions to convert SAML classes to and from strings.
"""
-__version__ = "4.5.0"
-
import logging
+
import six
+
+import saml2.version
from saml2.validate import valid_instance
try:
@@ -38,6 +39,10 @@ except ImportError:
from elementtree import ElementTree
import defusedxml.ElementTree
+
+__version__ = str(saml2.version.version)
+
+
root_logger = logging.getLogger(__name__)
root_logger.level = logging.NOTSET
@@ -1027,9 +1032,9 @@ def is_required_attribute(cls, attr):
"""
Check if the attribute is a required attribute for a specific SamlBase
class.
-
- :param cls: The class
- :param attr: An attribute, note it must be the name of the attribute
+
+ :param cls: The class
+ :param attr: An attribute, note it must be the name of the attribute
that appears in the XSD in which the class is defined.
:return: True if required
"""
diff --git a/src/saml2/version.py b/src/saml2/version.py
new file mode 100644
index 00000000..a3e43085
--- /dev/null
+++ b/src/saml2/version.py
@@ -0,0 +1,10 @@
+import pkg_resources as _pkg_resources
+
+
+def _parse_version():
+ data = _pkg_resources.get_distribution('pysaml2')
+ value = _pkg_resources.parse_version(data.version)
+ return value
+
+
+version = _parse_version()