Skip to content

Commit

Permalink
convert the moved scripts to entry points
Browse files Browse the repository at this point in the history
  • Loading branch information
dmerejkowsky authored and dirk-thomas committed Jul 11, 2016
1 parent a65d4d2 commit f7dcb41
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 43 deletions.
16 changes: 9 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
packages=['catkin_pkg'],
package_dir={'': 'src'},
package_data={'catkin_pkg': ['templates/*.in']},
scripts=[
'bin/catkin_create_pkg',
'bin/catkin_find_pkg',
'bin/catkin_generate_changelog',
'bin/catkin_tag_changelog',
'bin/catkin_test_changelog'
],
entry_points={
'console_scripts' : [
'catkin_create_pkg = catkin_pkg.cli.create_pkg:main',
'catkin_find_pkg = catkin_pkg.cli.find_pkg:main',
'catkin_generate_changelog = catkin_pkg.cli.generate_changelog:main_catching_runtime_error',
'catkin_tag_changelog = catkin_pkg.cli.tag_changelog:main',
'catkin_test_changelog = catkin_pkg.cli.test_changelog:main',
]
},
author='Dirk Thomas',
author_email='[email protected]',
url='http://wiki.ros.org/catkin_pkg',
Expand Down
Empty file added src/catkin_pkg/cli/__init__.py
Empty file.
6 changes: 0 additions & 6 deletions src/catkin_pkg/cli/create_pkg.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

"""This script creates the skeletton of a catkin package"""

from __future__ import print_function
Expand Down Expand Up @@ -69,7 +67,3 @@ def main(argv=sys.argv[1:], parent_path=os.getcwd()):
print('Successfully created files in %s. Please adjust the values in package.xml.' % target_path)
except ValueError as vae:
parser.error(str(vae))


if __name__ == '__main__':
main()
6 changes: 0 additions & 6 deletions src/catkin_pkg/cli/find_pkg.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

"""This script finds a catkin packages"""

from __future__ import print_function
Expand Down Expand Up @@ -28,7 +26,3 @@ def main(argv=sys.argv[1:]):
except RuntimeError as e:
print('ERROR: ' + str(e), file=sys.stderr)
sys.exit(1)


if __name__ == '__main__':
main()
6 changes: 2 additions & 4 deletions src/catkin_pkg/cli/generate_changelog.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

"""This script generates REP-0132 CHANGELOG.rst files for git or hg repositories"""

from __future__ import print_function
Expand Down Expand Up @@ -117,9 +115,9 @@ def main(sysargs=None):
print('Please review the extracted commit messages and consolidate the changelog entries before committing the files!')


if __name__ == '__main__':
def main_catching_runtime_error(*args, **kwargs):
try:
main()
main(*args, **kwargs)
except RuntimeError as e:
print('ERROR: ' + str(e), file=sys.stderr)
sys.exit(1)
10 changes: 0 additions & 10 deletions src/catkin_pkg/cli/tag_changelog.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

"""This script renames the forthcoming section in changelog files with the upcoming version and the current date"""

from __future__ import print_function
Expand Down Expand Up @@ -113,11 +111,3 @@ def main(sysargs=None):
for (changelog_path, data) in new_changelog_data:
with open(changelog_path, 'w') as f:
f.write(data)


if __name__ == '__main__':
try:
main()
except Exception as e:
print(e, file=sys.stderr)
sys.exit(1)
5 changes: 0 additions & 5 deletions src/catkin_pkg/cli/test_changelog.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

"""This script tests REP-0132 changelog files"""

from __future__ import print_function
Expand Down Expand Up @@ -46,6 +44,3 @@ def main(sysargs=None):
changelog = Changelog()
with open(changelog_file, 'r') as f:
print(populate_changelog_from_rst(changelog, f.read()))

if __name__ == '__main__':
sys.exit(main())
6 changes: 1 addition & 5 deletions test/test_catkin_create_pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@
raise ImportError(
'Please adjust your pythonpath before running this test: %s' % str(impe))

import imp
imp.load_source('catkin_create_pkg',
os.path.join(os.path.dirname(__file__),
'..', 'bin', 'catkin_create_pkg'))

from catkin_create_pkg import main
from catkin_pkg.cli.create_pkg import main


class CreatePkgTest(unittest.TestCase):
Expand Down

0 comments on commit f7dcb41

Please sign in to comment.