adding version to project, setting up autobuild of docs with ./run_tests.sh --docs

This commit is contained in:
Joe Heck 2011-10-27 13:20:27 -07:00
parent 7fbd04358d
commit 6e7d208436
8 changed files with 123 additions and 78 deletions

4
README
View File

@ -63,7 +63,7 @@ The source is maintained in the `doc/source` folder using
* Building Automatically::
$ python setup.py build_sphinx
$ ./run_tests.sh --docs
* Building Manually::
@ -71,4 +71,4 @@ The source is maintained in the `doc/source` folder using
$ python doc/generate_autodoc_index.py
$ sphinx-build -b html doc/source build/sphinx/html
Results in `doc/build/html` directory
Results are in the `build/sphinx/html` directory

View File

@ -0,0 +1,43 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC
#
# 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.
version_info = {'branch_nick': u'LOCALBRANCH',
'revision_id': 'LOCALREVISION',
'revno': 0}
NOVA_VERSION = ['2012', '1']
YEAR, COUNT = NOVA_VERSION
FINAL = False # This becomes true at Release Candidate time
def canonical_version_string():
return '.'.join([YEAR, COUNT])
def version_string():
if FINAL:
return canonical_version_string()
else:
return '%s-dev' % (canonical_version_string(),)
def vcs_version_string():
return '%s:%s' % (version_info['branch_nick'], version_info['revision_id'])
def version_string_with_vcs():
return '%s-%s' % (canonical_version_string(), vcs_version_string())

View File

@ -20,14 +20,15 @@
import os
from setuptools import setup, find_packages, findall
from django_openstack import version
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "django-openstack",
version = "0.4",
url = 'https://launchpad.net/django-openstack/',
version = version.canonical_version_string(),
url = 'https://github.com/openstack/horizon/',
license = 'Apache 2.0',
description = "A Django interface for OpenStack.",
long_description = read('README'),

View File

@ -12,6 +12,7 @@
# serve to show the default.
import sys, os
from django_openstack import version as horizon_version
# 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
@ -56,9 +57,9 @@ copyright = u'2011, OpenStack, LLC'
# built documents.
#
# The short X.Y version.
version = '1.0'
version = horizon_version.canonical_version_string()
# The full version, including alpha/beta/rc tags.
release = '1.0'
release = horizon_version.canonical_version_string()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@ -14,6 +14,7 @@
License for the specific language governing permissions and limitations
under the License.
========================
Horizon for Contributors
========================
@ -23,11 +24,32 @@ interface to OpenStack services including Nova, Swift, Keystone, and Quantum.
This document describes horizon for contributors of the project.
Project Structure
=================
This project is a bit different from other Openstack projects in that it has
two very distinct components underneath it:
* django-openstack
* openstack-dashboard
Django-openstack holds the generic libraries and components that can be
used in any Django project. In testing, this component is set up with
buildout (see run_tests.sh), and any dependencies that get added need to
be added to the django-openstack/buildout.cfg file.
Openstack-dashboard is a reference django project that uses django-openstack
and is built with a virtualenv and tested through that environment. If
depdendencies are added that the reference django project needs, they
should be added to openstack-dashboard/tools/pip-requires.
Contents:
---------
.. toctree::
:maxdepth: 1
testing
Developer Docs
--------------

32
doc/source/testing.rst Normal file
View File

@ -0,0 +1,32 @@
..
Copyright 2011 OpenStack, LLC
All Rights Reserved.
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.
=====================
Testing the Dashboard
=====================
Testing the dashbaord is a bit more complex due to having the two projects
in the same repository.
The run_tests.sh script invokes tests and analysis on both of these
components in it's process, and is what Jenkins uses to verify the
stability of the project.
To run the tests::
$ ./run_tests.sh

View File

@ -13,6 +13,7 @@ function usage {
echo " been added."
echo " -p, --pep8 Just run pep8"
echo " -y, --pylint Just run pylint"
echo " --docs Just build the documentation"
echo " -h, --help Print this usage message"
echo ""
echo "Note: with no options specified, the script will try to run the tests in"
@ -30,6 +31,7 @@ function process_option {
-p|--pep8) let just_pep8=1;;
-y|--pylint) let just_pylint=1;;
-f|--force) let force=1;;
--docs) let just_docs=1;;
*) testargs="$testargs $1"
esac
}
@ -59,6 +61,16 @@ function run_pep8 {
${django_wrapper} pep8 $PEP8_OPTIONS $PEP8_INCLUDE | perl -ple 's/: ([WE]\d+)/: [$1]/' > pep8.txt
}
function run_sphinx {
echo "Building sphinx..."
echo "${django_wrapper} export DJANGO_SETTINGS_MODULE=local.local_settings"
${django_wrapper} export DJANGO_SETTINGS_MODULE=local.local_settings
echo "${django_wrapper} python doc/generate_autodoc_index.py"
${django_wrapper} python doc/generate_autodoc_index.py
echo "${django_wrapper} sphinx-build -b html doc/source build/sphinx/html"
${django_wrapper} sphinx-build -b html doc/source build/sphinx/html
}
# DEFAULTS FOR RUN_TESTS.SH
#
@ -73,6 +85,7 @@ django_wrapper=""
dashboard_wrapper=""
just_pep8=0
just_pylint=0
just_docs=0
# PROCESS ARGUMENTS, OVERRIDE DEFAULTS
for arg in "$@"; do
@ -138,16 +151,13 @@ function run_tests {
exit $(($OPENSTACK_RESULT || $DASHBOARD_RESULT))
}
if [ $just_docs -eq 1 ]; then
run_sphinx
exit $?
fi
if [ $just_pep8 -eq 1 ]; then
run_pep8
#capability discovery
#capability discovery
#store & compare arista -> Mongo - quarantine
#SMBios probes
#store & compare arista -> Mongo - quarantine
#SMBios probes
exit $?
fi

View File

@ -1,64 +0,0 @@
#!/usr/bin/python
# Copyright (c) 2010-2011 OpenStack, LLC.
#
# 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 subprocess
from setuptools import setup, find_packages
cmdclass = {}
# If Sphinx is installed on the box running setup.py,
# enable setup.py to build the documentation, otherwise,
# just ignore it
try:
from sphinx.setup_command import BuildDoc
if 'DJANGO_SETTINGS_MODULE' not in os.environ:
os.environ['DJANGO_SETTINGS_MODULE'] = 'local.local_settings'
class local_BuildDoc(BuildDoc):
def run(self):
base_dir = os.path.dirname(os.path.abspath(__file__))
subprocess.Popen(["python", "generate_autodoc_index.py"],
cwd=os.path.join(base_dir, "doc")).communicate()
for builder in ['html']: # ,'man'
self.builder = builder
self.finalize_options()
BuildDoc.run(self)
cmdclass['build_sphinx'] = local_BuildDoc
except:
pass
setup(
name='horizon',
version='2011.3',
description="OpenStack Dashboard",
license='Apache License (2.0)',
classifiers=["Programming Language :: Python"],
keywords='dashboard openstack',
author='OpenStack, LLC.',
author_email='openstack@lists.launchpad.net',
url='http://www.openstack.org',
include_package_data=True,
packages=find_packages(exclude=['test', 'bin']),
scripts=[],
zip_safe=False,
cmdclass=cmdclass,
install_requires=['setuptools'],
test_suite='nose.collector',
entry_points={},
)