-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into pip_version
- Loading branch information
Showing
28 changed files
with
809 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,35 @@ | ||
import os | ||
from setuptools import setup | ||
|
||
exec(open(os.path.join(os.path.dirname(__file__), 'src', 'rosdep2', '_version.py')).read()) | ||
|
||
setup( | ||
name='rosdep', | ||
version=__version__, # noqa:F821 | ||
packages=['rosdep2', 'rosdep2.platforms'], | ||
package_dir={'': 'src'}, | ||
install_requires=['catkin_pkg >= 0.4.0', 'rospkg >= 1.1.8', 'rosdistro >= 0.7.0', 'PyYAML >= 3.1'], | ||
test_suite='nose.collector', | ||
test_requires=['mock', 'nose >= 1.0'], | ||
scripts=['scripts/rosdep', 'scripts/rosdep-source'], | ||
author='Tully Foote, Ken Conley', | ||
author_email='[email protected]', | ||
url='http://wiki.ros.org/rosdep', | ||
keywords=['ROS'], | ||
classifiers=[ | ||
kwargs = { | ||
'name': 'rosdep', | ||
# same version as in: | ||
# - src/rosdep2/__init__.py | ||
# - stdeb.cfg | ||
'version': '0.18.0', | ||
'packages': ['rosdep2', 'rosdep2.ament_packages', 'rosdep2.platforms'], | ||
'package_dir': {'': 'src'}, | ||
'install_requires': ['catkin_pkg >= 0.4.0', 'rospkg >= 1.1.10', 'rosdistro >= 0.7.5', 'PyYAML >= 3.1'], | ||
'test_suite': 'nose.collector', | ||
'test_requires': ['mock', 'nose >= 1.0'], | ||
'scripts': ['scripts/rosdep', 'scripts/rosdep-source'], | ||
'author': 'Tully Foote, Ken Conley', | ||
'author_email': '[email protected]', | ||
'url': 'http://wiki.ros.org/rosdep', | ||
'keywords': ['ROS'], | ||
'classifiers': [ | ||
'Programming Language :: Python', | ||
'License :: OSI Approved :: BSD License'], | ||
description='rosdep package manager abstraction tool for ROS', | ||
long_description='Command-line tool for installing system ' | ||
'dependencies on a variety of platforms.', | ||
license='BSD' | ||
) | ||
'description': 'rosdep package manager abstraction tool for ROS', | ||
'long_description': 'Command-line tool for installing system ' | ||
'dependencies on a variety of platforms.', | ||
'license': 'BSD', | ||
} | ||
if 'SKIP_PYTHON_MODULES' in os.environ: | ||
kwargs['packages'] = [] | ||
kwargs['package_dir'] = {} | ||
if 'SKIP_PYTHON_SCRIPTS' in os.environ: | ||
kwargs['name'] += '_modules' | ||
kwargs['scripts'] = {} | ||
|
||
setup(**kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
__version__ = '0.15.2' | ||
# same version as in: | ||
# - setup.py | ||
# - stdeb.cfg | ||
__version__ = '0.18.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Code within is folder is essentially copied directly from the `ament_package` repo, or more specificity the `ament_index_python` package. See original source here: | ||
|
||
https://github.com/ament/ament_index/tree/86f5a6712690830fe3e19752f70cfcdb00a3d223/ament_index_python/ament_index_python | ||
|
||
TODO: reconcile duplicate code via shared codebase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2015 Open Source Robotics Foundation, Inc. | ||
# | ||
# 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. | ||
|
||
from .constants import AMENT_PREFIX_PATH_ENV_VAR | ||
from .constants import RESOURCE_INDEX_SUBFOLDER | ||
from .packages import get_packages_with_prefixes | ||
from .resources import get_resources | ||
from .search_paths import get_search_paths | ||
|
||
__all__ = [ | ||
'get_packages_with_prefixes', | ||
'get_resources', | ||
'get_search_paths', | ||
'AMENT_PREFIX_PATH_ENV_VAR', | ||
'RESOURCE_INDEX_SUBFOLDER', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright 2015 Open Source Robotics Foundation, Inc. | ||
# | ||
# 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. | ||
|
||
|
||
RESOURCE_INDEX_SUBFOLDER = 'share/ament_index/resource_index' | ||
AMENT_PREFIX_PATH_ENV_VAR = 'AMENT_PREFIX_PATH' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2017 Open Source Robotics Foundation, Inc. | ||
# | ||
# 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 | ||
|
||
from .resources import get_resources | ||
|
||
|
||
def get_packages_with_prefixes(): | ||
""" | ||
Return a dict of package names to the prefixes in which they are found. | ||
:returns: dict of package names to their prefixes | ||
:rtype: dict | ||
""" | ||
return get_resources('packages') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright 2015 Open Source Robotics Foundation, Inc. | ||
# | ||
# 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 | ||
|
||
from .constants import RESOURCE_INDEX_SUBFOLDER | ||
|
||
from .search_paths import get_search_paths | ||
|
||
|
||
def get_resources(resource_type): | ||
""" | ||
Get the resource names of all resources of the specified type. | ||
:param resource_type: the type of the resource | ||
:type resource_type: str | ||
:returns: dict of resource names to the prefix path they are in | ||
:raises: :exc:`EnvironmentError` | ||
""" | ||
assert resource_type, 'The resource type must not be empty' | ||
resources = {} | ||
for path in get_search_paths(): | ||
resource_path = os.path.join(path, RESOURCE_INDEX_SUBFOLDER, resource_type) | ||
if os.path.isdir(resource_path): | ||
for resource in os.listdir(resource_path): | ||
# Ignore subdirectories, and anything starting with a dot | ||
if os.path.isdir(os.path.join(resource_path, resource)) \ | ||
or resource.startswith('.'): | ||
continue | ||
if resource not in resources: | ||
resources[resource] = path | ||
return resources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2015 Open Source Robotics Foundation, Inc. | ||
# | ||
# 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 | ||
|
||
from .constants import AMENT_PREFIX_PATH_ENV_VAR | ||
|
||
|
||
def get_search_paths(): | ||
""" | ||
Get the paths from the environment variable '{AMENT_PREFIX_PATH_ENV_VAR}'. | ||
:returns: list of paths | ||
:raises: :exc:`EnvironmentError` | ||
""".format(AMENT_PREFIX_PATH_ENV_VAR=AMENT_PREFIX_PATH_ENV_VAR) | ||
ament_prefix_path = os.environ.get(AMENT_PREFIX_PATH_ENV_VAR) | ||
if not ament_prefix_path: | ||
raise EnvironmentError( | ||
"Environment variable '{}' is not set or empty".format(AMENT_PREFIX_PATH_ENV_VAR)) | ||
|
||
paths = ament_prefix_path.split(os.pathsep) | ||
return [p for p in paths if p and os.path.exists(p)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# 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 the 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. | ||
|
||
import hashlib | ||
import os | ||
import tempfile | ||
|
||
from .core import CachePermissionError | ||
|
||
try: | ||
import cPickle as pickle | ||
except ImportError: | ||
import pickle | ||
|
||
PICKLE_CACHE_EXT = '.pickle' | ||
|
||
|
||
def compute_filename_hash(key_filenames): | ||
sha_hash = hashlib.sha1() | ||
if isinstance(key_filenames, list): | ||
for key in key_filenames: | ||
sha_hash.update(key.encode()) | ||
else: | ||
sha_hash.update(key_filenames.encode()) | ||
return sha_hash.hexdigest() | ||
|
||
|
||
def write_cache_file(source_cache_d, key_filenames, rosdep_data): | ||
""" | ||
:param source_cache_d: directory to write cache file to | ||
:param key_filenames: filename (or list of filenames) to be used in hashing | ||
:param rosdep_data: dictionary of data to serialize as YAML | ||
:returns: name of file where cache is stored | ||
:raises: :exc:`OSError` if cannot write to cache file/directory | ||
:raises: :exc:`IOError` if cannot write to cache file/directory | ||
""" | ||
if not os.path.exists(source_cache_d): | ||
os.makedirs(source_cache_d) | ||
key_hash = compute_filename_hash(key_filenames) | ||
filepath = os.path.join(source_cache_d, key_hash) | ||
try: | ||
write_atomic(filepath + PICKLE_CACHE_EXT, pickle.dumps(rosdep_data, 2), True) | ||
except OSError as e: | ||
raise CachePermissionError('Failed to write cache file: ' + str(e)) | ||
try: | ||
os.unlink(filepath) | ||
except OSError: | ||
pass | ||
return filepath | ||
|
||
|
||
def write_atomic(filepath, data, binary=False): | ||
# write data to new file | ||
fd, filepath_tmp = tempfile.mkstemp(prefix=os.path.basename(filepath) + '.tmp.', dir=os.path.dirname(filepath)) | ||
|
||
if (binary): | ||
fmode = 'wb' | ||
else: | ||
fmode = 'w' | ||
|
||
with os.fdopen(fd, fmode) as f: | ||
f.write(data) | ||
f.close() | ||
|
||
try: | ||
# switch file atomically (if supported) | ||
os.rename(filepath_tmp, filepath) | ||
except OSError: | ||
# fall back to non-atomic operation | ||
try: | ||
os.unlink(filepath) | ||
except OSError: | ||
pass | ||
try: | ||
os.rename(filepath_tmp, filepath) | ||
except OSError: | ||
os.unlink(filepath_tmp) |
Oops, something went wrong.