diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..6d3b4185 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,7 @@ +[run] +branch = True +source = heat-translator +omit = heat-translator/tests/*,heat-translator/openstack/* + +[report] +ignore-errors = True \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..1399c981 --- /dev/null +++ b/.gitignore @@ -0,0 +1,51 @@ +*.py[cod] + +# C extensions +*.so + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg +lib +lib64 + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox +nosetests.xml +.testrepository + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Complexity +output/*.html +output/*/index.html + +# Sphinx +doc/build + +# pbr generates these +AUTHORS +ChangeLog + +# Editors +*~ +.*.swp \ No newline at end of file diff --git a/.gitreview b/.gitreview new file mode 100644 index 00000000..b27b144a --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=stackforge/heat-translator.git diff --git a/.mailmap b/.mailmap new file mode 100644 index 00000000..cc92f17b --- /dev/null +++ b/.mailmap @@ -0,0 +1,3 @@ +# Format is: +# +# \ No newline at end of file diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 00000000..fb622677 --- /dev/null +++ b/.testr.conf @@ -0,0 +1,7 @@ +[DEFAULT] +test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ + OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ + OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ + ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION +test_id_option=--load-list $IDFILE +test_list_option=--list \ No newline at end of file diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 00000000..d8a86f37 --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,17 @@ +If you would like to contribute to the development of OpenStack, +you must follow the steps in the "If you're a developer, start here" +section of this page: + + http://wiki.openstack.org/HowToContribute + +Once those steps have been completed, changes to OpenStack +should be submitted for review via the Gerrit tool, following +the workflow documented at: + + http://wiki.openstack.org/GerritWorkflow + +Pull requests submitted through GitHub will be ignored. + +Bugs should be filed on Launchpad, not GitHub: + + https://bugs.launchpad.net/heat-translator \ No newline at end of file diff --git a/HACKING.rst b/HACKING.rst new file mode 100644 index 00000000..9c60464f --- /dev/null +++ b/HACKING.rst @@ -0,0 +1,4 @@ +heat-translator Style Commandments +=============================================== + +Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..67db8588 --- /dev/null +++ b/LICENSE @@ -0,0 +1,175 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..90f8a7ae --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include AUTHORS +include ChangeLog +exclude .gitignore +exclude .gitreview + +global-exclude *.pyc \ No newline at end of file diff --git a/README.rst b/README.rst new file mode 100644 index 00000000..6856fe97 --- /dev/null +++ b/README.rst @@ -0,0 +1,13 @@ +=============================== +heat-translator +=============================== + +Tool to translate non-heat templates to Heat Orchestration Template. + +* Free software: Apache license +* Documentation: http://docs.openstack.org/developer/heat-translator + +Features +-------- + +* TODO \ No newline at end of file diff --git a/babel.cfg b/babel.cfg new file mode 100644 index 00000000..efceab81 --- /dev/null +++ b/babel.cfg @@ -0,0 +1 @@ +[python: **.py] diff --git a/doc/source/conf.py b/doc/source/conf.py new file mode 100755 index 00000000..c926f2aa --- /dev/null +++ b/doc/source/conf.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +# Licensed 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. + +import os +import sys + +sys.path.insert(0, os.path.abspath('../..')) +# -- General configuration ---------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = [ + 'sphinx.ext.autodoc', + #'sphinx.ext.intersphinx', + 'oslo.sphinx' +] + +# autodoc generation is a bit aggressive and a nuisance when doing heavy +# text edit cycles. +# execute "export SPHINX_DEBUG=1" in your terminal to disable + +# The suffix of source filenames. +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'heat-translator' +copyright = u'2013, OpenStack Foundation' + +# If true, '()' will be appended to :func: etc. cross-reference text. +add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +add_module_names = True + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# -- Options for HTML output -------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. Major themes that come with +# Sphinx are currently 'default' and 'sphinxdoc'. +# html_theme_path = ["."] +# html_theme = '_theme' +# html_static_path = ['static'] + +# Output file base name for HTML help builder. +htmlhelp_basename = '%sdoc' % project + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass +# [howto/manual]). +latex_documents = [ + ('index', + '%s.tex' % project, + u'%s Documentation' % project, + u'OpenStack Foundation', 'manual'), +] + +# Example configuration for intersphinx: refer to the Python standard library. +#intersphinx_mapping = {'http://docs.python.org/': None} \ No newline at end of file diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst new file mode 100644 index 00000000..8cb3146f --- /dev/null +++ b/doc/source/contributing.rst @@ -0,0 +1 @@ +.. include:: ../../CONTRIBUTING.rst \ No newline at end of file diff --git a/doc/source/index.rst b/doc/source/index.rst new file mode 100644 index 00000000..70135124 --- /dev/null +++ b/doc/source/index.rst @@ -0,0 +1,24 @@ +.. heat-translator documentation master file, created by + sphinx-quickstart on Tue Jul 9 22:26:36 2013. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to heat-translator's documentation! +======================================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + readme + installation + usage + contributing + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/doc/source/installation.rst b/doc/source/installation.rst new file mode 100644 index 00000000..5427983c --- /dev/null +++ b/doc/source/installation.rst @@ -0,0 +1,12 @@ +============ +Installation +============ + +At the command line:: + + $ pip install heat-translator + +Or, if you have virtualenvwrapper installed:: + + $ mkvirtualenv heat-translator + $ pip install heat-translator \ No newline at end of file diff --git a/doc/source/readme.rst b/doc/source/readme.rst new file mode 100644 index 00000000..6b2b3ec6 --- /dev/null +++ b/doc/source/readme.rst @@ -0,0 +1 @@ +.. include:: ../README.rst \ No newline at end of file diff --git a/doc/source/usage.rst b/doc/source/usage.rst new file mode 100644 index 00000000..68dd42c7 --- /dev/null +++ b/doc/source/usage.rst @@ -0,0 +1,7 @@ +======== +Usage +======== + +To use heat-translator in a project:: + + import heat-translator \ No newline at end of file diff --git a/heat-translator/exit.py b/heat-translator/exit.py deleted file mode 100644 index acc3fb20..00000000 --- a/heat-translator/exit.py +++ /dev/null @@ -1,2 +0,0 @@ -def write_output(output): - pass \ No newline at end of file diff --git a/heat-translator/exit.pyc b/heat-translator/exit.pyc deleted file mode 100644 index b9e0d337..00000000 Binary files a/heat-translator/exit.pyc and /dev/null differ diff --git a/heat-translator/heat/__init__.py b/heat-translator/heat/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/heat-translator/heat/__init__.pyc b/heat-translator/heat/__init__.pyc deleted file mode 100644 index 011e763e..00000000 Binary files a/heat-translator/heat/__init__.pyc and /dev/null differ diff --git a/heat-translator/main.py b/heat-translator/main.py deleted file mode 100644 index e06beec1..00000000 --- a/heat-translator/main.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python - -import exit -import os -import sys -from source import Source -from tosca.translate import TOSCATranslator -from tosca.tosca_profile import Tosca -from tosca.validate import ToscaValidator - - -def main(): - sourcetype = sys.argv[1] - path = sys.argv[2] - #sourcetype = "tosca" - #path = "/heat-translator/tosca/tests/tosca.yaml" - if not sourcetype: - print("Translation type is needed. For example, 'tosca'") - if not path.endswith(".yaml"): - print "Only YAML file is supported at this time." - - if os.path.isdir(path): - print('Translation of directory is not supported at this time : %s' % path) - elif os.path.isfile(path): - heat_tpl = translate(sourcetype, path) - exit.write_output(heat_tpl) - else: - print('%s is not a valid file.' % path) - -def translate(sourcetype, path): - tpl = Source(path) - if sourcetype == "tosca": - tosca = Tosca(tpl) - ToscaValidator(tosca).validate() - return TOSCATranslator(tosca).translate() - -if __name__ == '__main__': - main() diff --git a/heat-translator/source.py b/heat-translator/source.py deleted file mode 100644 index 5a55aeab..00000000 --- a/heat-translator/source.py +++ /dev/null @@ -1,18 +0,0 @@ -from yaml_loader import Loader - -class Source(object): - def __init__(self, path): - self.profile = Loader(path).load() - - def __contains__(self, key): - return key in self.profile - - def __iter__(self): - return iter(self.profile) - - def __len__(self): - return len(self.profile) - - def __getitem__(self, key): - '''Get a section.''' - return self.profile[key] diff --git a/heat-translator/source.pyc b/heat-translator/source.pyc deleted file mode 100644 index d2f832fe..00000000 Binary files a/heat-translator/source.pyc and /dev/null differ diff --git a/heat-translator/tosca/__init__.py b/heat-translator/tosca/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/heat-translator/tosca/__init__.pyc b/heat-translator/tosca/__init__.pyc deleted file mode 100644 index 78c4f95e..00000000 Binary files a/heat-translator/tosca/__init__.pyc and /dev/null differ diff --git a/heat-translator/tosca/inputs.py b/heat-translator/tosca/inputs.py deleted file mode 100644 index d5322907..00000000 --- a/heat-translator/tosca/inputs.py +++ /dev/null @@ -1,66 +0,0 @@ -from tosca.nodetemplates.schema import Schema -from tosca.nodetemplates.constraints import Constraint - -class InputParameters(object): - def __init__(self, inputs): - self.inputs = inputs - - def __contains__(self, key): - return key in self.inputs - - def __iter__(self): - return iter(self.inputs) - - def __len__(self): - return len(self.inputs) - - def __getitem__(self, key): - '''Get a input value.''' - return self.inputs[key] - -class Input(object): - - def __init__(self, name, schema): - self.name = name - self.schema = schema - - def get_type(self): - return self.schema['type'] - - def get_description(self): - if self.has_default(): - return self.schema['description'] - return '' - - def get_default(self): - if self.has_default(): - return self.schema['default'] - return '' - - def get_constraints(self): - return self.schema['constraints'] - - def has_default(self): - '''Return whether the parameter has a default value.''' - return Schema.DEFAULT in self.schema - - def has_description(self): - '''Return whether the parameter has a default value.''' - return Schema.DESCRIPTION in self.schema - - def validate(self): - self.validate_type(self.get_type()) - self.validate_constraints(self.get_constraints()) - - def validate_type(self, input_type): - if input_type not in Schema.TYPES: - raise ValueError('Invalid type %s' % type) - - def validate_constraints(self, constraints): - for constraint in constraints: - for key in constraint.keys(): - if key not in Constraint.CONSTRAINTS: - raise ValueError('Invalid constraint %s' % constraint) - if isinstance(key, dict): #and is_required to have a min or max or in certain range or equal to something etc. - pass - \ No newline at end of file diff --git a/heat-translator/tosca/inputs.pyc b/heat-translator/tosca/inputs.pyc deleted file mode 100644 index 5697c2f5..00000000 Binary files a/heat-translator/tosca/inputs.pyc and /dev/null differ diff --git a/heat-translator/tosca/nodetemplates/__init__.py b/heat-translator/tosca/nodetemplates/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/heat-translator/tosca/nodetemplates/__init__.pyc b/heat-translator/tosca/nodetemplates/__init__.pyc deleted file mode 100644 index 88244828..00000000 Binary files a/heat-translator/tosca/nodetemplates/__init__.pyc and /dev/null differ diff --git a/heat-translator/tosca/nodetemplates/capabilitytype.py b/heat-translator/tosca/nodetemplates/capabilitytype.py deleted file mode 100644 index e69de29b..00000000 diff --git a/heat-translator/tosca/nodetemplates/capabilitytype.pyc b/heat-translator/tosca/nodetemplates/capabilitytype.pyc deleted file mode 100644 index 49e414ea..00000000 Binary files a/heat-translator/tosca/nodetemplates/capabilitytype.pyc and /dev/null differ diff --git a/heat-translator/tosca/nodetemplates/constraints.py b/heat-translator/tosca/nodetemplates/constraints.py deleted file mode 100644 index 3eba92d2..00000000 --- a/heat-translator/tosca/nodetemplates/constraints.py +++ /dev/null @@ -1,87 +0,0 @@ -import numbers - -class Constraint(object): - - CONSTRAINTS = (EQUAL, GREATER_THAN, - GREATER_OR_EQUAL, LESS_THAN, LESS_OR_EQUAL, IN_RANGE, VALID_VALUES, - LENGTH, MIN_LENGHT, MAX_LENGTH, PATTERN) = \ - ('equal', 'greater_than', 'greater_or_equal', - 'less_than', 'less_or_equal', 'in_range', 'valid_values', 'length', 'min_length', - 'max_length', 'pattern') - - def __init__(self, propertyname, value, constraint): - self.propertyname = propertyname - self.value = value - self.constraint = constraint #dictionary e.g. valid_values: [ 1, 2, 4, 8 ] or greater_or_equal: 1 - - def validate(self): - # for key in self.constraint.iterkeys(): - for key, value in self.constraint.iteritems(): - if key == "greater_or_equal": - self.validate_greater_than(value) - - def validate_equal(self): - pass - - def validate_greater_than(self, value): - if self.value < value: - print("%s value requires to be greater than %s" % (self.propertyname, value)) - - def validate_greater_or_equal(self): - pass - - def validate_less_than(self): - pass - - def validate_less_or_equal(self): - pass - - def validate_in_range(self): - pass - - def validate_valid_values(self): - pass - - def validate_length(self): - pass - - def validate_min_length(self): - pass - - def validate_max_length(self): - pass - - def validate_pattern(self): - pass - - @staticmethod - def validate_integer(value): - if not isinstance(value, (int, long)): - import pdb - pdb.set_trace() - raise TypeError('value is not an integer for %s' %value) - return Constraint.validate_number(value) - - @staticmethod - def validate_number(value): - return Constraint.str_to_num(value) - - @staticmethod - def validate_string(value): - if not isinstance(value, basestring): - raise ValueError('Value must be a string %s' %value) - return value - - @staticmethod - def validate_list(self, value): - pass - - @staticmethod - def str_to_num(value): - """Convert a string representation of a number into a numeric type.""" - if isinstance(value, numbers.Number): - return value - try: - return int(value) - except ValueError: - return float(value) \ No newline at end of file diff --git a/heat-translator/tosca/nodetemplates/constraints.pyc b/heat-translator/tosca/nodetemplates/constraints.pyc deleted file mode 100644 index 17308ddb..00000000 Binary files a/heat-translator/tosca/nodetemplates/constraints.pyc and /dev/null differ diff --git a/heat-translator/tosca/nodetemplates/node_template.py b/heat-translator/tosca/nodetemplates/node_template.py deleted file mode 100644 index 33f9deac..00000000 --- a/heat-translator/tosca/nodetemplates/node_template.py +++ /dev/null @@ -1,117 +0,0 @@ -from properties import Property -from tosca.nodetemplates.schema import Schema -from tosca.inputs import InputParameters -from tosca.inputs import Input -from tosca.nodetemplates.node_templates import NodeTemplates - -class NodeTemplate(object): - def __init__(self, name, nodetemplate, tosca): - self.name = name - self.nodetemplate = nodetemplate - self.tosca = tosca - - def get_node(self): - return self.nodetemplate - - def get_name(self): - return self.name - - def get_type(self): - return self.nodetemplate['type'] - - def get_properties(self): - return self.nodetemplate['properties'] - - def validate(self): - self.validate_prpoerties() - self.validate_type() - - #TODO - def validate_type(self): - pass - - #TODO - def validate_relationship(self): - pass - - def validate_prpoerties(self): - '''validate that required properties for a particular nodetype is provided and matches constraints''' - nodetype = self.get_type() - required_props = Schema(nodetype).required() - for req in required_props: - if req not in self.get_properties(): - raise ValueError('Missing required property %s' %req) - for prop, val in self.get_properties().iteritems(): - if isinstance(val, dict): - for key, value in val.iteritems(): - if key == "get_input": - val = self.get_input_ref(value) - break - if key == "get_property": - val = self.get_property_ref(value, self.tosca) - if val is not None: - Property(prop, self.get_type(), val).validate() - - def get_input_ref(self, ref): - ''' get input reference, for example, get_input: db_user ''' - input_val = self.tosca.get_inputs()[ref] - if Input(ref, input_val).has_default(): - return Input(ref, input_val).get_default() - - @classmethod - def get_property_ref(cls, ref, t): - ''' get property reference, for example, get_property: [ mysql, db_user ] ''' - item = ref[0] - n = t.get_nodetemplates()[item] - c = cls(item, n, t) - for val in c.get_properties().itervalues(): - if isinstance(val, dict): - for key, value in val.iteritems(): - if key == "get_input": - return c.get_input_ref(value) - - def get_relationship(self): - return self.nodetemplate['requirements'] - - def get_hostedOn_relationship(self): - hosted = [] - r = self.get_relationship() - for key, value in r.iteritems(): - if key == "host": - hosted.append(value) - return hosted - - def get_dependsOn_relationship(self): - depends = [] - r = self.get_relationship() - for key, value in r.iteritems(): - if key == "dependency": - depends.append(value) - return depends - - def get_connectedTo_relationship(self): - connected = [] - r = self.get_relationship() - for key, value in r.iteritems(): - if key == "database": - connected.append(value) - return connected - - def is_hostedOn(self): - pass - - def is_dependsOn(self): - pass - - def is_connectedTo(self): - pass - - def get_interfaces(self): - return self.nodetemplate['interfaces'] - - def get_interface_inputs(self, interface): - i = self.get_interfaces() - for key, value in i.iteritems(): - if key == interface: - return value - \ No newline at end of file diff --git a/heat-translator/tosca/nodetemplates/node_template.pyc b/heat-translator/tosca/nodetemplates/node_template.pyc deleted file mode 100644 index bae420a6..00000000 Binary files a/heat-translator/tosca/nodetemplates/node_template.pyc and /dev/null differ diff --git a/heat-translator/tosca/nodetemplates/node_templates.py b/heat-translator/tosca/nodetemplates/node_templates.py deleted file mode 100644 index e05b8ebc..00000000 --- a/heat-translator/tosca/nodetemplates/node_templates.py +++ /dev/null @@ -1,19 +0,0 @@ -from tosca.tosca_profile import Tosca - -class NodeTemplates(object): - - def __init__(self, nodetemplates): - self.nodetemplates = nodetemplates - - def __contains__(self, key): - return key in self.nodetemplates - - def __iter__(self): - return iter(self.nodetemplates) - - def __len__(self): - return len(self.nodetemplates) - - def __getitem__(self, key): - '''Get a node template value.''' - return self.nodetemplates[key] \ No newline at end of file diff --git a/heat-translator/tosca/nodetemplates/node_templates.pyc b/heat-translator/tosca/nodetemplates/node_templates.pyc deleted file mode 100644 index c8732915..00000000 Binary files a/heat-translator/tosca/nodetemplates/node_templates.pyc and /dev/null differ diff --git a/heat-translator/tosca/nodetemplates/nodetype.py b/heat-translator/tosca/nodetemplates/nodetype.py deleted file mode 100644 index 93a02aa3..00000000 --- a/heat-translator/tosca/nodetemplates/nodetype.py +++ /dev/null @@ -1,29 +0,0 @@ -from rootnodetype import RootNodeType - -class NodeType(RootNodeType): - def __init__(self, nodetype): - super(NodeType, self).__init__() - self.nodetype = nodetype - - ''' get properties for a given node type''' - def get_properties(self): - properties = [] - nodetype = self.get_nodetype() - for prop_key, prop_vale in nodetype.iteritems(): - if prop_key == 'properties': - properties = prop_vale - return properties - - ''' get capabilities for a given node type''' - def get_capabilities(self): - pass - - def derived_from(self): - pass - - def set_requirements(self): - pass - - def get_requirements(self): - return self.requirements() - \ No newline at end of file diff --git a/heat-translator/tosca/nodetemplates/nodetype.pyc b/heat-translator/tosca/nodetemplates/nodetype.pyc deleted file mode 100644 index 387641a2..00000000 Binary files a/heat-translator/tosca/nodetemplates/nodetype.pyc and /dev/null differ diff --git a/heat-translator/tosca/nodetemplates/nodetypeschema.yaml b/heat-translator/tosca/nodetemplates/nodetypeschema.yaml deleted file mode 100644 index ebbc7b16..00000000 --- a/heat-translator/tosca/nodetemplates/nodetypeschema.yaml +++ /dev/null @@ -1,49 +0,0 @@ -tosca_nodes_Compute: - num_cpus: - required: no - type: integer - constraints: - - greater_or_equal: 1 - description: > - Number of (actual or virtual) CPUs associated with the Compute node. - disk_size: - required: no - type: integer - constraints: - - greater_or_equal: 0 - description: > - Size of the local disk, in Gigabytes (GB), available to applications running on the Compute node. - mem_size: - required: no - type: integer - constraints: - - greater_or_equal: 0 - description: > - Size of memory, in Megabytes (MB), available to applications running on the Compute node. - os_arch: - required: no - default: x86_64 - type: string - description: > - The host Operating System (OS) architecture. - os_type: - required: yes - type: string - description: > - The host Operating System (OS) type. - os_distribution: - required: no - type: string - description: > - The host Operating System (OS) distribution. Examples of valid values for an “os_type” of “Linux” would include: - debian, fedora, rhel and ubuntu. - os_version: - required: no - type: integer - description: > - The host Operating System version. - ip_address: - required: no - type: string - description: > - The primary IP address assigned by the cloud provider that applications may use to access the Compute node. diff --git a/heat-translator/tosca/nodetemplates/nodetypesdef.yaml b/heat-translator/tosca/nodetemplates/nodetypesdef.yaml deleted file mode 100644 index 003349c1..00000000 --- a/heat-translator/tosca/nodetemplates/nodetypesdef.yaml +++ /dev/null @@ -1,46 +0,0 @@ -tosca_nodes_Root: - properties: - - property - capabilities: - - capability1: somecapbility - interfaces: - - create - - start - - stop - - install - - delete - -tosca_nodes_Compute: - derived_from: tosca_nodes_Root - properties: - - num_cpus - - disk_size - - mem_size - - os_arch - - os_type - - os_version - - ip_address - requirements: - - host: none - - database: none - capabilities: - container: - type: Container - containee_types: [tosca_nodes_SoftwareComponent] - -tosca_nodes_SoftwareComponent: - derived_from: tosca_nodes_Root - requirements: - - host: tosca.nodes.Compute - capabilities: - containee: - type: Containee - container_types: [tosca.nodes.Compute] - -tosca.nodes.MySQL: - derived_from: tosca_nodes_SoftwareComponent - properties: - - db_user - - db_pwd - - db_root_pwd - \ No newline at end of file diff --git a/heat-translator/tosca/nodetemplates/properties.py b/heat-translator/tosca/nodetemplates/properties.py deleted file mode 100644 index 190e1854..00000000 --- a/heat-translator/tosca/nodetemplates/properties.py +++ /dev/null @@ -1,35 +0,0 @@ -from tosca.nodetemplates.schema import Schema -from tosca.nodetemplates.constraints import Constraint - -class Property(object): - def __init__(self, name, nodetype, value): - self.name = name - self.nodetype = nodetype - self.value = value - - def is_required(self): - return Schema(self.nodetype).is_required(self.name) - - def get_name(self): - return self.name - - def validate(self): - self.validate_data_type() - self.validate_constraints() - - def validate_data_type(self): - data_type = Schema(self.nodetype).get_type(self.name) - if data_type == Schema.STRING: - return Constraint.validate_string(self.value) - elif data_type == Schema.INTEGER: - return Constraint.validate_integer(self.value) - elif data_type == Schema.NUMBER: - return Constraint.validate_number(self.value) - - def validate_constraints(self): - constraints = Schema(self.nodetype).get_constraints(self.name) - if constraints: - for constraint in constraints: - Constraint(self.name, self.value, constraint).validate() - pass - diff --git a/heat-translator/tosca/nodetemplates/properties.pyc b/heat-translator/tosca/nodetemplates/properties.pyc deleted file mode 100644 index 1b446c01..00000000 Binary files a/heat-translator/tosca/nodetemplates/properties.pyc and /dev/null differ diff --git a/heat-translator/tosca/nodetemplates/relationshiptype.py b/heat-translator/tosca/nodetemplates/relationshiptype.py deleted file mode 100644 index 11a96348..00000000 --- a/heat-translator/tosca/nodetemplates/relationshiptype.py +++ /dev/null @@ -1,6 +0,0 @@ -from rootnodetype import RootRelationshipType - -class RelatonshipType(RootRelationshipType): - def __init__(self, relatointype): - super(RelatonshipType, self).__init__() - self.nodetype = relatointype \ No newline at end of file diff --git a/heat-translator/tosca/nodetemplates/relationshiptype.pyc b/heat-translator/tosca/nodetemplates/relationshiptype.pyc deleted file mode 100644 index 08a031dc..00000000 Binary files a/heat-translator/tosca/nodetemplates/relationshiptype.pyc and /dev/null differ diff --git a/heat-translator/tosca/nodetemplates/requirementtype.py b/heat-translator/tosca/nodetemplates/requirementtype.py deleted file mode 100644 index e69de29b..00000000 diff --git a/heat-translator/tosca/nodetemplates/requirementtype.pyc b/heat-translator/tosca/nodetemplates/requirementtype.pyc deleted file mode 100644 index 92d223e0..00000000 Binary files a/heat-translator/tosca/nodetemplates/requirementtype.pyc and /dev/null differ diff --git a/heat-translator/tosca/nodetemplates/rootnodetype.py b/heat-translator/tosca/nodetemplates/rootnodetype.py deleted file mode 100644 index 7fae83b9..00000000 --- a/heat-translator/tosca/nodetemplates/rootnodetype.py +++ /dev/null @@ -1,31 +0,0 @@ -from yaml_loader import Loader -import os - -nodetype_def_file = os.path.dirname(os.path.abspath(__file__)) + os.sep + "nodetypesdef.yaml" -nodetype_def = Loader(nodetype_def_file).load() - -class RootNodeType(object): - def __init__(self): - self.nodetypes = self._set_nodetypes() - - '''set a list of node names from the nodetype definition''' - def _set_nodetypes(self): - nodetypes = [] - if isinstance(nodetype_def, dict): - for key in nodetype_def.iterkeys(): - nodetypes.append(key) - return nodetypes - - def get_nodetype(self, nodetype=None): - rtype = {} - if nodetype == None: - nodetype = self.nodetype - ntype = nodetype - ntype = ntype.replace(".", "_") - if ntype in self.nodetypes: - rtype = nodetype_def[ntype] - return rtype - -class RootRelationshipType(object): - def __init__(self): - pass \ No newline at end of file diff --git a/heat-translator/tosca/nodetemplates/rootnodetype.pyc b/heat-translator/tosca/nodetemplates/rootnodetype.pyc deleted file mode 100644 index cffa4086..00000000 Binary files a/heat-translator/tosca/nodetemplates/rootnodetype.pyc and /dev/null differ diff --git a/heat-translator/tosca/nodetemplates/schema.py b/heat-translator/tosca/nodetemplates/schema.py deleted file mode 100644 index 4e0c2d8a..00000000 --- a/heat-translator/tosca/nodetemplates/schema.py +++ /dev/null @@ -1,88 +0,0 @@ -from yaml_loader import Loader -import os - -schema_file = os.path.dirname(os.path.abspath(__file__)) + os.sep + "nodetypeschema.yaml" -schema = Loader(schema_file).load() - -class Schema(object): - - TYPES = ( - INTEGER, - STRING, NUMBER, BOOLEAN, - LIST - ) = ( - 'integer', - 'string', 'number', 'boolean', - 'list' - ) - - KEYS = ( - TYPE, DESCRIPTION, DEFAULT, CONSTRAINTS, - ) = ( - 'type', 'description', 'default', 'constraints' - ) - - def __init__(self, nodetype): - self.nodetype = nodetype - self.nodes = self._set_nodes() - - '''set a list of node names from the schema''' - def _set_nodes(self): - sections = [] - if isinstance(schema, dict): - for key in schema.iterkeys(): - sections.append(key) - return sections - - def _get_section(self, section_name): - section = {} - if section_name in self.nodes: - return schema[section_name] - return section - - ''' return true if property is a required for a given node ''' - def is_required(self, property_name): - return property_name in self.required() - - ''' get schemata for a given node type''' - def get_schemata(self): - ntype = self.nodetype - ntype = ntype.replace(".", "_") - return self._get_section(ntype) - - ''' get schema for a given property''' - def get_schema(self, property_name): - schema = {} - schemata = self.get_schemata() - for prop_key, prop_vale in schemata.iteritems(): - if prop_key == property_name: - for attr, value in prop_vale.iteritems(): - schema[attr] = value - return schema - - def get_type(self, property_name): - return self.get_schema(property_name)['type'] - - def get_constraints(self, property_name): - s = self.get_schema(property_name) - if 'constraints' in s: - s['constraints'] - - def get_description(self, property_name): - return self.get_schema(property_name)['description'] - - def get_greater_or_equal(self, property_name): - pass - - def get_equal(self, property_name): - pass - - ''' list all the required properties for a given nodetype ''' - def required(self): - required = [] - schemata = self.get_schemata() - for prop_key, prop_vale in schemata.iteritems(): - for attr, value in prop_vale.iteritems(): - if attr == 'required' and value: - required.append(prop_key) - return required \ No newline at end of file diff --git a/heat-translator/tosca/nodetemplates/schema.pyc b/heat-translator/tosca/nodetemplates/schema.pyc deleted file mode 100644 index 5c558477..00000000 Binary files a/heat-translator/tosca/nodetemplates/schema.pyc and /dev/null differ diff --git a/heat-translator/tosca/outputs.py b/heat-translator/tosca/outputs.py deleted file mode 100644 index 94a6a04e..00000000 --- a/heat-translator/tosca/outputs.py +++ /dev/null @@ -1,4 +0,0 @@ - -class Outputs(object): - def __init__(self): - pass diff --git a/heat-translator/tosca/outputs.pyc b/heat-translator/tosca/outputs.pyc deleted file mode 100644 index c702c9b7..00000000 Binary files a/heat-translator/tosca/outputs.pyc and /dev/null differ diff --git a/heat-translator/tosca/tests/__init__.py b/heat-translator/tosca/tests/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/heat-translator/tosca/tests/__init__.pyc b/heat-translator/tosca/tests/__init__.pyc deleted file mode 100644 index 2b03e287..00000000 Binary files a/heat-translator/tosca/tests/__init__.pyc and /dev/null differ diff --git a/heat-translator/tosca/tests/tosca.yaml b/heat-translator/tosca/tests/tosca.yaml deleted file mode 100644 index c342aed8..00000000 --- a/heat-translator/tosca/tests/tosca.yaml +++ /dev/null @@ -1,30 +0,0 @@ -tosca_definitions_version: tosca_simple_1_0 - -description: > - TOSCA simple profile that just defines a single compute instance. Note, this example does not include inputs values. - -inputs: - cpus: - type: integer - description: cpu - constraints: - - valid_values: [ 1, 2, 4, 8 ] - -node_templates: - my_server: - type: tosca.nodes.Compute - properties: - # compute properties (flavor) - disk_size: 10 - num_cpus: { get_input: cpus } - mem_size: 4096 - # host image properties - os_arch: x86_64 - os_type: Linux - os_distribution: Ubuntu - os_version: 12 - -outputs: - instance_ip: - description: The IP address of the deployed instance. - value: { get_property: [my_server, ip_address ] } \ No newline at end of file diff --git a/heat-translator/tosca/tosca_profile.py b/heat-translator/tosca/tosca_profile.py deleted file mode 100644 index d702ccc9..00000000 --- a/heat-translator/tosca/tosca_profile.py +++ /dev/null @@ -1,24 +0,0 @@ -SECTIONS = (VERSION, DESCRIPTION, INPUTS, - NODE_TEMPLATES, OUTPUTS) = \ - ('tosca_definitions_version', 'description', 'inputs', - 'node_templates', 'outputs') - -class Tosca(object): - - def __init__(self, sourcedata): - self.sourcedata = sourcedata - - def get_version(self): - return self.sourcedata[VERSION] - - def get_description(self): - return self.sourcedata[DESCRIPTION] - - def get_inputs(self): - return self.sourcedata[INPUTS] - - def get_nodetemplates(self): - return self.sourcedata[NODE_TEMPLATES] - - def get_outputs(self): - return self.sourcedata[OUTPUTS] \ No newline at end of file diff --git a/heat-translator/tosca/tosca_profile.pyc b/heat-translator/tosca/tosca_profile.pyc deleted file mode 100644 index 03b1d4b3..00000000 Binary files a/heat-translator/tosca/tosca_profile.pyc and /dev/null differ diff --git a/heat-translator/tosca/translate.py b/heat-translator/tosca/translate.py deleted file mode 100644 index dc70a5fb..00000000 --- a/heat-translator/tosca/translate.py +++ /dev/null @@ -1,34 +0,0 @@ -import yaml - -HEAT_VERSIONS = '2013-05-23' - -if hasattr(yaml, 'CSafeDumper'): - yaml_dumper = yaml.CSafeDumper -else: - yaml_dumper = yaml.SafeDumper - -yaml_tpl = {} - -class TOSCATranslator(object): - def __init__(self, tosca): - super(TOSCATranslator, self).__init__() - self.tosca = tosca - - def translate(self): - self._translate_version() - self._translate_inputs() - self._translate_node_templates() - self._translate_outputs() - - def _translate_version(self): - pass - - def _translate_inputs(self): - pass - - def _translate_node_templates(self): - pass - - def _translate_outputs(self): - pass - \ No newline at end of file diff --git a/heat-translator/tosca/translate.pyc b/heat-translator/tosca/translate.pyc deleted file mode 100644 index 7d8e86f0..00000000 Binary files a/heat-translator/tosca/translate.pyc and /dev/null differ diff --git a/heat-translator/tosca/validate.py b/heat-translator/tosca/validate.py deleted file mode 100644 index fdcfeee3..00000000 --- a/heat-translator/tosca/validate.py +++ /dev/null @@ -1,20 +0,0 @@ -from tosca.inputs import Input -from tosca.nodetemplates.node_template import NodeTemplate - -class ToscaValidator(): - def __init__(self, Tosca): - self.inputs = Tosca.get_inputs() - self.nodetemplates = Tosca.get_nodetemplates() - self.tosca = Tosca - - def validate(self): - #validate inputs - for name, attrs in self.inputs.iteritems(): - if not isinstance(attrs, dict): - print ("The input %s has no attributes", name) - Input(name, attrs).validate() - - #validate node templates - for nodetemplate, value in self.nodetemplates.iteritems(): - NodeTemplate(nodetemplate, value, self.tosca).validate() - \ No newline at end of file diff --git a/heat-translator/tosca/validate.pyc b/heat-translator/tosca/validate.pyc deleted file mode 100644 index 155f723a..00000000 Binary files a/heat-translator/tosca/validate.pyc and /dev/null differ diff --git a/heat-translator/utils.py b/heat-translator/utils.py deleted file mode 100644 index edce3fc3..00000000 --- a/heat-translator/utils.py +++ /dev/null @@ -1,26 +0,0 @@ -import numbers - -def validate_integer(value): - if not isinstance(value, (int, long)): - raise TypeError('value is not an integer for %s' %value) - return validate_number(value) - -def validate_number(value): - return str_to_num(value) - -def validate_string(value): - if not isinstance(value, basestring): - raise ValueError(_('Value must be a string')) - return value - -def validate_list(self, value): - pass - -def str_to_num(value): - '''Convert a string representation of a number into a numeric type.''' - if isinstance(value, numbers.Number): - return value - try: - return int(value) - except ValueError: - return float(value) \ No newline at end of file diff --git a/heat-translator/yaml_loader.py b/heat-translator/yaml_loader.py index 4f06886f..9642895f 100644 --- a/heat-translator/yaml_loader.py +++ b/heat-translator/yaml_loader.py @@ -1,10 +1,25 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# +# Licensed 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. + import yaml if hasattr(yaml, 'CSafeLoader'): yaml_loader = yaml.CSafeLoader else: yaml_loader = yaml.SafeLoader - + class Loader(object): def __init__(self, file_name): @@ -12,9 +27,9 @@ class Loader(object): def load(self): f = open(self.file_name, 'r') - profile = f.read() # string + profile = f.read() try: doc = yaml.load(profile, Loader=yaml_loader) except yaml.YAMLError as error: raise ValueError(error) - return doc \ No newline at end of file + return doc diff --git a/heat-translator/yaml_loader.pyc b/heat-translator/yaml_loader.pyc deleted file mode 100644 index 6f023fae..00000000 Binary files a/heat-translator/yaml_loader.pyc and /dev/null differ diff --git a/openstack-common.conf b/openstack-common.conf new file mode 100644 index 00000000..93a04589 --- /dev/null +++ b/openstack-common.conf @@ -0,0 +1,6 @@ +[DEFAULT] + +# The list of modules to copy from oslo-incubator.git + +# The base module to hold the copy of openstack.common +base=heat-translator \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..86463419 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +pbr>=0.5.21,<1.0 +Babel>=0.9.6 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..b09e3f33 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,46 @@ +[metadata] +name = heat-translator +summary = Tool to translate non-heat templates to Heat Orchestration Template. +description-file = + README.rst +author = OpenStack +author-email = openstack-dev@lists.openstack.org +home-page = http://www.openstack.org/ +classifier = + Environment :: OpenStack + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 2.6 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.3 + +[files] +packages = + heat-translator + +[build_sphinx] +source-dir = doc/source +build-dir = doc/build +all_files = 1 + +[upload_sphinx] +upload-dir = doc/build/html + +[compile_catalog] +directory = heat-translator/locale +domain = heat-translator + +[update_catalog] +domain = heat-translator +output_dir = heat-translator/locale +input_file = heat-translator/locale/heat-translator.pot + +[extract_messages] +keywords = _ gettext ngettext l_ lazy_gettext +mapping_file = babel.cfg +output_file = heat-translator/locale/heat-translator.pot \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100755 index 00000000..2a0786a8 --- /dev/null +++ b/setup.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# Licensed 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. + +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +setuptools.setup( + setup_requires=['pbr>=0.5.21,<1.0'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..3434db12 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,11 @@ +hacking>=0.5.6,<0.8 + +coverage>=3.6 +discover +fixtures>=0.3.14 +python-subunit +sphinx>=1.1.2 +oslo.sphinx +testrepository>=0.0.17 +testscenarios>=0.4,<0.5 +testtools>=0.9.32 \ No newline at end of file diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..167b0130 --- /dev/null +++ b/tox.ini @@ -0,0 +1,31 @@ +[tox] +minversion = 1.6 +envlist = py26,py27,py33,pypy,pep8 +skipsdist = True + +[testenv] +usedevelop = True +install_command = pip install -U {opts} {packages} +setenv = + VIRTUAL_ENV={envdir} +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = python setup.py testr --slowest --testr-args='{posargs}' + +[testenv:pep8] +commands = flake8 + +[testenv:venv] +commands = {posargs} + +[testenv:cover] +commands = python setup.py testr --coverage --testr-args='{posargs}' + +[flake8] +# H803 skipped on purpose per list discussion. +# E123, E125 skipped as they are invalid PEP-8. + +show-source = True +ignore = E123,E125,H803 +builtins = _ +exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build \ No newline at end of file