Make build environment workable

* Add files needed to build documentation. They are copied
  from the cookiecutter repository.

* Replace setup.py and add setup.cfg

* Add tox.ini

* Add requirements.txt and test-requirements.txt

* Fix hacking issue H307 (like imports should be grouped together)

Change-Id: I325bb07233853611e8f0952a554a30dba2b7dfe7
Co-Authored-By: Joshua Harlow <harlowja@yahoo-inc.com>
This commit is contained in:
Christian Berendt 2014-08-01 15:12:33 +02:00
parent 8b4a229d93
commit 72d30dae0a
12 changed files with 215 additions and 66 deletions

72
doc/source/conf.py Executable file
View File

@ -0,0 +1,72 @@
# 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'doc8'
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}

View File

@ -0,0 +1,4 @@
============
Contributing
============
.. include:: ../../CONTRIBUTING.rst

20
doc/source/index.rst Normal file
View File

@ -0,0 +1,20 @@
Welcome to doc8's documentation!
================================
Contents:
.. toctree::
:maxdepth: 2
readme
installation
usage
contributing
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -0,0 +1,12 @@
============
Installation
============
At the command line::
$ pip install doc8
Or, if you have virtualenvwrapper installed::
$ mkvirtualenv doc8
$ pip install doc8

1
doc/source/readme.rst Normal file
View File

@ -0,0 +1 @@
.. include:: ../../README.rst

7
doc/source/usage.rst Normal file
View File

@ -0,0 +1,7 @@
=====
Usage
=====
To use doc8 in a project::
import doc8

View File

@ -19,14 +19,13 @@
import errno
import os
import restructuredtext_lint as rl
import six
from docutils import core
from docutils import frontend
from docutils import nodes as docutils_nodes
from docutils import parsers as docutils_parser
from docutils import utils
import restructuredtext_lint as rl
import six
class ParsedFile(object):

5
requirements.txt Normal file
View File

@ -0,0 +1,5 @@
argparse
docutils
restructuredtext-lint>=0.7
six
stevedore

View File

@ -1,2 +1,37 @@
[metadata]
name = doc8
version = 0.3.4
summary = Style checker for Sphinx (or other) RST documentation
description-file =
README.rst
author = OpenStack
author-email = openstack-dev@lists.openstack.org
home-page = http://git.openstack.org/cgit/stackforge/doc8
classifier =
Intended Audience :: Information Technology
Intended Audience :: System Administrators
Intended Audience :: Developers
Development Status :: 4 - Beta
Topic :: Utilities
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.2
Programming Language :: Python :: 3.3
Programming Language :: Python :: 3.4
[entry_points]
console_scripts =
doc8 = doc8.main:main
[build_sphinx]
all_files = 1
build-dir = doc/build
source-dir = doc/source
[wheel]
universal = 1

View File

@ -1,70 +1,30 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
# 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
# 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
# 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.
# 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
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
from setuptools import find_packages
from setuptools import setup
# 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
def _path(fn):
return os.path.join(os.path.dirname(__file__), fn)
def _readme():
with open(_path("README.rst"), "r") as handle:
return handle.read()
setup(
name='doc8',
version='0.3.4',
description='style checker for sphinx (or other) rst documentation.',
url='http://git.openstack.org/cgit/stackforge/doc8',
license="ASL 2.0",
install_requires=[
'argparse',
'docutils',
'restructuredtext-lint>=0.7',
'six',
'stevedore',
],
entry_points={
'console_scripts': [
'doc8 = doc8.main:main',
],
},
packages=find_packages(),
classifiers=[
"Development Status :: 4 - Beta",
"Topic :: Utilities",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
],
keywords="rst docs style checking",
long_description=_readme(),
)
setuptools.setup(
setup_requires=['pbr'],
pbr=True)

4
test-requirements.txt Normal file
View File

@ -0,0 +1,4 @@
hacking>=0.9.2,<0.10
nose
oslosphinx
sphinx>=1.1.2,!=1.2.0,<1.3

30
tox.ini Normal file
View File

@ -0,0 +1,30 @@
[tox]
minversion = 1.6
skipsdist = True
envlist = py26,py27,pep8
[testenv]
setenv = VIRTUAL_ENV={envdir}
usedevelop = True
install_command = pip install {opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = nosetests {posargs}
[testenv:pep8]
commands = flake8 {posargs}
[tox:jenkins]
downloadcache = ~/cache/pip
[testenv:venv]
commands = {posargs}
[testenv:docs]
commands = python setup.py build_sphinx
[flake8]
ignore = H302,F401
builtins = _
show-source = True
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build