From 2a9d49d9bc916e2e3d220ccbc288f8c7a31e3827 Mon Sep 17 00:00:00 2001 From: Jenkins Date: Thu, 4 Jun 2015 13:22:13 +0000 Subject: [PATCH] Add cookiecutter-generated files for project Use cookiecutter (https://git.openstack.org/openstack-dev/cookiecutter) to generate config for tox so we can generate docs, run pep8, etc. Also move CONTRIBUTING.rst to the root of the repository in keeping with what seems to be the standard location. This move allows us to easily generate the docs. Also include a tiny fix to allow pep8 to run cleanly. Change-Id: Ifbfc6d85c7b02bf4ab989974b491a3a1ae6f0900 --- .gitignore | 55 +++++++++++++- .mailmap | 3 + .../dev/CONTRIBUTING.rst => CONTRIBUTING.rst | 0 HACKING.rst | 4 + MANIFEST.in | 6 ++ babel.cfg | 2 + doc/source/conf.py | 75 +++++++++++++++++++ doc/source/contributing.rst | 4 + doc/source/index.rst | 18 +++++ doc/source/readme.rst | 1 + openstack-common.conf | 6 ++ playbooks/library/os_ironic_node.py | 2 +- requirements.txt | 3 + setup.cfg | 44 +++++++++++ setup.py | 30 ++++++++ test-requirements.txt | 15 ++++ tox.ini | 36 +++++++++ 17 files changed, 301 insertions(+), 3 deletions(-) create mode 100644 .mailmap rename doc/source/dev/CONTRIBUTING.rst => CONTRIBUTING.rst (100%) create mode 100644 HACKING.rst create mode 100644 MANIFEST.in create mode 100644 babel.cfg create mode 100755 doc/source/conf.py create mode 100644 doc/source/contributing.rst create mode 100644 doc/source/index.rst create mode 100644 doc/source/readme.rst create mode 100644 openstack-common.conf create mode 100644 setup.cfg create mode 100755 setup.py create mode 100644 test-requirements.txt create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index ca9e9a7bb..589989318 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,54 @@ -*~ -.*.sw? +*.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 +.venv + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Complexity +output/*.html +output/*/index.html + +# Sphinx +_build doc/build + +# pbr generates these +AUTHORS +ChangeLog + +# Editors +*~ +.*.swp +.*sw? diff --git a/.mailmap b/.mailmap new file mode 100644 index 000000000..516ae6fe0 --- /dev/null +++ b/.mailmap @@ -0,0 +1,3 @@ +# Format is: +# +# diff --git a/doc/source/dev/CONTRIBUTING.rst b/CONTRIBUTING.rst similarity index 100% rename from doc/source/dev/CONTRIBUTING.rst rename to CONTRIBUTING.rst diff --git a/HACKING.rst b/HACKING.rst new file mode 100644 index 000000000..9d8b79011 --- /dev/null +++ b/HACKING.rst @@ -0,0 +1,4 @@ +bifrost Style Commandments +=============================================== + +Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..c978a52da --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include AUTHORS +include ChangeLog +exclude .gitignore +exclude .gitreview + +global-exclude *.pyc diff --git a/babel.cfg b/babel.cfg new file mode 100644 index 000000000..15cd6cb76 --- /dev/null +++ b/babel.cfg @@ -0,0 +1,2 @@ +[python: **.py] + diff --git a/doc/source/conf.py b/doc/source/conf.py new file mode 100755 index 000000000..5ceecf248 --- /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', + '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'bifrost' +copyright = u'2015, 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 new file mode 100644 index 000000000..1728a61ca --- /dev/null +++ b/doc/source/contributing.rst @@ -0,0 +1,4 @@ +============ +Contributing +============ +.. include:: ../../CONTRIBUTING.rst diff --git a/doc/source/index.rst b/doc/source/index.rst new file mode 100644 index 000000000..dff0cd849 --- /dev/null +++ b/doc/source/index.rst @@ -0,0 +1,18 @@ +Welcome to bifrost's documentation! +======================================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + readme + contributing + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/doc/source/readme.rst b/doc/source/readme.rst new file mode 100644 index 000000000..a6210d3d8 --- /dev/null +++ b/doc/source/readme.rst @@ -0,0 +1 @@ +.. include:: ../../README.rst diff --git a/openstack-common.conf b/openstack-common.conf new file mode 100644 index 000000000..b704d014b --- /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=bifrost diff --git a/playbooks/library/os_ironic_node.py b/playbooks/library/os_ironic_node.py index 3d83e69c4..a7186ad4a 100644 --- a/playbooks/library/os_ironic_node.py +++ b/playbooks/library/os_ironic_node.py @@ -183,7 +183,7 @@ def _check_set_maintenance(module, cloud, node): def _check_set_power_state(module, cloud, node): if 'power on' in str(node['power_state']): if _is_false(module.params['power']): - # User has requested the node be powered off. + # User has requested the node be powered off. cloud.set_machine_power_off(node['uuid']) module.exit_json(changed=True, msg="Power requested off") if 'power off' in str(node['power_state']): diff --git a/requirements.txt b/requirements.txt index b351a61bc..13ca378b8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,6 @@ PyYAML jinja2 pip>=7.0 + +pbr>=0.6,!=0.7,<1.0 +Babel>=1.3 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..0fdda3778 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,44 @@ +[metadata] +name = bifrost +summary = Deployment of physical machines using OpenStack Ironic and Ansible +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 + +[files] +packages = + bifrost + +[build_sphinx] +source-dir = doc/source +build-dir = doc/build +all_files = 1 + +[upload_sphinx] +upload-dir = doc/build/html + +[compile_catalog] +directory = bifrost/locale +domain = bifrost + +[update_catalog] +domain = bifrost +output_dir = bifrost/locale +input_file = bifrost/locale/bifrost.pot + +[extract_messages] +keywords = _ gettext ngettext l_ lazy_gettext +mapping_file = babel.cfg +output_file = bifrost/locale/bifrost.pot diff --git a/setup.py b/setup.py new file mode 100755 index 000000000..736375744 --- /dev/null +++ b/setup.py @@ -0,0 +1,30 @@ +#!/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 + +# 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'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 000000000..8592bde2b --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,15 @@ +# 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.11,>=0.10.0 + +coverage>=3.6 +discover +python-subunit>=0.0.18 +sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3 +oslosphinx>=2.2.0 # Apache-2.0 +oslotest>=1.2.0 # Apache-2.0 +testrepository>=0.0.18 +testscenarios>=0.4 +testtools>=0.9.36,!=1.2.0 diff --git a/tox.ini b/tox.ini new file mode 100644 index 000000000..c0fe54df5 --- /dev/null +++ b/tox.ini @@ -0,0 +1,36 @@ +[tox] +minversion = 1.6 +envlist = docs,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 test --slowest --testr-args='{posargs}' + +[testenv:pep8] +commands = flake8 + +[testenv:venv] +commands = {posargs} + +[testenv:cover] +commands = python setup.py test --coverage --testr-args='{posargs}' + +[testenv:docs] +commands = python setup.py build_sphinx + +[testenv:debug] +commands = oslo_debug_helper {posargs} + +[flake8] +# E123, E125 skipped as they are invalid PEP-8. + +show-source = True +ignore = E123,E125,F403,H102,H303 +builtins = _ +exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build