Skip to content

Commit da7d8c2

Browse files
committed
Add roslint.
1 parent 5340349 commit da7d8c2

File tree

5 files changed

+20
-13
lines changed

5 files changed

+20
-13
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
cmake_minimum_required(VERSION 2.8.3)
22
project(robot_upstart)
33

4-
find_package(catkin)
4+
find_package(catkin REQUIRED COMPONENTS roslint)
55

66
catkin_package()
77
catkin_python_setup()
88

9+
roslint_python()
10+
roslint_add_test()
11+
912
file(GLOB SCRIPTS scripts/*)
1013
install(PROGRAMS ${SCRIPTS} DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
1114
install(DIRECTORY templates DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<license>BSD</license>
1414

1515
<buildtool_depend>catkin</buildtool_depend>
16+
<build_depend>roslint</build_depend>
1617
<run_depend>daemontools</run_depend>
1718
<run_depend>roslaunch</run_depend>
1819
<run_depend>xacro</run_depend>

src/robot_upstart/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Software License Agreement (BSD)
1+
# Software License Agreement (BSD)
22
#
33
# @author Mike Purvis <[email protected]>
44
# @copyright (c) 2015, Clearpath Robotics, Inc., All rights reserved.

src/robot_upstart/job.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Software License Agreement (BSD)
1+
# Software License Agreement (BSD)
22
#
33
# @author Mike Purvis <[email protected]>
44
# @copyright (c) 2015, Clearpath Robotics, Inc., All rights reserved.
@@ -25,7 +25,10 @@
2525
This file defines the Job class, which is the primary code API to robot_upstart.
2626
"""
2727

28-
import getpass, os, pickle, subprocess
28+
import getpass
29+
import os
30+
import pickle
31+
import subprocess
2932
from glob import glob as glob_files
3033

3134
from catkin.find_in_workspaces import find_in_workspaces
@@ -36,8 +39,8 @@
3639
class Job(object):
3740
""" Represents a ROS configuration to launch on machine startup. """
3841

39-
def __init__(self, name="ros", interface=None, user=None, workspace_setup=None, \
40-
rosdistro=None, master_uri="http://127.0.0.1:11311", log_path="/tmp"):
42+
def __init__(self, name="ros", interface=None, user=None, workspace_setup=None,
43+
rosdistro=None, master_uri="http://127.0.0.1:11311", log_path="/tmp"):
4144
"""Construct a new Job definition.
4245
4346
:param name: Name of job to create. Defaults to "ros", but you might
@@ -75,7 +78,7 @@ def __init__(self, name="ros", interface=None, user=None, workspace_setup=None,
7578

7679
# Fall back on current workspace setup file if not explicitly specified.
7780
self.workspace_setup = workspace_setup or \
78-
os.environ['CMAKE_PREFIX_PATH'].split(':')[0] + '/setup.bash'
81+
os.environ['CMAKE_PREFIX_PATH'].split(':')[0] + '/setup.bash'
7982

8083
# Fall back on current distro if not otherwise specified.
8184
self.rosdistro = rosdistro or os.environ['ROS_DISTRO']
@@ -143,7 +146,8 @@ def install(self, root="/", sudo="/usr/bin/sudo", provider=providers.upstart):
143146
installation_files = provider(root, self)
144147

145148
create_files_exec = find_in_workspaces(project="robot_upstart",
146-
path="scripts/create_files", first_match_only=True)
149+
path="scripts/create_files",
150+
first_match_only=True)
147151
print "Preparing to install files to the following paths:"
148152
for filename in sorted(installation_files.keys()):
149153
print " %s" % filename
@@ -160,4 +164,3 @@ def install(self, root="/", sudo="/usr/bin/sudo", provider=providers.upstart):
160164
print "Installation of files succeeded."
161165
else:
162166
print "Error encountered installing files."
163-

src/robot_upstart/providers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Software License Agreement (BSD)
1+
# Software License Agreement (BSD)
22
#
33
# @author Mike Purvis <[email protected]>
44
# @copyright (c) 2015, Clearpath Robotics, Inc., All rights reserved.
@@ -43,17 +43,17 @@ def upstart(root, job):
4343
for filename in job.files:
4444
with open(filename) as f:
4545
dest_filename = os.path.join(job.job_path, os.path.basename(filename))
46-
installation_files[dest_filename] = { "content": f.read() }
46+
installation_files[dest_filename] = {"content": f.read()}
4747

4848
# Share a single instance of the empy interpreter. Because it is outputting
4949
# to a StringIO, that object needs to be truncated between templates.
5050
output = StringIO.StringIO()
5151
interpreter = em.Interpreter(output=output, globals=job.__dict__.copy())
52-
52+
5353
def do_template(template, output_file, chmod=644):
5454
with open(find_in_workspaces(project="robot_upstart", path=template)[0]) as f:
5555
interpreter.file(f)
56-
installation_files[output_file] = { "content": output.getvalue(), "chmod": chmod }
56+
installation_files[output_file] = {"content": output.getvalue(), "chmod": chmod}
5757
output.truncate(0)
5858

5959
do_template("templates/job.conf.em", os.path.join(root, "etc/init", job.name + ".conf"), 755)

0 commit comments

Comments
 (0)