diff options
-rw-r--r-- | doc/requirements.txt | 1 | ||||
-rw-r--r-- | doc/source/conf.py | 10 | ||||
-rw-r--r-- | doc/source/reference/index.rst | 3 | ||||
-rw-r--r-- | doc/source/user/history.rst | 5 | ||||
-rw-r--r-- | doc/source/user/index.rst | 1 | ||||
-rw-r--r-- | lower-constraints.txt | 1 | ||||
-rw-r--r-- | pbr/git.py | 7 | ||||
-rw-r--r-- | pbr/tests/test_packaging.py | 13 | ||||
-rw-r--r-- | pbr/tests/test_util.py | 20 | ||||
-rw-r--r-- | pbr/tests/test_wsgi.py | 4 | ||||
-rw-r--r-- | pbr/util.py | 3 | ||||
-rw-r--r-- | setup.cfg | 13 | ||||
-rw-r--r-- | tools/integration.sh | 2 | ||||
-rw-r--r-- | tox.ini | 16 |
14 files changed, 68 insertions, 31 deletions
diff --git a/doc/requirements.txt b/doc/requirements.txt index 711fb97..d0c1f36 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,4 +1,5 @@ sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD +sphinxcontrib-apidoc>=0.2.0 # BSD openstackdocstheme>=1.18.1 # Apache-2.0 reno>=2.5.0 # Apache-2.0 diff --git a/doc/source/conf.py b/doc/source/conf.py index cc7f4b3..13f63a0 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -8,7 +8,7 @@ sys.path.insert(0, os.path.abspath('../..')) # 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.todo'] +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinxcontrib.apidoc'] # make openstackdocstheme optional to not increase the needed dependencies try: import openstackdocstheme @@ -72,3 +72,11 @@ latex_documents = [ '%s Documentation' % project, 'OpenStack Foundation', 'manual'), ] + +# -- sphinxcontrib.apidoc configuration -------------------------------------- + +apidoc_module_dir = '../../pbr' +apidoc_output_dir = 'reference/api' +apidoc_excluded_paths = [ + 'tests', +] diff --git a/doc/source/reference/index.rst b/doc/source/reference/index.rst index 68a9c32..3162d67 100644 --- a/doc/source/reference/index.rst +++ b/doc/source/reference/index.rst @@ -3,6 +3,5 @@ =================== .. toctree:: - :glob: - api/* + api/modules diff --git a/doc/source/user/history.rst b/doc/source/user/history.rst deleted file mode 100644 index 55439e7..0000000 --- a/doc/source/user/history.rst +++ /dev/null @@ -1,5 +0,0 @@ -================= - Release History -================= - -.. include:: ../../../ChangeLog diff --git a/doc/source/user/index.rst b/doc/source/user/index.rst index 7854dc5..0629e2e 100644 --- a/doc/source/user/index.rst +++ b/doc/source/user/index.rst @@ -9,4 +9,3 @@ packagers semver compatibility - history diff --git a/lower-constraints.txt b/lower-constraints.txt index 173a299..fc576a5 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -25,6 +25,7 @@ requests==2.14.2 six==1.10.0 snowballstemmer==1.2.1 Sphinx==1.6.5 +sphinxcontrib-apidoc==0.2.0 sphinxcontrib-websupport==1.0.1 stestr==2.1.0 testrepository==0.0.18 @@ -223,6 +223,11 @@ def _iter_log_inner(git_dir): presentation logic to the output - making it suitable for different uses. + .. caution:: this function risk to return a tag that doesn't exist really + inside the git objects list due to replacement made + to tag name to also list pre-release suffix. + Compliant with the SemVer specification (e.g 1.2.3-rc1) + :return: An iterator of (hash, tags_set, 1st_line) tuples. """ log.info('[pbr] Generating ChangeLog') @@ -248,7 +253,7 @@ def _iter_log_inner(git_dir): for tag_string in refname.split("refs/tags/")[1:]: # git tag does not allow : or " " in tag names, so we split # on ", " which is the separator between elements - candidate = tag_string.split(", ")[0] + candidate = tag_string.split(", ")[0].replace("-", ".") if _is_valid_version(candidate): tags.add(candidate) diff --git a/pbr/tests/test_packaging.py b/pbr/tests/test_packaging.py index 853844f..308ae89 100644 --- a/pbr/tests/test_packaging.py +++ b/pbr/tests/test_packaging.py @@ -670,6 +670,12 @@ class TestVersions(base.BaseTestCase): version = packaging._get_version_from_git('1.2.3') self.assertEqual('1.2.3', version) + def test_tagged_version_with_semver_compliant_prerelease(self): + self.repo.commit() + self.repo.tag('1.2.3-rc2') + version = packaging._get_version_from_git() + self.assertEqual('1.2.3.0rc2', version) + def test_non_canonical_tagged_version_bump(self): self.repo.commit() self.repo.tag('1.4') @@ -726,6 +732,13 @@ class TestVersions(base.BaseTestCase): version = packaging._get_version_from_git('1.2.3') self.assertThat(version, matchers.StartsWith('1.2.3.0a2.dev1')) + def test_untagged_version_after_semver_compliant_prerelease_tag(self): + self.repo.commit() + self.repo.tag('1.2.3-rc2') + self.repo.commit() + version = packaging._get_version_from_git() + self.assertEqual('1.2.3.0rc3.dev1', version) + def test_preversion_too_low_simple(self): # That is, the target version is either already released or not high # enough for the semver requirements given api breaks etc. diff --git a/pbr/tests/test_util.py b/pbr/tests/test_util.py index 393bc5c..1cbb2d2 100644 --- a/pbr/tests/test_util.py +++ b/pbr/tests/test_util.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Copyright (c) 2015 Hewlett-Packard Development Company, L.P. (HP) # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -13,6 +14,7 @@ # under the License. import io +import tempfile import textwrap import six @@ -197,3 +199,21 @@ class TestDataFilesParsing(base.BaseTestCase): self.assertEqual(self.data_files, list(kwargs['data_files'])) + + +class TestUTF8DescriptionFile(base.BaseTestCase): + def test_utf8_description_file(self): + _, path = tempfile.mkstemp() + ini_template = """ + [metadata] + description_file = %s + """ + # Two \n's because pbr strips the file content and adds \n\n + # This way we can use it directly as the assert comparison + unicode_description = u'UTF8 description: é"…-ʃŋ\'\n\n' + ini = ini_template % path + with io.open(path, 'w', encoding='utf8') as f: + f.write(unicode_description) + config = config_from_ini(ini) + kwargs = util.setup_cfg_to_setup_kwargs(config) + self.assertEqual(unicode_description, kwargs['long_description']) diff --git a/pbr/tests/test_wsgi.py b/pbr/tests/test_wsgi.py index f840610..18732f7 100644 --- a/pbr/tests/test_wsgi.py +++ b/pbr/tests/test_wsgi.py @@ -77,8 +77,8 @@ class TestWsgiScripts(base.BaseTestCase): def _test_wsgi(self, cmd_name, output, extra_args=None): cmd = os.path.join(self.temp_dir, 'bin', cmd_name) - print("Running %s -p 0" % cmd) - popen_cmd = [cmd, '-p', '0'] + print("Running %s -p 0 -b 127.0.0.1" % cmd) + popen_cmd = [cmd, '-p', '0', '-b', '127.0.0.1'] if extra_args: popen_cmd.extend(extra_args) diff --git a/pbr/util.py b/pbr/util.py index e52f009..6b2e87d 100644 --- a/pbr/util.py +++ b/pbr/util.py @@ -62,6 +62,7 @@ except ImportError: import logging # noqa from collections import defaultdict +import io import os import re import shlex @@ -330,7 +331,7 @@ def setup_cfg_to_setup_kwargs(config, script_args=()): in_cfg_value = split_multiline(in_cfg_value) value = '' for filename in in_cfg_value: - description_file = open(filename) + description_file = io.open(filename, encoding='utf-8') try: value += description_file.read().strip() + '\n\n' finally: @@ -32,13 +32,6 @@ classifier = packages = pbr -[pbr] -autodoc_tree_index_modules = True -autodoc_tree_excludes = - setup.py - pbr/tests/ -api_doc_dir = reference/api - [entry_points] distutils.setup_keywords = pbr = pbr.core:pbr @@ -47,11 +40,5 @@ egg_info.writers = console_scripts = pbr = pbr.cmd.main:main -[build_sphinx] -all-files = 1 -build-dir = doc/build -source-dir = doc/source -warning-is-error = 1 - [bdist_wheel] universal = 1 diff --git a/tools/integration.sh b/tools/integration.sh index 3b431e1..6c4dc16 100644 --- a/tools/integration.sh +++ b/tools/integration.sh @@ -30,7 +30,7 @@ REPODIR=${REPODIR:-$BASE/new} # TODO: Figure out how to get this on to the box properly sudo apt-get update -sudo apt-get install -y --force-yes libvirt-dev libxml2-dev libxslt-dev libmysqlclient-dev libpq-dev libnspr4-dev pkg-config libsqlite3-dev libffi-dev libldap2-dev libsasl2-dev ccache libkrb5-dev liberasurecode-dev libjpeg-dev +sudo apt-get install -y --force-yes libvirt-dev libxml2-dev libxslt-dev libmysqlclient-dev libpq-dev libnspr4-dev pkg-config libsqlite3-dev libffi-dev libldap2-dev libsasl2-dev ccache libkrb5-dev liberasurecode-dev libjpeg-dev libsystemd-dev libnss3-dev libssl-dev # FOR numpy / pyyaml # The source list has been removed from our apt config so rather than @@ -13,7 +13,7 @@ setenv = OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:1} OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:60} deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} + -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/test-requirements.txt commands = stestr run --suppress-attachments {posargs} @@ -23,12 +23,20 @@ commands = flake8 {posargs} [testenv:docs] basepython = python3 -deps = -r{toxinidir}/doc/requirements.txt -commands = python setup.py build_sphinx +whitelist_externals = rm +deps = + -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/doc/requirements.txt +commands = + rm -rf doc/build doc/source/reference/api + sphinx-build -W -b html doc/source doc/build/html {posargs} [testenv:releasenotes] basepython = python3 -deps = -r{toxinidir}/doc/requirements.txt +whitelist_externals = rm +deps = + -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/doc/requirements.txt commands = rm -rf releasenotes/build sphinx-build -W -b html -d releasenotes/build/doctrees releasenotes/source releasenotes/build/html |