From 20f507162ccda864957d1aa81d450d369cbdb170 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 13 Jun 2013 08:14:19 +0100 Subject: Remove trailing whitespace from lines --- README | 4 ++-- check | 6 +++--- fetch | 2 +- publish-docs | 2 +- simplejenkinsapi/__init__.py | 6 +++--- simplejenkinsapi/api.py | 44 ++++++++++++++++++++--------------------- simplejenkinsapi/api_tests.py | 26 ++++++++++++------------ simplejenkinsapi/jobconfig.py | 16 +++++++-------- simplejenkinsapi/order.py | 10 +++++----- simplejenkinsapi/order_tests.py | 12 +++++------ vm-create | 6 +++--- vm-data/worker.customize | 8 ++++---- 12 files changed, 71 insertions(+), 71 deletions(-) diff --git a/README b/README index 55b0d40..a61ca26 100644 --- a/README +++ b/README @@ -14,10 +14,10 @@ as possible. Thus, after I push changes to `cliapp`, the test suites for all the other projects should be run. I create Debian packages of most of my projects, and I want that to be -done as automatically as possible. The Debian packaging toolset is +done as automatically as possible. The Debian packaging toolset is powerful, but it takes a bit of effort to set everything up just right, especially since I need to build my packages in multiple environments: -32-bit and 64-bit Intel architectures, and for at least two and possibly +32-bit and 64-bit Intel architectures, and for at least two and possibly three releases of Debian. But some packages should be built in only some environments, so it's not all identical, either. diff --git a/check b/check index a769679..485b9fb 100755 --- a/check +++ b/check @@ -1,17 +1,17 @@ # check -- run automatic build-time tests for jenkinstool # # Copyright 2012 Lars Wirzenius -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . diff --git a/fetch b/fetch index 65f9be2..b8967e3 100755 --- a/fetch +++ b/fetch @@ -9,7 +9,7 @@ repourl="http://jenkins/jenkins/debian" case "$package" in lib?*) - subdir=$(echo "$package" | cut -c1-4) + subdir=$(echo "$package" | cut -c1-4) ;; *) subdir=$(echo "$package" | cut -c1) diff --git a/publish-docs b/publish-docs index ab0622a..dc39eb3 100755 --- a/publish-docs +++ b/publish-docs @@ -6,7 +6,7 @@ build_docs() { local srcdir="$1" local log="$(mktemp)" - + set -eu cd "$srcdir"/doc if make dirhtml > "$log" 2>&1 diff --git a/simplejenkinsapi/__init__.py b/simplejenkinsapi/__init__.py index be54511..8974ed0 100644 --- a/simplejenkinsapi/__init__.py +++ b/simplejenkinsapi/__init__.py @@ -1,17 +1,17 @@ # simplejenkinsapi/__init__.py # # Copyright 2012 Lars Wirzenius -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . diff --git a/simplejenkinsapi/api.py b/simplejenkinsapi/api.py index 2c43396..9c6c66b 100644 --- a/simplejenkinsapi/api.py +++ b/simplejenkinsapi/api.py @@ -1,17 +1,17 @@ # simplejenkinsapi/api.py -- simple job management in Jenkins # # Copyright 2012 Lars Wirzenius -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . @@ -33,13 +33,13 @@ import urlparse class Jenkins(object): '''Access a running Jenkins server.''' - + def __init__(self, url): # pragma: no cover self._url = url - + def _connect(self): # pragma: no cover '''Connect to HTTP server, return httplib.HTTPConnection.''' - (scheme, netloc, path, params, query, + (scheme, netloc, path, params, query, fragment) = urlparse.urlparse(self._url) assert path == '/' assert params == '' @@ -56,19 +56,19 @@ class Jenkins(object): return httplib.HTTPSConnection(host, port) else: return httplib.HTTPConnection(host, port) - + def _do(self, method, path, body='', headers={}): '''Make an HTTP request, return result. - + If server returned JSON, return it as a Python object. Otherwise, return as string. - + ''' - logging.debug('HTTP method: %s' % repr(method)) - logging.debug('HTTP path: %s' % repr(path)) - logging.debug('HTTP body: %s' % repr(body)) - logging.debug('HTTP headers: %s' % repr(headers)) + logging.debug('HTTP method: %s' % repr(method)) + logging.debug('HTTP path: %s' % repr(path)) + logging.debug('HTTP body: %s' % repr(body)) + logging.debug('HTTP headers: %s' % repr(headers)) conn = self._connect() conn.request(method, path, body, headers) resp = conn.getresponse() @@ -88,7 +88,7 @@ class Jenkins(object): return json.loads(text) else: return text - + def list_jobs(self): '''Return list of job ids on the server.''' @@ -103,10 +103,10 @@ class Jenkins(object): def create_job(self, job_id, config_xml): '''Create a new job. - - ``config_xml`` is a string containing the XML format configuration + + ``config_xml`` is a string containing the XML format configuration of the job. - + ''' self._do('POST', '/createItem?name=%s' % job_id, body=config_xml, @@ -114,18 +114,18 @@ class Jenkins(object): def update_job(self, job_id, config_xml): '''Update the configuration of a new job. - - ``config_xml`` is a string containing the XML format configuration + + ``config_xml`` is a string containing the XML format configuration of the job. - + ''' - + self._do('POST', '/job/%s/config.xml' % job_id, body=config_xml, headers={ 'Content-Type': 'text/xml' }) def get_job_config(self, job_id): '''Return the XML configuration of a job.''' - + return self._do('GET', '/job/%s/config.xml' % job_id) def run_job(self, job_id): # pragma: no cover diff --git a/simplejenkinsapi/api_tests.py b/simplejenkinsapi/api_tests.py index 6e7c943..6c04c53 100644 --- a/simplejenkinsapi/api_tests.py +++ b/simplejenkinsapi/api_tests.py @@ -1,17 +1,17 @@ # simplejenkinsapi/api_tests.py -- unit test for simplejenkinsapi/api.py # # Copyright 2012 Lars Wirzenius -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . @@ -31,13 +31,13 @@ class DummyResponse(object): self.reason = 'yeah yeah' self.body = body self.content_type = content_type - + def getheader(self, header): if header == 'Content-Type': return self.content_type else: return '' - + def read(self): return self.body @@ -53,7 +53,7 @@ class DummyServer(object): self.add_route('POST', '/job/job-1/config.xml', self.update_job_1) self.jobs = {} - + self.response = None def add_route(self, method, path, callback): @@ -95,7 +95,7 @@ class DummyServer(object): key = (method, path) assert key in self.routes self.response, self.response_type = self.routes[key](body, headers) - + def getresponse(self): return DummyResponse(self.response, self.response_type) @@ -105,26 +105,26 @@ class JenkinsTests(unittest.TestCase): def setUp(self): self.url = 'http://does.not.exist:8080/' self.jenkins = simplejenkinsapi.Jenkins(self.url) - + self.dummy_server = DummyServer() self.jenkins._connect = lambda: self.dummy_server - + self.config_xml = ''' ''' - + self.config_xml_2 = ''' ''' - + def test_lists_no_jobs_when_there_are_none(self): self.assertEqual(self.jenkins.list_jobs(), []) - + def test_lists_single_job_when_one_exists(self): self.dummy_server.jobs = { 'job-1': '' } self.assertEqual(self.jenkins.list_jobs(), ['job-1']) @@ -142,6 +142,6 @@ class JenkinsTests(unittest.TestCase): def test_updates_job(self): self.jenkins.create_job('job-1', self.config_xml) self.jenkins.update_job('job-1', self.config_xml_2) - self.assertEqual(self.jenkins.get_job_config('job-1'), + self.assertEqual(self.jenkins.get_job_config('job-1'), self.config_xml_2) diff --git a/simplejenkinsapi/jobconfig.py b/simplejenkinsapi/jobconfig.py index f49c0b2..0e7a38d 100644 --- a/simplejenkinsapi/jobconfig.py +++ b/simplejenkinsapi/jobconfig.py @@ -1,17 +1,17 @@ # jobconfig.py -- create Jenkins job config.xml files # # Copyright 2012 Lars Wirzenius -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . @@ -44,10 +44,10 @@ empty = '''\ class JobConfig(object): '''Create a Jenkins job configuration XML file. - + This does not try to be complete, and only tries to do the minimal things I need for my automated job creation needs. - + ''' def __init__(self): @@ -60,7 +60,7 @@ class JobConfig(object): def add_param_dict(self, prefix, param_dict): self._param_dicts.append((prefix, param_dict)) - + def _get_params(self): unified = {} for prefix, param_dict in self._param_dicts: @@ -70,9 +70,9 @@ class JobConfig(object): def job_id(self): '''Create a unique job id from constituent parts. - + Escape characters that Jenkins gets upset by, such as '@'. - + ''' def esc(s): diff --git a/simplejenkinsapi/order.py b/simplejenkinsapi/order.py index 02fdf14..bf4212d 100644 --- a/simplejenkinsapi/order.py +++ b/simplejenkinsapi/order.py @@ -1,17 +1,17 @@ # order.py -- order projects in dependency order # # Copyright 2012 Lars Wirzenius -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . @@ -22,11 +22,11 @@ def _traverse(project, result): if project not in result: result.append(project) return result - + def _roots(projects): '''Return list of projects that are not build dependencies of anyone.''' - + roots = projects[:] for project in projects: roots = [r for r in roots if r not in project['_']] diff --git a/simplejenkinsapi/order_tests.py b/simplejenkinsapi/order_tests.py index 7fef992..1eed6da 100644 --- a/simplejenkinsapi/order_tests.py +++ b/simplejenkinsapi/order_tests.py @@ -1,17 +1,17 @@ # simplejenkinsapi/order_tests.py -- unit tests for build ordering # # Copyright 2012 Lars Wirzenius -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . @@ -23,8 +23,8 @@ from simplejenkinsapi import order def _names(projects): return [p['name'] for p in projects] - - + + class OrderTests(unittest.TestCase): def setUp(self): @@ -66,6 +66,6 @@ class OrderTests(unittest.TestCase): self.B['build-depends'] = ['D'] self.C['build-depends'] = ['D'] ps = [self.A, self.B, self.C, self.D] - self.assertEqual(_names(order(ps)), + self.assertEqual(_names(order(ps)), _names([self.D, self.B, self.C, self.A])) diff --git a/vm-create b/vm-create index 17db719..994120f 100755 --- a/vm-create +++ b/vm-create @@ -3,17 +3,17 @@ # vm-create - create VM images to run Jenkins and workers # # Copyright 2012, 2013 Lars Wirzenius -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . diff --git a/vm-data/worker.customize b/vm-data/worker.customize index 8337dbf..7127bf4 100755 --- a/vm-data/worker.customize +++ b/vm-data/worker.customize @@ -3,17 +3,17 @@ # vm-data/worker.customize - customize disk image for jenkins worker node # # Copyright 2012 Lars Wirzenius -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . @@ -50,7 +50,7 @@ install -m 0644 vm-data/worker.user-key.pub \ cat vm-data/jenkins.user-key.pub vm-data/worker.user-key.pub \ > "$rootdir/var/lib/jenkins/.ssh/authorized_keys" chmod 0600 "$rootdir/var/lib/jenkins/.ssh/authorized_keys" - + # Disable ssh host key checking. echo "StrictHostKeyChecking no" >> "$rootdir/etc/ssh/ssh_config" -- cgit v1.2.1