You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ariatosca.apache.org by mx...@apache.org on 2017/11/08 20:51:58 UTC
incubator-ariatosca git commit: review 2 fixups
Repository: incubator-ariatosca
Updated Branches:
refs/heads/ARIA-392-Failing-to-load-ruamel.yaml f32c752f1 -> a0e8738d2
review 2 fixups
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/a0e8738d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/a0e8738d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/a0e8738d
Branch: refs/heads/ARIA-392-Failing-to-load-ruamel.yaml
Commit: a0e8738d290d94b609af7c137f508f59fcf5c9e5
Parents: f32c752
Author: max-orlov <ma...@gigaspaces.com>
Authored: Wed Nov 8 22:51:50 2017 +0200
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Wed Nov 8 22:51:50 2017 +0200
----------------------------------------------------------------------
aria/__init__.py | 32 -------------
aria/cli/config/config.py | 3 +-
aria/cli/csar.py | 2 +-
aria/cli/inputs.py | 2 +-
aria/modeling/types.py | 2 +-
aria/parser/reading/yaml.py | 2 +-
aria/utils/formatting.py | 3 +-
aria/utils/yaml.py | 47 ++++++++++++++++++++
.../simple_v1_0/modeling/__init__.py | 3 +-
9 files changed, 55 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a0e8738d/aria/__init__.py
----------------------------------------------------------------------
diff --git a/aria/__init__.py b/aria/__init__.py
index 5c102de..9bd6f8f 100644
--- a/aria/__init__.py
+++ b/aria/__init__.py
@@ -17,9 +17,6 @@
The ARIA root package provides entry points for extension and storage initialization.
"""
-import os
-import sys
-import types
from pkgutil import iter_modules
import pkg_resources
@@ -27,35 +24,6 @@ aria_package_name = 'apache-ariatosca'
__version__ = pkg_resources.get_distribution(aria_package_name).version
-
-
-try:
- import ruamel
-except ImportError:
- if sys.version_info[0] > 2:
- raise
-
- # Traverse all of the site-packages and try to load ruamel.
- for packages_dir in sys.path:
- ruamel_path = os.path.join(packages_dir, 'ruamel')
- if not os.path.exists(ruamel_path):
- continue
-
- # If the top dir has an __init__.py file, the loading should have
- # succeeded automatically
- if os.path.exists(os.path.join(ruamel_path, '__init__.py')):
- raise
-
- # Dynamically create mapping to the ruamel package
- ruamel_module = sys.modules.setdefault(
- 'ruamel',
- types.ModuleType('ruamel')
- )
- # add path to the mapped package
- ruamel_module.__dict__.setdefault('__path__', []).append(ruamel_path)
-
-
-
from .orchestrator.decorators import workflow, operation # pylint: disable=wrong-import-position
from . import ( # pylint: disable=wrong-import-position
extension,
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a0e8738d/aria/cli/config/config.py
----------------------------------------------------------------------
diff --git a/aria/cli/config/config.py b/aria/cli/config/config.py
index bbece80..cba76cd 100644
--- a/aria/cli/config/config.py
+++ b/aria/cli/config/config.py
@@ -19,10 +19,11 @@ CLI configuration mechanism.
import os
import pkg_resources
-from ruamel import yaml
from jinja2.environment import Template
+from ...utils.yaml.ruamel import yaml
+
CONFIG_FILE_NAME = 'config.yaml'
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a0e8738d/aria/cli/csar.py
----------------------------------------------------------------------
diff --git a/aria/cli/csar.py b/aria/cli/csar.py
index 32a8eb1..1ef96c1 100644
--- a/aria/cli/csar.py
+++ b/aria/cli/csar.py
@@ -27,7 +27,7 @@ import tempfile
import zipfile
import requests
-from ruamel import yaml
+from ..utils.yaml.ruamel import yaml
CSAR_FILE_EXTENSION = '.csar'
META_FILE = 'TOSCA-Metadata/TOSCA.meta'
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a0e8738d/aria/cli/inputs.py
----------------------------------------------------------------------
diff --git a/aria/cli/inputs.py b/aria/cli/inputs.py
index 495dd5f..43744b0 100644
--- a/aria/cli/inputs.py
+++ b/aria/cli/inputs.py
@@ -19,7 +19,7 @@ Helpers for validating and coercing service template inputs.
import os
import glob
-from ruamel import yaml
+from ..utils.yaml.ruamel import yaml
from .env import logger
from .exceptions import AriaCliError
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a0e8738d/aria/modeling/types.py
----------------------------------------------------------------------
diff --git a/aria/modeling/types.py b/aria/modeling/types.py
index 38240fa..47752a4 100644
--- a/aria/modeling/types.py
+++ b/aria/modeling/types.py
@@ -26,7 +26,7 @@ from sqlalchemy import (
event
)
from sqlalchemy.ext import mutable
-from ruamel import yaml
+from ..utils.yaml.ruamel import yaml
from . import exceptions
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a0e8738d/aria/parser/reading/yaml.py
----------------------------------------------------------------------
diff --git a/aria/parser/reading/yaml.py b/aria/parser/reading/yaml.py
index f5eac43..4dab808 100644
--- a/aria/parser/reading/yaml.py
+++ b/aria/parser/reading/yaml.py
@@ -10,7 +10,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from ruamel import yaml # @UnresolvedImport
+from ...utils.yaml.ruamel import yaml # @UnresolvedImport
from ...utils.collections import OrderedDict
from .reader import Reader
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a0e8738d/aria/utils/formatting.py
----------------------------------------------------------------------
diff --git a/aria/utils/formatting.py b/aria/utils/formatting.py
index fa34b7d..af13667 100644
--- a/aria/utils/formatting.py
+++ b/aria/utils/formatting.py
@@ -20,8 +20,7 @@ String formatting and string-based format utilities.
import json
from types import MethodType
-from ruamel import yaml # @UnresolvedImport
-
+from .yaml.ruamel import yaml # @UnresolvedImport
from .collections import FrozenList, FrozenDict, StrictList, StrictDict, OrderedDict
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a0e8738d/aria/utils/yaml.py
----------------------------------------------------------------------
diff --git a/aria/utils/yaml.py b/aria/utils/yaml.py
new file mode 100644
index 0000000..445ae82
--- /dev/null
+++ b/aria/utils/yaml.py
@@ -0,0 +1,47 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+The ARIA root package provides entry points for extension and storage initialization.
+"""
+
+import os
+import sys
+import types
+
+try:
+ import ruamel
+except ImportError:
+ if sys.version_info[0] > 2:
+ raise
+
+ # Traverse all of the site-packages and try to load ruamel.
+ for packages_dir in sys.path:
+ ruamel_path = os.path.join(packages_dir, 'ruamel')
+ if not os.path.exists(ruamel_path):
+ continue
+
+ # If the top dir has an __init__.py file, the loading should have
+ # succeeded automatically
+ if os.path.exists(os.path.join(ruamel_path, '__init__.py')):
+ raise
+
+ # Dynamically create mapping to the ruamel package
+ ruamel_module = sys.modules.setdefault(
+ 'ruamel',
+ types.ModuleType('ruamel')
+ )
+ # add path to the mapped package
+ ruamel_module.__dict__.setdefault('__path__', []).append(ruamel_path)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a0e8738d/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py
index 0588a8f..3d77b6d 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py
@@ -23,14 +23,13 @@ Relies on many helper methods in the presentation classes.
import os
import re
-from types import FunctionType
from datetime import datetime
-from ruamel import yaml
from aria.parser.validation import Issue
from aria.utils.formatting import string_list_as_string
from aria.utils.collections import (StrictDict, OrderedDict)
+from aria.utils.yaml.ruamel import yaml
from aria.orchestrator import WORKFLOW_DECORATOR_RESERVED_ARGUMENTS
from aria.modeling.models import (Type, ServiceTemplate, NodeTemplate,
RequirementTemplate, RelationshipTemplate, CapabilityTemplate,