Rework repository to make it an installable python package
This is an overhaul of the complete content to make it a separate python package that can be installed on the jenkins machines as well as on editor's machines. The goal of this patchset is to package everything and get the command "openstack-doc-test" running so that it can be used for gating. This will need further refinement for the other commands. Change-Id: Icc2f1807dd5ab5fb2f83c05d1b3895b3a9a0dbaf
This commit is contained in:
parent
a5cb900fc8
commit
05f9428303
5
.gitignore
vendored
5
.gitignore
vendored
@ -2,3 +2,8 @@
|
||||
.bak
|
||||
*.swp
|
||||
*~
|
||||
AUTHORS
|
||||
ChangeLog
|
||||
build
|
||||
dist
|
||||
openstack_doc_tools.egg-info
|
||||
|
10
MANIFEST.in
Normal file
10
MANIFEST.in
Normal file
@ -0,0 +1,10 @@
|
||||
include README.rst
|
||||
include AUTHORS
|
||||
include LICENSE
|
||||
include ChangeLog
|
||||
recursive-include doc *
|
||||
recursive-include tools *
|
||||
recursive-include sitemap *
|
||||
|
||||
exclude .gitignore
|
||||
exclude .gitreview
|
@ -2,15 +2,15 @@
|
||||
# A collection of shared functions for managing help flag mapping files.
|
||||
#
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
import os
|
||||
import string
|
||||
import sys
|
||||
import pkgutil
|
||||
import glob
|
||||
|
||||
from collections import defaultdict
|
||||
from xml.sax.saxutils import escape
|
||||
from oslo.config import cfg
|
||||
|
||||
# gettext internationalisation function requisite:
|
||||
import __builtin__
|
||||
|
0
os_doc_tools/__init__.py
Normal file
0
os_doc_tools/__init__.py
Normal file
@ -748,52 +748,8 @@ def build_affected_books(rootdir, book_exceptions,
|
||||
print("Building of books finished successfully.\n")
|
||||
|
||||
|
||||
def main(args):
|
||||
def main():
|
||||
|
||||
if args.check_all:
|
||||
args.check_deletions = True
|
||||
args.check_syntax = True
|
||||
args.check_build = True
|
||||
args.check_niceness = True
|
||||
|
||||
if not args.force and only_www_touched():
|
||||
print("Only files in www directory changed, nothing to do.\n")
|
||||
return
|
||||
|
||||
if args.check_syntax or args.check_niceness:
|
||||
if args.force:
|
||||
validate_all_files(args.path, FILE_EXCEPTIONS, args.verbose,
|
||||
args.check_syntax, args.check_niceness,
|
||||
args.ignore_errors)
|
||||
else:
|
||||
validate_individual_files(args.path, FILE_EXCEPTIONS,
|
||||
args.verbose, args.check_syntax,
|
||||
args.check_niceness,
|
||||
args.ignore_errors)
|
||||
|
||||
if args.check_deletions:
|
||||
check_deleted_files(args.path, FILE_EXCEPTIONS, args.verbose)
|
||||
|
||||
if args.check_build:
|
||||
build_affected_books(args.path, BOOK_EXCEPTIONS,
|
||||
args.verbose, args.force, args.ignore_errors)
|
||||
|
||||
|
||||
def default_root():
|
||||
"""Return the location of openstack-manuals/doc/
|
||||
|
||||
The current working directory must be inside of the openstack-manuals
|
||||
repository for this method to succeed"""
|
||||
try:
|
||||
git_args = ["git", "rev-parse", "--show-toplevel"]
|
||||
gitroot = check_output(git_args).rstrip()
|
||||
except (subprocess.CalledProcessError, OSError) as e:
|
||||
print("git failed: %s" % e)
|
||||
sys.exit(1)
|
||||
|
||||
return os.path.join(gitroot, "doc")
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description="Validate XML files against "
|
||||
"the DocBook 5 RELAX NG schema")
|
||||
parser.add_argument('path', nargs='?', default=default_root(),
|
||||
@ -821,4 +777,49 @@ if __name__ == '__main__':
|
||||
if (len(sys.argv) == 1):
|
||||
# No arguments given, use check-all
|
||||
prog_args.check_all = True
|
||||
main(prog_args)
|
||||
|
||||
if prog_args.check_all:
|
||||
prog_args.check_deletions = True
|
||||
prog_args.check_syntax = True
|
||||
prog_args.check_build = True
|
||||
prog_args.check_niceness = True
|
||||
|
||||
if not prog_args.force and only_www_touched():
|
||||
print("Only files in www directory changed, nothing to do.\n")
|
||||
return
|
||||
|
||||
if prog_args.check_syntax or prog_args.check_niceness:
|
||||
if prog_args.force:
|
||||
validate_all_files(prog_args.path, FILE_EXCEPTIONS, prog_args.verbose,
|
||||
prog_args.check_syntax, prog_args.check_niceness,
|
||||
prog_args.ignore_errors)
|
||||
else:
|
||||
validate_individual_files(prog_args.path, FILE_EXCEPTIONS,
|
||||
prog_args.verbose, prog_args.check_syntax,
|
||||
prog_args.check_niceness,
|
||||
prog_args.ignore_errors)
|
||||
|
||||
if prog_args.check_deletions:
|
||||
check_deleted_files(prog_args.path, FILE_EXCEPTIONS, prog_args.verbose)
|
||||
|
||||
if prog_args.check_build:
|
||||
build_affected_books(prog_args.path, BOOK_EXCEPTIONS,
|
||||
prog_args.verbose, prog_args.force, prog_args.ignore_errors)
|
||||
|
||||
|
||||
def default_root():
|
||||
"""Return the location of openstack-manuals/doc/
|
||||
|
||||
The current working directory must be inside of the openstack-manuals
|
||||
repository for this method to succeed"""
|
||||
try:
|
||||
git_args = ["git", "rev-parse", "--show-toplevel"]
|
||||
gitroot = check_output(git_args).rstrip()
|
||||
except (subprocess.CalledProcessError, OSError) as e:
|
||||
print("git failed: %s" % e)
|
||||
sys.exit(1)
|
||||
|
||||
return os.path.join(gitroot, "doc")
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
5
requirements.txt
Normal file
5
requirements.txt
Normal file
@ -0,0 +1,5 @@
|
||||
pbr>=0.5.21,<1.0
|
||||
argparse
|
||||
lxml>=2.3
|
||||
oslo.config
|
||||
|
40
setup.cfg
Normal file
40
setup.cfg
Normal file
@ -0,0 +1,40 @@
|
||||
[metadata]
|
||||
name = openstack-doc-tools
|
||||
version = 0.1
|
||||
summary = Tools for OpenStack Documentation
|
||||
description-file =
|
||||
README.rst
|
||||
author = OpenStack Documentation
|
||||
author-email = openstack-doc@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 =
|
||||
os_doc_tools
|
||||
autogenerate-config-docs
|
||||
scripts =
|
||||
bin/build-ha-guide.sh
|
||||
bin/generatedocbook
|
||||
bin/generatepot
|
||||
data_files =
|
||||
usr/share/openstack-doc-tools/sitemap = sitemap/*
|
||||
usr/share/openstack-doc-tools/cleanup = cleanup/*
|
||||
|
||||
[global]
|
||||
setup-hooks =
|
||||
pbr.hooks.setup_hook
|
||||
|
||||
[entry_points]
|
||||
console_scripts =
|
||||
openstack-doc-test = os_doc_tools.doctest:main
|
||||
openstack-autohelp = autohelp:main
|
22
setup.py
Normal file
22
setup.py
Normal file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['pbr'],
|
||||
pbr=True)
|
Loading…
x
Reference in New Issue
Block a user