diff --git a/aws-federated-auth.spec b/aws-federated-auth.spec index 29d35a4..a33b112 100644 --- a/aws-federated-auth.spec +++ b/aws-federated-auth.spec @@ -7,7 +7,7 @@ a = Analysis( binaries=[], datas=[('shib', 'shib')], hiddenimports=[], - hookspath=[], + hookspath=['hooks'], hooksconfig={}, runtime_hooks=[], excludes=[], diff --git a/hooks/hook-keyrings.cryptfile.py b/hooks/hook-keyrings.cryptfile.py new file mode 100644 index 0000000..ad34d12 --- /dev/null +++ b/hooks/hook-keyrings.cryptfile.py @@ -0,0 +1,8 @@ +from PyInstaller.utils.hooks import collect_submodules, copy_metadata + +# Collect backends +hiddenimports = collect_submodules('keyrings.cryptfile') + +# Keyring performs backend plugin discovery using setuptools entry points, which are listed in the metadata. Therefore, +# we need to copy the metadata, otherwise no backends will be found at run-time. +datas = copy_metadata('keyrings.cryptfile') diff --git a/pyproject.toml b/pyproject.toml index 9298e4d..e72fbea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,7 @@ dependencies = [ "requests", "boto3", "keyring", + "keyrings.cryptfile; sys_platform == 'linux'", ] [tool.setuptools.packages] diff --git a/shib/cli.py b/shib/cli.py index c2b8135..5763f76 100644 --- a/shib/cli.py +++ b/shib/cli.py @@ -61,7 +61,6 @@ import getpass import logging import requests -import distutils import sys import argparse @@ -77,11 +76,6 @@ log_channel.setFormatter(formatter) logger.addHandler(log_channel) -def str2bool(string): - try: - return bool(distutils.util.strtobool(string)) - except: - raise ValueError def main(): """Main: Set up variables argparse, failing back to environment variables. @@ -103,10 +97,7 @@ def main(): parser.add_argument('--list', help= 'Don\'t generate profiles, just list' ' available options passing filters.', - type=str2bool, - nargs='?', - const=True, - default=False) + action='store_true') parser.add_argument('--assertionconsumer', help='The shibboleth protected site you want to log into.' ' Defaults to https://signin.aws.amazon.com/saml' @@ -260,6 +251,8 @@ def main(): try: import keyring + if sys.platform == 'linux': + from keyrings import cryptfile except ImportError: keyring = None