[catkin-pkg] 01/01: Imported Upstream version 0.2.10
Jochen Sprickerhof
jspricke-guest at moszumanska.debian.org
Thu Aug 6 05:47:19 UTC 2015
This is an automated email from the git hooks/post-receive script.
jspricke-guest pushed a commit to annotated tag upstream/0.2.10
in repository catkin-pkg.
commit 5deccf2f69ad5eca5c5ba2ab1a51059badef851e
Author: Jochen Sprickerhof <git at jochen.sprickerhof.de>
Date: Thu Aug 6 07:45:04 2015 +0200
Imported Upstream version 0.2.10
---
LICENSE | 31 +++++++++++++
bin/catkin_generate_changelog | 10 ++--
doc/Makefile | 6 ++-
src/catkin_pkg/__init__.py | 2 +-
src/catkin_pkg/changelog_generator.py | 13 ++++--
src/catkin_pkg/changelog_generator_vcs.py | 8 ++--
src/catkin_pkg/tool_detection.py | 77 +++++++++++++++++++++++++++++++
test/test_tool_detection.py | 18 ++++++++
test/util.py | 35 ++++++++++++++
9 files changed, 185 insertions(+), 15 deletions(-)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..7855782
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,31 @@
+Software License Agreement (BSD License)
+
+Copyright (c) 2012, Willow Garage, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+* Neither the name of Willow Garage, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/bin/catkin_generate_changelog b/bin/catkin_generate_changelog
index 40c2580..60c8bc8 100755
--- a/bin/catkin_generate_changelog
+++ b/bin/catkin_generate_changelog
@@ -43,6 +43,8 @@ def main(sysargs=None):
help='Output changelog content to the console as if there would be only one package in the root of the repository')
parser.add_argument('--skip-contributors', action='store_true', default=False,
help='Skip adding the list of contributors to the changelog')
+ parser.add_argument('--skip-merges', action='store_true', default=False,
+ help='Skip adding merge commits to the changelog')
parser.add_argument('-y', '--non-interactive', action='store_true', default=False,
help="Run without user interaction, confirming all questions with 'yes'")
args = parser.parse_args(sysargs)
@@ -56,11 +58,11 @@ def main(sysargs=None):
# printing status messages to stderr to allow piping the changelog to a file
if args.all:
print('Querying all tags and commit information...', file=sys.stderr)
- tag2log_entries = get_all_changes(vcs_client)
+ tag2log_entries = get_all_changes(vcs_client, skip_merges=args.skip_merges)
print('Generating changelog output with all versions...', file=sys.stderr)
else:
print('Querying commit information since latest tag...', file=sys.stderr)
- tag2log_entries = get_forthcoming_changes(vcs_client)
+ tag2log_entries = get_forthcoming_changes(vcs_client, skip_merges=args.skip_merges)
print('Generating changelog files with forthcoming version...', file=sys.stderr)
print('', file=sys.stderr)
data = generate_changelog_file('repository-level', tag2log_entries, vcs_client=vcs_client)
@@ -96,12 +98,12 @@ def main(sysargs=None):
if args.all:
print('Querying all tags and commit information...')
- tag2log_entries = get_all_changes(vcs_client)
+ tag2log_entries = get_all_changes(vcs_client, skip_merges=args.skip_merges)
print('Generating changelog files with all versions...')
generate_changelogs(base_path, packages, tag2log_entries, logger=logging, vcs_client=vcs_client, skip_contributors=args.skip_contributors)
else:
print('Querying commit information since latest tag...')
- tag2log_entries = get_forthcoming_changes(vcs_client)
+ tag2log_entries = get_forthcoming_changes(vcs_client, skip_merges=args.skip_merges)
# separate packages with/without a changelog file
packages_without = {pkg_path: package for pkg_path, package in packages.items() if package.name in missing_changelogs}
if packages_without:
diff --git a/doc/Makefile b/doc/Makefile
index ff15a01..64d2ab3 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,10 +1,12 @@
.PHONY: html apidoc clean upload
+SPHINXAPIDOC=sphinx-apidoc
+
html: apidoc
- make -C _build html
+ $(MAKE) -C _build html
apidoc:
- sphinx-apidoc -F -o _build ../src/catkin_pkg
+ $(SPHINXAPIDOC) -F -o _build ../src/catkin_pkg
sed -i "s/_build/./g" _build/Makefile
clean:
diff --git a/src/catkin_pkg/__init__.py b/src/catkin_pkg/__init__.py
index a37c860..fd1f2aa 100644
--- a/src/catkin_pkg/__init__.py
+++ b/src/catkin_pkg/__init__.py
@@ -34,4 +34,4 @@
Library for retrieving information about catkin packages.
"""
-__version__ = '0.2.9'
+__version__ = '0.2.10'
diff --git a/src/catkin_pkg/changelog_generator.py b/src/catkin_pkg/changelog_generator.py
index 322c0ab..f1f41e3 100644
--- a/src/catkin_pkg/changelog_generator.py
+++ b/src/catkin_pkg/changelog_generator.py
@@ -48,22 +48,24 @@ from catkin_pkg.changelog_generator_vcs import Tag
FORTHCOMING_LABEL = 'Forthcoming'
-def get_all_changes(vcs_client):
+def get_all_changes(vcs_client, skip_merges=False):
tags = _get_version_tags(vcs_client)
# query all log entries per tag range
tag2log_entries = {}
previous_tag = Tag(None)
for tag in sorted_tags(tags):
- log_entries = vcs_client.get_log_entries(from_tag=previous_tag.name, to_tag=tag.name)
+ log_entries = vcs_client.get_log_entries(
+ from_tag=previous_tag.name, to_tag=tag.name, skip_merges=skip_merges)
tag2log_entries[previous_tag] = log_entries
previous_tag = tag
- log_entries = vcs_client.get_log_entries(from_tag=previous_tag.name, to_tag=None)
+ log_entries = vcs_client.get_log_entries(
+ from_tag=previous_tag.name, to_tag=None, skip_merges=skip_merges)
tag2log_entries[previous_tag] = log_entries
return tag2log_entries
-def get_forthcoming_changes(vcs_client):
+def get_forthcoming_changes(vcs_client, skip_merges=False):
tags = _get_version_tags(vcs_client)
latest_tag_name = _get_latest_version_tag_name(vcs_client)
@@ -76,7 +78,8 @@ def get_forthcoming_changes(vcs_client):
to_tag = tag
# ignore non-forthcoming log entries but keep version to identify injection point of forthcoming
tag2log_entries[tag] = None
- log_entries = vcs_client.get_log_entries(from_tag=from_tag.name, to_tag=to_tag.name)
+ log_entries = vcs_client.get_log_entries(
+ from_tag=from_tag.name, to_tag=to_tag.name, skip_merges=skip_merges)
tag2log_entries[from_tag] = log_entries
return tag2log_entries
diff --git a/src/catkin_pkg/changelog_generator_vcs.py b/src/catkin_pkg/changelog_generator_vcs.py
index 2781d5d..58757aa 100644
--- a/src/catkin_pkg/changelog_generator_vcs.py
+++ b/src/catkin_pkg/changelog_generator_vcs.py
@@ -78,7 +78,7 @@ class VcsClientBase(object):
def get_latest_tag_name(self):
raise NotImplementedError()
- def get_log_entries(self, from_tag, to_tag):
+ def get_log_entries(self, from_tag, to_tag, skip_merges=False):
raise NotImplementedError()
def replace_repository_references(self, line):
@@ -170,12 +170,14 @@ class GitClient(VcsClientBase):
tag_name = result_describe['output']
return tag_name
- def get_log_entries(self, from_tag, to_tag):
+ def get_log_entries(self, from_tag, to_tag, skip_merges=False):
# query all hashes in the range
cmd = [self._executable, 'log']
if from_tag or to_tag:
cmd.append('%s%s' % ('%s..' % to_tag if to_tag else '', from_tag if from_tag else ''))
cmd.append('--format=format:%H')
+ if skip_merges:
+ cmd.append('--no-merges')
result = self._run_command(cmd)
if result['returncode']:
raise RuntimeError('Could not fetch commit hashes:\n%s' % result['output'])
@@ -290,7 +292,7 @@ class HgClient(VcsClientBase):
tag_name = result_log['output']
return tag_name
- def get_log_entries(self, from_tag, to_tag):
+ def get_log_entries(self, from_tag, to_tag, skip_merges=False):
# query all hashes in the range
# ascending chronological order since than it is easier to handle empty tag names
revrange = '%s:%s' % ((to_tag if to_tag else ''), (from_tag if from_tag else 'tip'))
diff --git a/src/catkin_pkg/tool_detection.py b/src/catkin_pkg/tool_detection.py
new file mode 100644
index 0000000..ec4af2d
--- /dev/null
+++ b/src/catkin_pkg/tool_detection.py
@@ -0,0 +1,77 @@
+# Software License Agreement (BSD License)
+#
+# Copyright (c) 2015, Open Source Robotics Foundation, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of Willow Garage, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Common functions that can be used to mark spaces, e.g. build and devel, to
+indicate which tools previously built the space. This allows the tools to
+detect cross tool talk and avoid it where appropriate.
+"""
+
+from __future__ import print_function
+import os
+
+SPACE_BUILT_BY_MARKER_FILENAME = '.built_by'
+
+
+def get_previous_tool_used_on_the_space(space_path):
+ """
+ Return the tool used to build the space at the given path, or None.
+
+ Returns None if the path does not exist or if there is no built by file.
+
+ :param str space_path: path to the space in question.
+ :returns: str identifying the tool used to build the space or None.
+ """
+ if os.path.isdir(space_path):
+ marker_path = os.path.join(space_path, SPACE_BUILT_BY_MARKER_FILENAME)
+ if os.path.isfile(marker_path):
+ with open(marker_path, 'r') as f:
+ return f.read().strip()
+ return None
+
+
+def mark_space_as_built_by(space_path, tool_name):
+ """
+ Place a marker file in the space at the given path, telling who built it.
+
+ The path to the marker is created if necessary.
+
+ :param str space_path: path to the space which should be marked.
+ :param str tool_name: name of the tool doing the marking.
+ :raises: OSError, others, when trying to create the folder.
+ """
+ if not os.path.isdir(space_path):
+ # Might fail if it's a file already or for permissions.
+ os.makedirs(space_path)
+ marker_path = os.path.join(space_path, SPACE_BUILT_BY_MARKER_FILENAME)
+ with open(marker_path, 'w') as f:
+ f.write(tool_name)
diff --git a/test/test_tool_detection.py b/test/test_tool_detection.py
new file mode 100644
index 0000000..059db0f
--- /dev/null
+++ b/test/test_tool_detection.py
@@ -0,0 +1,18 @@
+import os
+
+from catkin_pkg.tool_detection import get_previous_tool_used_on_the_space
+from catkin_pkg.tool_detection import mark_space_as_built_by
+
+from .util import in_temporary_directory
+
+
+ at in_temporary_directory
+def test_get_previous_tool_used_on_the_space():
+ res = get_previous_tool_used_on_the_space('folder_that_does_not_exist')
+ assert res is None, res
+ os.makedirs('build')
+ res = get_previous_tool_used_on_the_space('build')
+ assert res is None, res
+ mark_space_as_built_by('build', 'foo')
+ res = get_previous_tool_used_on_the_space('build')
+ assert res == 'foo', res
diff --git a/test/util.py b/test/util.py
new file mode 100644
index 0000000..1427780
--- /dev/null
+++ b/test/util.py
@@ -0,0 +1,35 @@
+import functools
+import os
+import shutil
+import tempfile
+
+
+class temporary_directory(object):
+ def __init__(self, prefix=''):
+ self.prefix = prefix
+
+ def __enter__(self):
+ self.original_cwd = os.getcwd()
+ self.temp_path = tempfile.mkdtemp(prefix=self.prefix)
+ os.chdir(self.temp_path)
+ return self.temp_path
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ if self.temp_path and os.path.exists(self.temp_path):
+ shutil.rmtree(self.temp_path)
+ if self.original_cwd and os.path.exists(self.original_cwd):
+ os.chdir(self.original_cwd)
+
+
+def in_temporary_directory(f):
+ @functools.wraps(f)
+ def decorated(*args, **kwds):
+ with temporary_directory() as directory:
+ from inspect import getargspec
+ # If it takes directory of kwargs and kwds does already have
+ # directory, inject it
+ if 'directory' not in kwds and 'directory' in getargspec(f)[0]:
+ kwds['directory'] = directory
+ return f(*args, **kwds)
+ decorated.__name__ = f.__name__
+ return decorated
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ros/catkin-pkg.git
More information about the debian-science-commits
mailing list