Repository: aws-cloudformation/cfn-lint

Issue:
Pip install fails for 0.10.0
*cfn-lint version: (`cfn-lint --version`)*

0.10.0

*Description of issue.*

My pipeline started failing when installing the latest version via pip.

example:

`pip install cfn-lint==0.10.0`

```
[...]
.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    copying regex_3/regex.py -> build/lib.linux-x86_64-3.7
    copying regex_3/_regex_core.py -> build/lib.linux-x86_64-3.7
    copying regex_3/test_regex.py -> build/lib.linux-x86_64-3.7
    running build_ext
    building '_regex' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/regex_3
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.7m -c regex_3/_regex.c -o build/temp.linux-x86_64-3.7/regex_3/_regex.o
    unable to execute 'gcc': No such file or directory
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-r143_0dz/regex/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-467tj48_/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-r143_0dz/regex/
```

Version 0.9.2 works well.

Replicate with:

`docker run --rm -it python:3.7.1-alpine3.8 /bin/sh -c 'pip install cfn-lint==0.10.0'`


Discussion:
Looking into it.  Thanks for reporting this. 
Same here. Found its defo caused by the introduction of the regex dependency with Pull Request #484.

Basically you need gcc available on the PATH now. Your call if thats fine, but I would have enjoyed a mention of this in the release notes :-)

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -59,8 +59,7 @@ def get_version(filename):
         'aws-sam-translator>=1.8.0',
         'jsonpatch',
         'jsonschema~=2.6',
-        'pathlib2>=2.3.0;python_version<"3.4"',
-        'regex>=2018.11.07'
+        'pathlib2>=2.3.0;python_version<"3.4"'
     ],
     python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
     entry_points={
diff --git a/src/cfnlint/rules/resources/iam/ManagedPolicyDescription.py b/src/cfnlint/rules/resources/iam/ManagedPolicyDescription.py
deleted file mode 100644
--- a/src/cfnlint/rules/resources/iam/ManagedPolicyDescription.py
+++ /dev/null
@@ -1,58 +0,0 @@
-"""
-  Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify,
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
-  permit persons to whom the Software is furnished to do so.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-"""
-import regex
-from cfnlint import CloudFormationLintRule
-from cfnlint import RuleMatch
-
-
-class ManagedPolicyDescription(CloudFormationLintRule):
-    """Check if IAM Policy Description is syntax correct"""
-    id = 'E3507'
-    shortdesc = 'Check if IAM Managed Policy description follows supported regex'
-    description = 'IAM Managed Policy description much comply with the regex [\\p{L}\\p{M}\\p{Z}\\p{S}\\p{N}\\p{P}]*'
-    source_url = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-managedpolicy.html'
-    tags = ['properties', 'iam']
-
-    def __init__(self):
-        """Init"""
-        super(ManagedPolicyDescription, self).__init__()
-        self.resource_property_types.append('AWS::IAM::ManagedPolicy')
-
-    def check_value(self, value, path):
-        """Check the value"""
-        regex_string = r'^[\p{L}\p{M}\p{Z}\p{S}\p{N}\p{P}]+$'
-        r = regex.compile(regex_string)
-        if not r.match(value):
-            message = 'ManagedPolicy Description needs to follow regex pattern "{0}"'
-            return [
-                RuleMatch(path[:], message.format(regex_string))
-            ]
-
-        return []
-
-    def match_resource_properties(self, properties, _, path, cfn):
-        """Check CloudFormation Properties"""
-        matches = []
-
-        matches.extend(
-            cfn.check_value(
-                obj=properties, key='Description',
-                path=path[:],
-                check_value=self.check_value
-            ))
-
-        return matches


Test patch:
diff --git a/test/rules/resources/iam/test_iam_managed_policy_description.py b/test/rules/resources/iam/test_iam_managed_policy_description.py
deleted file mode 100644
--- a/test/rules/resources/iam/test_iam_managed_policy_description.py
+++ /dev/null
@@ -1,37 +0,0 @@
-"""
-  Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this
-  software and associated documentation files (the "Software"), to deal in the Software
-  without restriction, including without limitation the rights to use, copy, modify,
-  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
-  permit persons to whom the Software is furnished to do so.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-"""
-from cfnlint.rules.resources.iam.ManagedPolicyDescription import ManagedPolicyDescription  # pylint: disable=E0401
-from ... import BaseRuleTestCase
-
-
-class TestManagedPolicyDescription(BaseRuleTestCase):
-    """Test Managed Policy Description"""
-    def setUp(self):
-        """Setup"""
-        super(TestManagedPolicyDescription, self).setUp()
-        self.collection.register(ManagedPolicyDescription())
-        self.success_templates = [
-            'fixtures/templates/good/resources/iam/managed_policy_description.yaml'
-        ]
-
-    def test_file_positive(self):
-        """Test Positive"""
-        self.helper_file_positive()
-
-    def test_file_negative(self):
-        """Test failure"""
-        self.helper_file_negative('fixtures/templates/bad/resources/iam/managed_policy_description.yaml', 1)