From 662068ef51ad61b0edf4cccfd2b730f0fa88341c Mon Sep 17 00:00:00 2001 From: Lou Amadio Date: Thu, 26 Jul 2018 14:36:43 -0700 Subject: [PATCH 1/4] Add console script entry point Add console script entry point for platforms (e.g. Windows) not supporting shebang. --- scripts/rosdep-source | 38 ++------------------------ setup.py | 7 ++++- src/rosdep2/install.py | 60 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 37 deletions(-) create mode 100644 src/rosdep2/install.py diff --git a/scripts/rosdep-source b/scripts/rosdep-source index 8b89e9762..0a8ef0924 100755 --- a/scripts/rosdep-source +++ b/scripts/rosdep-source @@ -26,39 +26,5 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -""" -Script for installing rdmanifest-described resources -""" - -from __future__ import print_function - -import os -import sys -from optparse import OptionParser - -from rosdep2 import InstallFailed -from rosdep2.platforms import source - -NAME='rosdep-source' - - -def install_main(): - parser = OptionParser(usage="usage: %prog install ", prog=NAME) - options, args = parser.parse_args() - if len(args) != 2: - parser.error("please specify one and only one rdmanifest url") - if args[0] != 'install': - parser.error("currently only support the 'install' command") - rdmanifest_url= args[1] - try: - if os.path.isfile(rdmanifest_url): - source.install_from_file(rdmanifest_url) - else: - source.install_from_url(rdmanifest_url) - except InstallFailed as e: - print("ERROR: installation failed:\n%s"%e, file=sys.stderr) - sys.exit(1) - - -if __name__ == '__main__': - install_main() +from rosdep2.install import install_main +install_main() diff --git a/setup.py b/setup.py index a718f3361..694fb9053 100644 --- a/setup.py +++ b/setup.py @@ -12,11 +12,16 @@ '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': 'tfoote@osrfoundation.org', 'url': 'http://wiki.ros.org/rosdep', 'keywords': ['ROS'], + 'entry_points'={ + 'console_scripts': [ + 'rosdep = rosdep2.main:rosdep_main', + 'rosdep-source = rosdep2.install:install_main' + ] + }, 'classifiers': [ 'Programming Language :: Python', 'License :: OSI Approved :: BSD License'], diff --git a/src/rosdep2/install.py b/src/rosdep2/install.py new file mode 100644 index 000000000..068085150 --- /dev/null +++ b/src/rosdep2/install.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# Copyright (c) 2011, 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. + +""" +Script for installing rdmanifest-described resources +""" + +from __future__ import print_function + +import os +import sys +from optparse import OptionParser + +from rosdep2 import InstallFailed +from rosdep2.platforms import source + +NAME = 'rosdep-source' + + +def install_main(): + parser = OptionParser(usage="usage: %prog install ", prog=NAME) + options, args = parser.parse_args() + if len(args) != 2: + parser.error("please specify one and only one rdmanifest url") + if args[0] != 'install': + parser.error("currently only support the 'install' command") + rdmanifest_url = args[1] + try: + if os.path.isfile(rdmanifest_url): + source.install_from_file(rdmanifest_url) + else: + source.install_from_url(rdmanifest_url) + except InstallFailed as e: + print("ERROR: installation failed:\n%s" % e, file=sys.stderr) + sys.exit(1) From f293e1d53541925585e6650370265a13b6bf2143 Mon Sep 17 00:00:00 2001 From: Sean Yen Date: Fri, 8 Feb 2019 11:44:22 -0800 Subject: [PATCH 2/4] remove scripts entry since we are using console_scripts. --- scripts/rosdep | 4 ---- scripts/rosdep-source | 30 ------------------------------ 2 files changed, 34 deletions(-) delete mode 100755 scripts/rosdep delete mode 100755 scripts/rosdep-source diff --git a/scripts/rosdep b/scripts/rosdep deleted file mode 100755 index a9284a830..000000000 --- a/scripts/rosdep +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env python - -from rosdep2.main import rosdep_main -rosdep_main() diff --git a/scripts/rosdep-source b/scripts/rosdep-source deleted file mode 100755 index 0a8ef0924..000000000 --- a/scripts/rosdep-source +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2011, 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. - -from rosdep2.install import install_main -install_main() From 5764d3e493b0701754c159d30f92617d3aafb667 Mon Sep 17 00:00:00 2001 From: seanyen Date: Mon, 13 Jan 2020 17:24:23 -0800 Subject: [PATCH 3/4] fix bad merge. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 694fb9053..7c1aa0bd0 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ 'author_email': 'tfoote@osrfoundation.org', 'url': 'http://wiki.ros.org/rosdep', 'keywords': ['ROS'], - 'entry_points'={ + 'entry_points': { 'console_scripts': [ 'rosdep = rosdep2.main:rosdep_main', 'rosdep-source = rosdep2.install:install_main' From ef8aaf49f5d9ad086b2c223fb2a1b9f8409839a3 Mon Sep 17 00:00:00 2001 From: seanyen Date: Mon, 10 Feb 2020 19:27:59 -0800 Subject: [PATCH 4/4] fix SKIP_PYTHON_SCRIPTS case. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7c1aa0bd0..ade50bef6 100644 --- a/setup.py +++ b/setup.py @@ -35,6 +35,6 @@ kwargs['package_dir'] = {} if 'SKIP_PYTHON_SCRIPTS' in os.environ: kwargs['name'] += '_modules' - kwargs['scripts'] = {} + kwargs['entry_points'] = {} setup(**kwargs)