Repository: cloud-custodian/cloud-custodian

Issue:
Azure - Dependency Mangager Issues
### Issue:
 Dependency manager appears to fail out on all custodian runs.

### What's happening:
` 2019-03-13 16:21:49,638: c7n_azure.dependency_manager:ERROR Failed to download wheels! `

It appears in dependency_manager.py that when the pip installation goes to download the corresponding packages, the `>=` when checking package version breaks the pip download. After encapsulating all packages in "", running pip installations from terminal outside of custodian appear to be successful, except for `pyrsistent` and `jsonschema`. While both are installed in the current virtual environment (with right version) the output message still persists:
```
 Could not find a version that satisfies the requirement pyrsistent>=0.14.0 (from jsonschema) (from versions: )
No matching distribution found for pyrsistent>=0.14.0 (from jsonschema)
```
### What does my environment look like?
- fresh pull of custodian project
- new python3 virtual env
- pip install ./cloud-custodian
- pip install ./cloud-custodian/tools/c7n_azure

#### Output of pip downloads:
```
 c7n_azure.dependency_manager:DEBUG pip download --dest /c7n_azure/cache/wheels --find-links /c7n_azure/cache/wheels PyJWT PyYAML>=4.2b4 adal argcomplete azure-common~=1.1 azure-graphrbac azure-mgmt-authorization azure-mgmt-batch azure-mgmt-cdn azure-mgmt-cognitiveservices azure-mgmt-compute azure-mgmt-containerregistry azure-mgmt-containerservice azure-mgmt-cosmosdb azure-mgmt-datafactory azure-mgmt-datalake-store azure-mgmt-eventgrid==2.0.0rc2 azure-mgmt-iothub azure-mgmt-keyvault azure-mgmt-monitor azure-mgmt-network azure-mgmt-nspkg>=2.0.0 azure-mgmt-policyinsights azure-mgmt-redis azure-mgmt-resource azure-mgmt-sql azure-mgmt-storage azure-mgmt-subscription azure-mgmt-web azure-storage-blob azure-storage-queue backports.functools-lru-cache boto3>=1.9.94 botocore>=1.12.94 jsonpatch>=1.21 jsonschema msrestazure<2.0.0,>=0.4.20 python-dateutil<3.0.0,>=2.6 requests tabulate==0.8.2 --platform=manylinux1_x86_64 --python-version=36 --implementation=cp --abi=cp36m --only-binary=:all:
2019-03-13 12:14:03,396: c7n_azure.dependency_manager:ERROR Failed to download wheels!
```


Discussion:

Resolving patch:
diff --git a/tools/c7n_azure/c7n_azure/policy.py b/tools/c7n_azure/c7n_azure/policy.py
--- a/tools/c7n_azure/c7n_azure/policy.py
+++ b/tools/c7n_azure/c7n_azure/policy.py
@@ -194,8 +194,8 @@ def build_functions_package(self, queue_name=None):
         package = FunctionPackage(self.policy_name)
         package.build(self.policy.data,
                       modules=['c7n', 'c7n-azure', 'applicationinsights'],
-                      non_binary_packages=['pyyaml', 'pycparser', 'tabulate'],
-                      excluded_packages=['azure-cli-core', 'distlib', 'futures'],
+                      non_binary_packages=['pyyaml', 'pycparser', 'tabulate', 'pyrsistent'],
+                      excluded_packages=['azure-cli-core', 'distlib', 'future', 'futures'],
                       queue_name=queue_name)
         package.close()
 
diff --git a/tools/c7n_mailer/c7n_mailer/azure/deploy.py b/tools/c7n_mailer/c7n_mailer/azure/deploy.py
--- a/tools/c7n_mailer/c7n_mailer/azure/deploy.py
+++ b/tools/c7n_mailer/c7n_mailer/azure/deploy.py
@@ -42,8 +42,8 @@ def build_function_package(config, function_name):
     package.build(None,
                   modules=['c7n', 'c7n-azure', 'c7n-mailer', 'applicationinsights'],
                   non_binary_packages=['pyyaml', 'pycparser', 'tabulate',
-                                       'datadog', 'MarkupSafe', 'simplejson'],
-                  excluded_packages=['azure-cli-core', 'distlib', 'futures'])
+                                       'datadog', 'MarkupSafe', 'simplejson', 'pyrsistent'],
+                  excluded_packages=['azure-cli-core', 'distlib', 'future', 'futures'])
 
     package.pkg.add_contents(
         function_name + '/function.json',


Test patch: