diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 547a33a..0000000 --- a/.coveragerc +++ /dev/null @@ -1,6 +0,0 @@ -[run] -branch = True -source = rst2bash - -[report] -ignore_errors = True diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 963e589..0000000 --- a/.gitignore +++ /dev/null @@ -1,58 +0,0 @@ -*.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 -cover/ -.coverage* -!.coveragerc -.tox -nosetests.xml -.testrepository -.venv - -# 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 -.*sw? - -# Files created by releasenotes build -releasenotes/build \ No newline at end of file diff --git a/.mailmap b/.mailmap deleted file mode 100644 index 516ae6f..0000000 --- a/.mailmap +++ /dev/null @@ -1,3 +0,0 @@ -# Format is: -# -# diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 6d83b3c..0000000 --- a/.testr.conf +++ /dev/null @@ -1,7 +0,0 @@ -[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 diff --git a/.zuul.yaml b/.zuul.yaml deleted file mode 100644 index 6bd6a09..0000000 --- a/.zuul.yaml +++ /dev/null @@ -1,12 +0,0 @@ -- project: - templates: - - openstack-python-jobs - - openstack-python35-jobs - - openstack-python36-jobs - check: - jobs: - - legacy-labs-ig-cluster-kvm-ubuntu: - voting: false - - legacy-labs-ig-cluster-vbox-ubuntu: - voting: false - diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst deleted file mode 100644 index e679af0..0000000 --- a/CONTRIBUTING.rst +++ /dev/null @@ -1,17 +0,0 @@ -If you would like to contribute to the development of OpenStack, you must -follow the steps in this page: - - http://docs.openstack.org/infra/manual/developers.html - -If you already have a good understanding of how the system works and your -OpenStack accounts are set up, you can skip to the development workflow -section of this documentation to learn how changes to OpenStack should be -submitted for review via the Gerrit tool: - - http://docs.openstack.org/infra/manual/developers.html#development-workflow - -Pull requests submitted through GitHub will be ignored. - -Bugs should be filed on Launchpad, not GitHub: - - https://bugs.launchpad.net/rst2bash diff --git a/HACKING.rst b/HACKING.rst deleted file mode 100644 index 5b39dba..0000000 --- a/HACKING.rst +++ /dev/null @@ -1,4 +0,0 @@ -rst2bash Style Commandments -=============================================== - -Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 68c771a..0000000 --- a/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ - - 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 deleted file mode 100644 index c978a52..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,6 +0,0 @@ -include AUTHORS -include ChangeLog -exclude .gitignore -exclude .gitreview - -global-exclude *.pyc diff --git a/README.rst b/README.rst index 8145e69..d98af48 100644 --- a/README.rst +++ b/README.rst @@ -1,77 +1,10 @@ -=============================== -rst2bash -=============================== +This project is no longer maintained. -Parser to convert RST into Bash. Allows generating Bash scripts to deploy -OpenStack from install guides. +The contents of this repository are still available in the Git +source code management system. To see the contents of this +repository before it reached its end of life, please check out the +previous commit with "git checkout HEAD^1". -Generating Bash code from install guides RST code snippets allows us to -automatically test and validate the installation guides in the CI. This -cluster should make it extremely easy for contributors to test their -changes and additionally allows us to maintain higher quality installation -instructions. - -These are the major goals which are accomplished by the parser: - -- To allow automated testing of installation guides. -- To automate generation of installation scripts for training-labs from - install guides. -- To write a generic parser which should be usable for parsing code block - snippets from any sphinx documentation. -- To test and validate OpenStack in the CI using training-labs and - installation guides. -- To make OpenStack awesome. - - -Training-Labs -------------- - -`Training-labs `_ is part -of OpenStack Documentation team and provides an unique tool to deploy core -OpenStack services. Training labs closely follows installation guides for -the OpenStack deployment steps. - - -Installation Guides (OpenStack Installation Tutorial) ------------------------------------------------------ - -`Installation guides `_ provides step by step -instructions to deploy OpenStack on a multi-node cluster. - - -More Details ------------- - -- Most of the parser logic is running from parser.py. -- More scripts (glue-code) should allow setting up the openstack-manuals - and training-labs repository. -- The generated output (parsed files) should then be triggered via. - training-labs to deploy the OpenStack cluster. -- Additionally, this project should showcase and allow the work-flow in the - OpenStack CI for installation guides and cross-project installation-guides. - - -Roadmap -------- - -- Create glue-code scripts to automate setting up of various repositories - required to easily carry the work-flow. -- Setup the non-voting jobs to deploy the cluster. This cluster should be - a two node KVM/VirtualBox cluster which runs in the OpenStack CI. -- Update the Bash templates (Jinja templates) to allow nicer Bash scripts - which are following training-labs conventions and standards. -- Stabilize the CI and add the CI template in openstack-infra. -- Add this job for installation guides and other related guides for - openstack-manuals. -- Add this job for training-labs to automatically generate Bash scripts. - Figure out a mechanism which does not rewrite from scratch but rather - nicely and carefully updates existing Bash scripts from training-labs. - - -Misc ----- - -* Free software: Apache license -* Documentation: http://docs.openstack.org/developer/rst2bash -* Source: http://git.openstack.org/cgit/openstack/rst2bash -* Bugs: http://bugs.launchpad.net/rst2bash +For any further questions, please email +openstack-dev@lists.openstack.org or join #openstack-dev on +Freenode. diff --git a/babel.cfg b/babel.cfg deleted file mode 100644 index 15cd6cb..0000000 --- a/babel.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[python: **.py] - diff --git a/doc/source/conf.py b/doc/source/conf.py deleted file mode 100755 index 579c5b4..0000000 --- a/doc/source/conf.py +++ /dev/null @@ -1,75 +0,0 @@ -# -*- 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', - 'oslosphinx' -] - -# 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'rst2bash' -copyright = u'2016, 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} diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst deleted file mode 100644 index 1728a61..0000000 --- a/doc/source/contributing.rst +++ /dev/null @@ -1,4 +0,0 @@ -============ -Contributing -============ -.. include:: ../../CONTRIBUTING.rst diff --git a/doc/source/index.rst b/doc/source/index.rst deleted file mode 100644 index 3580965..0000000 --- a/doc/source/index.rst +++ /dev/null @@ -1,25 +0,0 @@ -.. rst2bash 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 rst2bash'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 deleted file mode 100644 index 178bad7..0000000 --- a/doc/source/installation.rst +++ /dev/null @@ -1,12 +0,0 @@ -============ -Installation -============ - -- Clone the rst2bash repository. - - .. code-block:: bash - - $ git clone git://git.openstack.org/openstack/rst2bash - $ cd rst2bash - -- Check the usage section for more details. diff --git a/doc/source/readme.rst b/doc/source/readme.rst deleted file mode 100644 index a6210d3..0000000 --- a/doc/source/readme.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../../README.rst diff --git a/doc/source/usage.rst b/doc/source/usage.rst deleted file mode 100644 index e99c7e6..0000000 --- a/doc/source/usage.rst +++ /dev/null @@ -1,30 +0,0 @@ -===== -Usage -===== - -- Run the parser, it will clone openstack-manuals repository, training-labs - repository and parse the files - - .. code-block:: bash - - $ ./tools/runparser.sh - - - Make sure to run it from the root of the directory. -- Check the generated scripts (location in the configuration file - `rst2bash/conf`), copy them to training-labs: - `labs/osbash/scripts/` folder. - -- Check the generated scripts (location in the configuration file), copy them - to training-labs: `labs/osbash/scripts/` folder. Default configuration - specifies the output location at `build/scripts/`. -- Run training labs: - - .. code-block:: bash - - $ PROVIDER=kvm ./build/training-labs/labs/st.py -b cluster - -- Sit back, relax and see the cluster deploy. - -**Note:** This project is in its nascent state, especially the OpenStack - cluster deployment part may break at many places. diff --git a/releasenotes/notes/.placeholder b/releasenotes/notes/.placeholder deleted file mode 100644 index e69de29..0000000 diff --git a/releasenotes/source/_static/.placeholder b/releasenotes/source/_static/.placeholder deleted file mode 100644 index e69de29..0000000 diff --git a/releasenotes/source/_templates/.placeholder b/releasenotes/source/_templates/.placeholder deleted file mode 100644 index e69de29..0000000 diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py deleted file mode 100644 index e329827..0000000 --- a/releasenotes/source/conf.py +++ /dev/null @@ -1,275 +0,0 @@ -# -*- 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. - -# Glance Release Notes documentation build configuration file, created by -# sphinx-quickstart on Tue Nov 3 17:40:50 2015. -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# sys.path.insert(0, os.path.abspath('.')) - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -# needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - 'oslosphinx', - 'reno.sphinxext', -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix of source filenames. -source_suffix = '.rst' - -# The encoding of source files. -# source_encoding = 'utf-8-sig' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'rst2bash Release Notes' -copyright = u'2016, OpenStack Foundation' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -# The full version, including alpha/beta/rc tags. -release = '' -# The short X.Y version. -version = '' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -# today = '' -# Else, today_fmt is used as the format for a strftime call. -# today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = [] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -# default_role = None - -# 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 - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -# show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# A list of ignored prefixes for module index sorting. -# modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -# keep_warnings = False - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = 'default' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -# html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -# html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -# html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -# html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -# html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -# html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -# html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -# html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -# html_additional_pages = {} - -# If false, no module index is generated. -# html_domain_indices = True - -# If false, no index is generated. -# html_use_index = True - -# If true, the index is split into individual pages for each letter. -# html_split_index = False - -# If true, links to the reST sources are added to the pages. -# html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -# html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -# html_file_suffix = None - -# Output file base name for HTML help builder. -htmlhelp_basename = 'GlanceReleaseNotesdoc' - - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # 'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - # 'pointsize': '10pt', - - # Additional stuff for the LaTeX preamble. - # 'preamble': '', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ('index', 'GlanceReleaseNotes.tex', u'Glance Release Notes Documentation', - u'Glance Developers', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -# latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# latex_use_parts = False - -# If true, show page references after internal links. -# latex_show_pagerefs = False - -# If true, show URL addresses after external links. -# latex_show_urls = False - -# Documents to append as an appendix to all manuals. -# latex_appendices = [] - -# If false, no module index is generated. -# latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'glancereleasenotes', u'Glance Release Notes Documentation', - [u'Glance Developers'], 1) -] - -# If true, show URL addresses after external links. -# man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ('index', 'GlanceReleaseNotes', u'Glance Release Notes Documentation', - u'Glance Developers', 'GlanceReleaseNotes', - 'One line description of project.', - 'Miscellaneous'), -] - -# Documents to append as an appendix to all manuals. -# texinfo_appendices = [] - -# If false, no module index is generated. -# texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -# texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -# texinfo_no_detailmenu = False - -# -- Options for Internationalization output ------------------------------ -locale_dirs = ['locale/'] diff --git a/releasenotes/source/index.rst b/releasenotes/source/index.rst deleted file mode 100644 index bfcf23f..0000000 --- a/releasenotes/source/index.rst +++ /dev/null @@ -1,8 +0,0 @@ -============================================ - rst2bash Release Notes -============================================ - -.. toctree:: - :maxdepth: 1 - - unreleased diff --git a/releasenotes/source/unreleased.rst b/releasenotes/source/unreleased.rst deleted file mode 100644 index cd22aab..0000000 --- a/releasenotes/source/unreleased.rst +++ /dev/null @@ -1,5 +0,0 @@ -============================== - Current Series Release Notes -============================== - -.. release-notes:: diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 6abfaff..0000000 --- a/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - -pbr>=1.8 # Apache-2.0 -PyYaml>=3.12 # MIT diff --git a/rst2bash/__init__.py b/rst2bash/__init__.py deleted file mode 100644 index 296ae9f..0000000 --- a/rst2bash/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- 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 pbr.version - - -__version__ = pbr.version.VersionInfo( - 'rst2bash').version_string() diff --git a/rst2bash/config/parser_config.yaml b/rst2bash/config/parser_config.yaml deleted file mode 100644 index fd69dd4..0000000 --- a/rst2bash/config/parser_config.yaml +++ /dev/null @@ -1,66 +0,0 @@ -description: Provides input (RST) and output (BASH) based on the configuration below. -rst_path: build/openstack-manuals/doc/install-guide/source -log_file: build/rst2bash.log -bash_path: - ubuntu: build/scripts/ubuntu - rdo: build/scripts/rdo - obs: build/scripts/obs - debian: build/scripts/debian -rst_files: - - keystone-install.rst - # - keystone-openrc.rst - # - keystone.rst - - keystone-users.rst - - keystone-verify.rst - - launch-instance-cinder.rst - - launch-instance-networks-provider.rst - - launch-instance-networks-selfservice.rst - - launch-instance-provider.rst - - launch-instance.rst - - launch-instance-selfservice.rst - - neutron-compute-install-option1.rst - - neutron-compute-install-option2.rst - - neutron-compute-install.rst - - neutron-concepts.rst - - neutron-controller-install-option1.rst - - neutron-controller-install-option2.rst - - neutron-controller-install.rst - - neutron-next-steps.rst - # - neutron.rst - - neutron-verify-option1.rst - - neutron-verify-option2.rst - - neutron-verify.rst - - nova-compute-install.rst - - nova-controller-install.rst - # - nova.rst - - nova-verify.rst - # - overview.rst - - horizon-verify.rst - - additional-services.rst - - cinder-backup-install.rst - - cinder-controller-install.rst - - cinder-next-steps.rst - # - cinder.rst - - cinder-storage-install.rst - - cinder-verify.rst - - environment-memcached.rst - - environment-messaging.rst - - environment-networking-compute.rst - - environment-networking-controller.rst - - environment-networking.rst - - environment-networking-storage-cinder.rst - - environment-networking-verify.rst - - environment-ntp-controller.rst - - environment-ntp-other.rst - - environment-ntp.rst - - environment-ntp-verify.rst - - environment-packages.rst - # - environment.rst - - environment-security.rst - - environment-sql-database.rst - - glance-install.rst - # - glance.rst - - glance-verify.rst - - horizon-install.rst - - horizon-next-steps.rst - # - horizon.rst diff --git a/rst2bash/parser.py b/rst2bash/parser.py deleted file mode 100755 index a9393cd..0000000 --- a/rst2bash/parser.py +++ /dev/null @@ -1,678 +0,0 @@ -# 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. - - -from collections import defaultdict -import logging -import os -import re -import yaml - - -import parsererr as ParserErr - - -def configure_logging(log_file): - """Configure root logger""" - logger = logging.getLogger() - - logger.setLevel(logging.DEBUG) - - # Level name colored differently (both console and file) - logging.addLevelName(logging.WARNING, '\x1b[0;33m%s\x1b[0m' % - logging.getLevelName(logging.WARNING)) - logging.addLevelName(logging.ERROR, '\x1b[0;31m%s\x1b[0m' % - logging.getLevelName(logging.ERROR)) - - # Configure console logging - console_log_handler = logging.StreamHandler() - console_log_handler.setLevel(logging.INFO) - # All console messages are the same color (except with colored level names) - console_formatter = logging.Formatter('\x1b[0;32m%(levelname)s' - '\t%(message)s\x1b[0m') - console_log_handler.setFormatter(console_formatter) - logger.addHandler(console_log_handler) - - # Configure log file - if os.path.isfile(log_file): - os.remove(log_file) - - file_log_handler = logging.FileHandler(log_file) - file_log_handler.setLevel(logging.DEBUG) - file_formatter = logging.Formatter('%(process)s %(asctime)s.%(msecs)03d' - ' %(name)s %(levelname)s %(message)s', - datefmt="%H:%M:%S") - file_log_handler.setFormatter(file_formatter) - logger.addHandler(file_log_handler) - - logger.debug("Root logger configured.") - - -# TODO(dbite): Remove CamelCasing. -# ----------------------------------------------------------------------------- -# Custom data-types. -# ----------------------------------------------------------------------------- -class BlockIndex(object): - """Creates indices which describes the location of blocks in rst file. - - These indices describe the start and end location of the strings in the rst - file. Different indices used to parse the file are: - - AllBlocks: Contains sequential index values for all required blocks. - CodeBlocks: Contains index values for blocks containing code. - PathBlocks: Contains index values for blocks containing path. - DistroBlocks: Contains index values for blocks containing OS. - - These indices should provide the location to extract given blocks from the - rst files. This class additionally provides various functionalities to - easily carry out different tasks like iteration and more. - """ - - def __init__(self, startIndex=tuple(), endIndex=tuple()): - - self.startIndex = tuple(startIndex) - self.endIndex = tuple(endIndex) - - def get_start_block(self, index): - '''Returns the value of the start index.''' - - return self.startIndex[index] - - def get_end_block(self, index): - '''Returns the value of the end index.''' - - return self.endIndex[index] - - def get_block(self, index): - '''Returns the value of the block from the start and the end index.''' - - return (self.get_start_index(index), self.get_end_index(index)) - - def get_start_index(self, block): - '''Returns the index of the given block from the start index.''' - - if self._block_exists(block, self.startIndex): - return self.startIndex.index(block) - - return False - - def get_end_index(self, block): - '''Returns the index of the given block from the end index.''' - - if self._block_exists(block, self.endIndex): - return self.endIndex.index(block) - - return False - - def get_index(self, block): - '''Returns the index of the given block from both the indices.''' - - return (self.get_start_block(block), self.get_end_index(block)) - - def _block_exists(self, block, index): - """Returns true or false if the block exists.""" - - return block in index - - def get_startindex_generator(self): - """Returns a generator of startIndex.""" - - return self._generator(self.startIndex) - - def get_endindex_generator(self): - """Returns a generator of endIndex.""" - - return self._generator(self.endIndex) - - def _generator(self, index): - """Create a generator of the given index.""" - for i in index: - yield i - - -class CodeBlock(object): - """CodeBlock acts as a custom data-structure. - - CodeBlock defines a rst block which contains a one or more lines of code or - configuration files. Additionally CodeBlocks also organizes metadata about - the rst block which could be as simple as the prompt/user or the path of - the configuration file. - - CodeBlock at the end of the day should contain the following keys and - values extracted and parsed from the rst files. - - commands = { - - distro: , [ubuntu|rdo|obs|debian] or [all], - This tag specifies the distro which could be a combination of - different distros or all distros. - action: , [console|config|inject], - This could either be a bash command, configuration or file - inject. - type: , [ini|conf|apache|...], - Describes the content of the command. It is fetched from the - rst .. code-block|.. distro tag. - path: |, - If it is a config or inejct, the path of the given file. For - commands, the path to run the command at. - command: , [,], - Describes the command itself. This command along with the - metadata provides easily BASHable datastructure. - output_file: , {distro: path}, - Describes the absolute path of the given bash file where the - command should be written. - } - - This class provides the datastructure along with methods to consume various - actions required to fill the datastructure and traverse through it. - """ - - def __init__(self): - - self.command = {} - - def update(self, **kwargs): - """Add or update values to the datastructure.""" - - self.command.update(kwargs) - - def __dict__(self): - - return self.command - - def generate_code(self): - """Generate BASH command with it's metadata. - - This method should sensibly traverse through the command dictonary and - generate and return the BASH code. Also return the distribution name. - """ - - command_wrapper = '' - bashcodelines = '' - bashCommands = defaultdict(list) - newline = '\n' - action = self.command['action'] - - path = self.command['path'] - if path: - bashcodelines = '{0}conf={1}{0}'.format(newline, path) - - if 'config' in action: - command_wrapper = 'iniset_sudo $conf ' - elif 'inject' in action: - command_wrapper = '{0}cat<< INJECT | sudo tee -a $conf{0}' - command_wrapper = command_wrapper.format(newline) - - for codeline in self.command['command']: - bashcodelines += command_wrapper + codeline + newline - - for distro in self.get_distro(): - bashCommands[distro].append(bashcodelines) - - return bashCommands - - def get_distro(self): - """Return the distribution.""" - - return self.command['distro'] - - -# ----------------------------------------------------------------------------- -# Parser Logic. -# ----------------------------------------------------------------------------- -class ParseBlocks(object): - """Convert RST block to BASH code. - - Logic to convert a given RST block into BASH. This class should extract - given code from the RST block and consume the CodeBlocks datastructure to - preserve the metadata along with the code. - - ParseBlocks has three logical sections: - - - Metadata extraction and code type detection. - - Parsing Bash/Config/Inject content. - - Assembling all the information in CodeBlocks format. - """ - - def extract_code(self, codeBlock, cmdType, distro, path): - """Parse the rst block into command and extract metadata info. - - This method extracts all the metadata surrounding the given line of - code and also detects the type of the code/config/inject before - invoking the respective methods. - """ - - command = CodeBlock() - - def getdistro(distro): - """Return distros named in code block title""" - distro = distro.replace('.. only::', '').split('or') - return [d.strip() for d in distro] - # Having the list of distros hardcoded here is not ideal. The list - # could be generated from openstack-manuals' tox.ini or by searching - # for all named distros in all '.. only::' titles, or it could be part - # of the configuration file. - distro = getdistro(distro) if distro else ["debian", "ubuntu", "obs", - "rdo"] - - if path: - path = path.replace('.. path', '').strip() - - command.update(distro=distro, path=path) - - if 'console' in cmdType: - action = 'console' - codeBlock = self._parse_code(codeBlock) - elif 'apache' in cmdType: - action = 'inject' - codeBlock = self._parse_inject(codeBlock) - elif 'ini' in cmdType or 'conf' in cmdType: - action = 'config' - codeBlock = self._parse_config(codeBlock) - else: - msg = "Invalid command type: %s" % cmdType - raise ParserErr.InvalidCodeBlockError(msg) - - command.update(action=action, command=codeBlock) - - return command - -# ----------------------------------------------------------------------------- - - def _parse_inject(self, rstBlock): - """Parse inject lines. - - These lines are usually configuration lines which are copy pasted or - appended at the end of a file. Appending newlines with EOL for better - visual appearance and easier BASH syntax generation. - """ - - return [rstBlock + "\nEOL\n"] - - def _parse_config(self, rstBlock): - """Parse configuration files. - - Configuration file modifications, which mostly involves setting or - resetting given variables and parameters. This method: - - - Detects the configuration sections ``[section]``. - - Parses the following lines under this section iteratively. - - Go to step one if more lines. - - Generate a list of configuration lines along with it's section - in training-labs friendly format. - - Also some syntax niceness sprinkled on top. - """ - - operator = '' - - # Only works for a specific sequence of configuration options. - parsedConfig = list() - - for line in rstBlock.split('\n'): - line = line.strip() - if re.search(r'\[[a-zA-Z0-9_]+\]', line): - operator = line[1:-1] - elif re.search('=', line) and not re.search('^#', line): - line = operator + " " + line.replace("=", " ") + "\n" - parsedConfig.append(line.strip()) - - return parsedConfig - - @staticmethod - def _get_bash_operator(operator): - """Helper function to convert the operator to its equivalent syntax. - - # --> root --> sudo ... - $ --> noroot --> ... - > --> mysql --> mysql_exec ... - """ - - if "#" in operator: - operator = "sudo " - elif "$" in operator: - operator = "" - elif ">" in operator: - operator = "mysql_exec " - else: - msg = "Invalid operator: %s" % operator - raise ParserErr.InvalidOperatorError(msg) - - return operator - - def _parse_code(self, rstBlock): - r"""Parse code lines. - - Code-blocks containing bash code (console|mysql) are sent here. These - are bash code or mysql etc. which are to be formatted into proper bash - format. - - - Detects type of code, replace `mysql>` with `>` if detected. - - Replace line continuation `asdb \` with equivalent HTML codes - for `\` and `\n` to properly parse multi-line commands. - - Iterate through all the code lines which are easily detected using - the operator syntax. - - Replace the HTML codes to it's respective ASCII/UNICODE equivalent. - """ - - parsedCmds = list() - - if "mysql>" in rstBlock: - rstBlock = rstBlock.replace("mysql>", ">") - - # Substitute HTML codes for '\' and '\n' - rstBlock = rstBlock.replace("\\\n", " ") - - for index in re.finditer(r"[#\$>].*", rstBlock): - - cmd = rstBlock[index.start():index.end()].replace(" ", - "\\\n") - operator = self._get_bash_operator(cmd[0]) - parsedCmds.append(operator + cmd[1:].strip()) - - return parsedCmds - - -# ----------------------------------------------------------------------------- - - -class ExtractBlocks(object): - """Creates required indices form the rst code.""" - - def __init__(self, rstFile, bashPath): - - logger.info("Processing %s.", os.path.basename(rstFile)) - self.rstFile = self.get_file_contents(rstFile) - self.blocks = None # Lookup table. - self.allBlocksIterator = None - self.parseblocks = ParseBlocks() - self.bashCode = list() - bashFileName = os.path.basename(rstFile).replace('.rst', '.sh') - logger.debug("bashPath %s", bashPath) - self.bashPath = {distro: os.path.join(path, bashFileName) - for distro, path in bashPath.iteritems()} - logger.debug("ExtractBlocks __init__ bashPath %s", self.bashPath) - - def __del__(self): - """Proper handling of the file pointer.""" - - self.filePointer.close() - - def index_to_line_no(self, index): - """Return line number, given index into string""" - # Count newline characters (no newline -> line number 1) - return self.rstFile.count("\n", 0, index) + 1 - - def _get_indices(self, regexStr): - """Helper function to return a tuple containing indices. - - The indices returned contains the location of the given blocks matched - by the regex string. Returns the (start, end) index for the same. - """ - - searchBlocks = re.compile(regexStr, re.VERBOSE) - indices = [index.span() - for index in searchBlocks.finditer(self.rstFile)] - - logger.debug("_get_indices %s %s", regexStr, indices) - return indices - - def get_start_end_block(self, searchStart, searchEnd): - """Search file for start and stop codes - - Search for start and stop codes (e.g., "only", "endonly") and - report an error if the numbers for both don't match. - """ - start = self._get_indices(searchStart) - end = self._get_indices(searchEnd) - - # Log information on the indices we received - msg = "get_start_end_block start/end mismatch:\n" - msg += " regex start: {}\n".format(searchStart) - msg += " regex end: {}\n".format(searchEnd) - report = {} - for ii in start: - report[self.index_to_line_no(ii[0])] = "start block" - for ii in end: - report[self.index_to_line_no(ii[0])] = "end block " - for ii in sorted(report): - msg += " {} (line {})\n".format(report[ii], ii) - if len(start) == len(end): - logger.debug(msg) - else: - logger.error(msg) - - return start, end - - def get_file_contents(self, filePath): - """Return the contents of the given file.""" - - self.filePointer = open(filePath, 'r') - - return self.filePointer.read() - -# ----------------------------------------------------------------------------- - - def get_indice_blocks(self): - """Should fetch regex strings from the right location.""" - - # TODO(dbite): Populate the regex strings from a configuration file. - # Regex string for extracting particular bits from RST file. - # For some reason I want to keep the generic RegEX strings. - # XXX(dbite): Figure out the index|indices confusing terms. - searchAllBlocks = r'''\.\.\s # Look for '.. ' - (code-block::|only::|path) # Look for required blocks - [a-z\s/].* - ''' - searchDistroBlocksStart = r'''\.\.\sonly:: - [\sa-z].* # For matching all distros. - ''' - searchDistroBlocksEnd = r'''\.\.\sendonly\n''' # Match end blocks. - - searchCodeBlocksStart = r'''\.\.\scode-block:: # Look for code block - \s # Include whitespace - (?!end) # Exclude code-block:: end - (?:[a-z])* # Include everything else. - ''' - searchCodeBlocksEnd = r'''\.\.\send\n''' # Look for .. end - searchPath = r'''\.\.\spath\s.*''' # Look for .. path - - allBlocks = BlockIndex(self._get_indices(searchAllBlocks)) - - startIndex, endIndex = self.get_start_end_block( - searchDistroBlocksStart, searchDistroBlocksEnd) - distroBlocks = BlockIndex(startIndex, endIndex) - - startIndex, endIndex = self.get_start_end_block( - searchCodeBlocksStart, searchCodeBlocksEnd) - codeBlocks = BlockIndex(startIndex, endIndex) - - pathBlocks = BlockIndex(self._get_indices(searchPath)) - - # Point to the blocks from a dictionary to create sensible index. - self.blocks = {'distroBlock': distroBlocks, - 'codeBlock': codeBlocks, - 'pathBlock': pathBlocks, - 'allBlock': allBlocks} - -# ----------------------------------------------------------------------------- -# Recursive Generator Pattern. -# ----------------------------------------------------------------------------- - - def extract_codeblocks(self): - """Initialize the generator object and start the initial parsing.""" - - # Generate all blocks iterator - self.allBlocksIterator = \ - self.blocks['allBlock'].get_startindex_generator() - - try: - self._extractblocks() - except IndexError as err: - raise ParserErr.MissingTagsError(err) - - # Helper function for quick lookup from the blocks lookup table. - def _block_lookup(self, allblock): - """Block Lookup Helper Function. - - Look for the block in blocks and return the name and index of the - location of the block. - """ - - for blockName in 'codeBlock', 'distroBlock', 'pathBlock': - blockIndex = self.blocks[blockName].get_start_index(allblock) - if blockIndex is not False: - return blockName, blockIndex - else: - msg = "Invalid block name: %s" % blockName - raise ParserErr.InvalidBlockError(msg) - - # Helper function for recursive-generator pattern. - def _extractblocks(self, distro=None, path=None, distroEnd=None): - """Recursive function to sequentially parse the RST file. - - This method deals with traversing through the given RST file by using - the indices generated using regex. These indices indicate the location - of different chunks of blocks and also the distribution for the same. - - AllBlocks provides the location of all the blocks and is used to - recurse and give the next block location. This block can either be - CodeBlock, PathBlock or DistroBlock. The lookup table provides the - information about which block a given index points to and fetches - the equivalent end index. This allows further calls to ParseBlocks - class to process the extracted chunk of code in the correct way. - - Using recursion is more efficient as compared to iteration. It - simplifies the implementation logic, performance and efficiency. This - also allows the parsing to be accomplished with minimal variables and - eliminates need for keeping track, toggle flags and complicated code - which is hard to debug and understand. - """ - - try: - blockName, blockIndex = self._block_lookup( - self.allBlocksIterator.next()) - except StopIteration: - return - - block = self.blocks[blockName] - - # TODO(dbite): Implement a mechanism for locating the exact location in - # the rst file at the current recursive depth. This - # information should then be logged and passed via. the - # exception traceback. Save required vars. in a global - # variable. - if distroEnd < block.get_start_block(blockIndex)[0]: - distro = None - - if 'codeBlock' in blockName: - # Extract Code Block - # Use path & distro variables. - indexStart = block.get_start_block(blockIndex) - indexEnd = block.get_end_block(blockIndex) - codeBlock = self.rstFile[indexStart[1]:indexEnd[0]].strip() - cmdType = self.rstFile[indexStart[0]:indexStart[1]] - self.bashCode.append( - self.parseblocks.extract_code(codeBlock, - cmdType, - distro, - path)) - self._extractblocks(distro=distro, distroEnd=distroEnd) - - elif 'pathBlock' in blockName: - # Get path & recurse, the next one should be CodeBlock. - pathIndex = block.get_start_block(blockIndex) - path = self.rstFile[pathIndex[0]:pathIndex[1]] - self._extractblocks(distro=distro, path=path, distroEnd=distroEnd) - - elif 'distroBlock' in blockName: - # Get distro & recurse - distroStart = block.get_start_block(blockIndex) - distro = self.rstFile[distroStart[0]:distroStart[1]] - distroEnd = block.get_end_block(blockIndex)[1] - self._extractblocks(distro=distro, distroEnd=distroEnd) - - -# ----------------------------------------------------------------------------- - - @staticmethod - def write_to_file(path, value): - """Static method to write given content to the file.""" - - # TODO(dbite): Implement a file handler class. - with open(path, 'w') as fp: - fp.write(value) - - def write_bash_code(self): - """Writes bash code to file.""" - - commands = defaultdict(str) - newline = "\n" - - for code in self.bashCode: - codeLines = code.generate_code() - for distro, codeLine in codeLines.iteritems(): - commands[distro] += newline.join(codeLine) - - for distro, command in commands.iteritems(): - ExtractBlocks.write_to_file(self.bashPath[distro], command) - - -# ----------------------------------------------------------------------------- - - -if __name__ == '__main__': - - # TODO(dbite): Cleanup the main function. - with open("rst2bash/config/parser_config.yaml", 'r') as ymlfile: - cfg = yaml.load(ymlfile) - - configure_logging(cfg['log_file']) - logger = logging.getLogger() - - cwd = os.getcwd() - logger.debug("cwd %s", cwd) - - rst_path = os.path.join(cwd, cfg['rst_path']) - logger.debug("rst_path %s", rst_path) - - rst_files = cfg['rst_files'] - logger.debug("rst_files %s", rst_files) - - bash_path = {distro: os.path.join(cwd, path) - for distro, path in cfg['bash_path'].iteritems()} - logger.debug("bash_path %s", bash_path) - - for path_value in bash_path.itervalues(): - - if not os.path.exists(path_value): - os.mkdir(path_value) - - for rst_file in rst_files: - - try: - rst_file_path = os.path.join(rst_path, rst_file) - code_blocks = ExtractBlocks(rst_file_path, bash_path) - code_blocks.get_indice_blocks() - code_blocks.extract_codeblocks() - - code_blocks.write_bash_code() - - except (ParserErr.InvalidCodeBlockError, - ParserErr.InvalidOperatorError, - ParserErr.InvalidBlockError, - ParserErr.MissingTagsError) as ex: - logger.error(repr(ex)) - - logger.info("") - logger.info("Output written to:") - for distro in bash_path: - logger.info(bash_path[distro]) diff --git a/rst2bash/parsererr.py b/rst2bash/parsererr.py deleted file mode 100644 index 07f6bd4..0000000 --- a/rst2bash/parsererr.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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. - - -class Rst2BashError(Exception): - """Base class for exceptions for Rst2Bash module.""" - - pass - - -class InvalidBlockError(Rst2BashError): - """Error describing possible sphinx blocks but invalid for rst2bash.""" - - pass - - -class MissingTagsError(Rst2BashError): - """Error describing missing tags, especially rst2bash specific end tags.""" - - pass - - -class NestedDistroBlocksError(Rst2BashError): - """Error describing nested distribution blocks.""" - - def __init__(self, *args, **kwargs): - Rst2BashError.__init__(self, *args, **kwargs) - - -class PathNotFoundError(Rst2BashError): - """Error describing missing path for certain commands (ex: config).""" - - def __init__(self, *args, **kwargs): - Rst2BashError.__init__(self, *args, **kwargs) - - -class InvalidCodeBlockError(Rst2BashError): - """Error describing unspported code blocks for rst2bash.""" - - pass - - -class InvalidOperatorError(Rst2BashError): - """Error describing bash/db operators which are not supported.""" - - pass diff --git a/rst2bash/tests/__init__.py b/rst2bash/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rst2bash/tests/base.py b/rst2bash/tests/base.py deleted file mode 100644 index 1c30cdb..0000000 --- a/rst2bash/tests/base.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2010-2011 OpenStack Foundation -# 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. - -from oslotest import base - - -class TestCase(base.BaseTestCase): - - """Test case base class for all unit tests.""" diff --git a/rst2bash/tests/test_rst2bash.py b/rst2bash/tests/test_rst2bash.py deleted file mode 100644 index 5f26dbf..0000000 --- a/rst2bash/tests/test_rst2bash.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- 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. - -""" -test_rst2bash ----------------------------------- - -Tests for `rst2bash` module. -""" - -from rst2bash.tests import base - - -class TestRst2bash(base.TestCase): - - def test_something(self): - pass diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index ee760d9..0000000 --- a/setup.cfg +++ /dev/null @@ -1,51 +0,0 @@ -[metadata] -name = rst2bash -summary = Parser to convert RST into Bash. Allows generating Bash scripts to deploy OpenStack from install guides. -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 :: 3 - Programming Language :: Python :: 3.3 - Programming Language :: Python :: 3.4 - -[files] -packages = - rst2bash - -[build_sphinx] -source-dir = doc/source -build-dir = doc/build -all_files = 1 - -[upload_sphinx] -upload-dir = doc/build/html - -[compile_catalog] -directory = rst2bash/locale -domain = rst2bash - -[update_catalog] -domain = rst2bash -output_dir = rst2bash/locale -input_file = rst2bash/locale/rst2bash.pot - -[extract_messages] -keywords = _ gettext ngettext l_ lazy_gettext -mapping_file = babel.cfg -output_file = rst2bash/locale/rst2bash.pot - -[build_releasenotes] -all_files = 1 -build-dir = releasenotes/build -source-dir = releasenotes/source diff --git a/setup.py b/setup.py deleted file mode 100644 index 782bb21..0000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -# 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 - -# In python < 2.7.4, a lazy loading of package `pbr` will break -# setuptools if some other modules registered functions in `atexit`. -# solution from: http://bugs.python.org/issue15881#msg170215 -try: - import multiprocessing # noqa -except ImportError: - pass - -setuptools.setup( - setup_requires=['pbr>=1.8'], - pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index 4a7d204..0000000 --- a/test-requirements.txt +++ /dev/null @@ -1,17 +0,0 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - -hacking>=0.12.0,<0.13 # Apache-2.0 - -coverage>=4.0 # Apache-2.0 -python-subunit>=0.0.18 # Apache-2.0/BSD -sphinx>=1.2.1,!=1.3b1,<1.4 # BSD -oslosphinx>=4.7.0 # Apache-2.0 -oslotest>=1.10.0 # Apache-2.0 -testrepository>=0.0.18 # Apache-2.0/BSD -testscenarios>=0.4 # Apache-2.0/BSD -testtools>=1.4.0 # MIT - -# releasenotes -reno>=1.8.0 # Apache-2.0 diff --git a/tools/cluster b/tools/cluster deleted file mode 100755 index 3f88f80..0000000 --- a/tools/cluster +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -echo 'WIP: To be implemented.' diff --git a/tools/runparser.sh b/tools/runparser.sh deleted file mode 100755 index 6e3b0d3..0000000 --- a/tools/runparser.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -set -o errexit -o nounset - -# TODO: OUTPUT_DIR should either be read from the config file used by -# parser.py or passed to parser.py (argument or environment variable); -# every path should only be configured in one location -OUTPUT_DIR=build/scripts - -mkdir -p "$OUTPUT_DIR" - -REPO=openstack-manuals -# Only clone the repo if it does not exist yet. We could update an existing -# repo here, but skipping the repo instead allows for easy offline testing. -if [ ! -e build/$REPO ]; then - git clone \ - --depth 10 \ - git://git.openstack.org/openstack/openstack-manuals \ - build/$REPO -fi - -REPO=training-labs -if [ ! -e build/$REPO ]; then - git clone \ - git://git.openstack.org/openstack/training-labs \ - build/$REPO -fi - -# Aim at writing portable code that works with Python 2.x and (hopefully) -# with Python 3 as well. -python rst2bash/parser.py - -echo "Output written to $OUTPUT_DIR" diff --git a/tox.ini b/tox.ini deleted file mode 100644 index c5a3937..0000000 --- a/tox.ini +++ /dev/null @@ -1,46 +0,0 @@ -[tox] -minversion = 2.0 -envlist = py27,pep8 -skipsdist = True - -[testenv] -basepython = python3 -usedevelop = True -install_command = pip install {opts} {packages} -setenv = - VIRTUAL_ENV={envdir} - PYTHONWARNINGS=default::DeprecationWarning -deps = - -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt -commands = python setup.py test --slowest --testr-args='{posargs}' - -[testenv:py27] -basepython = python2.7 - -[testenv:pep8] -commands = flake8 {posargs} - -[testenv:venv] -commands = {posargs} - -[testenv:cover] -commands = python setup.py test --coverage --testr-args='{posargs}' - -[testenv:docs] -commands = python setup.py build_sphinx - -[testenv:releasenotes] -commands = - sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html - -[testenv:debug] -commands = oslo_debug_helper {posargs} - -[flake8] -# E123, E125 skipped as they are invalid PEP-8. - -show-source = True -ignore = E123,E125 -builtins = _ -exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build