[projects/pld-builder.new] Run thru pythons reindent.py

arekm arekm at pld-linux.org
Mon Nov 10 19:13:26 CET 2014


commit a72726342626fd452634ad5ab55cf7c1b82c302f
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Mon Nov 10 19:13:21 2014 +0100

    Run thru pythons reindent.py

 PLD_Builder/loop.py                   |   1 -
 PLD_Builder/mailer.py                 |   2 +-
 PLD_Builder/maintainer.py             |   1 -
 PLD_Builder/request_handler.py        |  16 +--
 PLD_Builder/request_handler_server.py | 183 +++++++++++++++++-----------------
 PLD_Builder/srpm_builder.py           |   4 +-
 client/smtpwrapper.py                 |   1 -
 7 files changed, 102 insertions(+), 106 deletions(-)
---
diff --git a/PLD_Builder/loop.py b/PLD_Builder/loop.py
index bc5be9a..5ec5306 100644
--- a/PLD_Builder/loop.py
+++ b/PLD_Builder/loop.py
@@ -28,4 +28,3 @@ def run_loop(fnc, secs = 5, max = 60):
         took = time.time() - last
         if took < secs:
             time.sleep(secs - took)
-
diff --git a/PLD_Builder/mailer.py b/PLD_Builder/mailer.py
index c7d8733..cbed042 100644
--- a/PLD_Builder/mailer.py
+++ b/PLD_Builder/mailer.py
@@ -34,7 +34,7 @@ class Message:
 
     def remove_header(self, n):
         if n in self.headers:
-          del self.headers[n]
+            del self.headers[n]
 
     def write_line(self, l):
         self.body.write(recode("%s\n" % l))
diff --git a/PLD_Builder/maintainer.py b/PLD_Builder/maintainer.py
index 0ef6608..5ba3deb 100644
--- a/PLD_Builder/maintainer.py
+++ b/PLD_Builder/maintainer.py
@@ -77,4 +77,3 @@ if __name__ == '__main__':
             continue
         else:
             handle_bin()
-
diff --git a/PLD_Builder/request_handler.py b/PLD_Builder/request_handler.py
index fc37e74..033cf39 100644
--- a/PLD_Builder/request_handler.py
+++ b/PLD_Builder/request_handler.py
@@ -62,7 +62,7 @@ def handle_group(r, user):
         if (user.change_requester and r.requester):
             user = acl.user_by_login(r.requester)
     except KeyError:
-            r.requester += '/' + user.get_login()
+        r.requester += '/' + user.get_login()
     else:
         r.requester = user.get_login()
         r.requester_email = user.mail_to()
@@ -125,18 +125,18 @@ def handle_group(r, user):
                     lockf.close()
                     return
             if not "test-build" in r.flags and not user.can_do("ready", bld, batch.branch):
-                   fail_mail("user %s is not allowed to send ready builds (ready:%s:%s)" \
-                        % (user.get_login(), bld, batch.branch))
-                   lockf.close()
-                   return
+                fail_mail("user %s is not allowed to send ready builds (ready:%s:%s)" \
+                     % (user.get_login(), bld, batch.branch))
+                lockf.close()
+                return
 
             pkg = batch.spec
             if pkg.endswith(".spec"):
                 pkg = pkg[:-5]
             if not "test-build" in r.flags and blacklist.package(pkg):
-                   fail_mail("package '%s' is blacklisted, only test-builds allowed" % pkg)
-                   lockf.close()
-                   return
+                fail_mail("package '%s' is blacklisted, only test-builds allowed" % pkg)
+                lockf.close()
+                return
 
     r.priority = user.check_priority(r.priority,config.builder)
     r.time = time.time()
diff --git a/PLD_Builder/request_handler_server.py b/PLD_Builder/request_handler_server.py
index d1a958e..ef48c6a 100644
--- a/PLD_Builder/request_handler_server.py
+++ b/PLD_Builder/request_handler_server.py
@@ -18,104 +18,103 @@ import path
 
 class MyHandler(BaseHTTPRequestHandler):
 
-	def do_GET(self):
-		self.send_error(401);
-
-	def do_POST(self):
-		global rootnode
-		filename = "(unknown)"
-		try:
-			length = int(self.headers.getheader('content-length'))
-			filename = self.headers.getheader('x-filename')
-			if not length or not filename:
-				log.error("request_handler_server: [%s]: 401 Unauthorized" % self.client_address[0])
-				self.send_error(401)
-				self.end_headers()
-				return
-
-			query = self.rfile.read(length)
-
-			if not request_handler.handle_request_main(query, filename = filename):
-				error = log.last_log();
-				log.error("request_handler_server: [%s]: handle_request_main(..., %s) failed" % (self.client_address[0], filename))
-				self.send_error(500, "%s: request failed. %s" % (filename, error))
-				self.end_headers()
-				return
-
-			self.send_response(200)
-			self.end_headers()
-
-		except Exception, e:
-			self.send_error(500, "%s: %s" % (filename, e))
-			self.end_headers()
-			log.error("request_handler_server: [%s]: exception: %s\n%s" % (self.client_address[0], e, traceback.format_exc()))
-			raise
-			pass
+    def do_GET(self):
+        self.send_error(401);
+
+    def do_POST(self):
+        global rootnode
+        filename = "(unknown)"
+        try:
+            length = int(self.headers.getheader('content-length'))
+            filename = self.headers.getheader('x-filename')
+            if not length or not filename:
+                log.error("request_handler_server: [%s]: 401 Unauthorized" % self.client_address[0])
+                self.send_error(401)
+                self.end_headers()
+                return
+
+            query = self.rfile.read(length)
+
+            if not request_handler.handle_request_main(query, filename = filename):
+                error = log.last_log();
+                log.error("request_handler_server: [%s]: handle_request_main(..., %s) failed" % (self.client_address[0], filename))
+                self.send_error(500, "%s: request failed. %s" % (filename, error))
+                self.end_headers()
+                return
+
+            self.send_response(200)
+            self.end_headers()
+
+        except Exception, e:
+            self.send_error(500, "%s: %s" % (filename, e))
+            self.end_headers()
+            log.error("request_handler_server: [%s]: exception: %s\n%s" % (self.client_address[0], e, traceback.format_exc()))
+            raise
+            pass
 
 def write_css():
-	css_src = os.path.join(os.path.dirname(__file__), 'style.css')
-	css_file = path.www_dir + "/style.css"
-	# skip if file exists and code is not newer
-	if os.path.exists(css_file) and os.stat(css_src).st_mtime < os.stat(css_file).st_mtime:
-		return
-
-	old_umask = os.umask(0022)
-	r = open(css_src, 'r')
-	f = open(css_file, "w")
-	f.write(r.read())
-	f.close()
-	r.close()
-	os.umask(old_umask)
+    css_src = os.path.join(os.path.dirname(__file__), 'style.css')
+    css_file = path.www_dir + "/style.css"
+    # skip if file exists and code is not newer
+    if os.path.exists(css_file) and os.stat(css_src).st_mtime < os.stat(css_file).st_mtime:
+        return
+
+    old_umask = os.umask(0022)
+    r = open(css_src, 'r')
+    f = open(css_file, "w")
+    f.write(r.read())
+    f.close()
+    r.close()
+    os.umask(old_umask)
 
 def write_js():
-	js_src = os.path.join(os.path.dirname(__file__), 'script.js')
-	js_file = path.www_dir + '/script.js'
-	# skip if file exists and code is not newer
-	if os.path.exists(js_file) and os.stat(js_src).st_mtime < os.stat(js_file).st_mtime:
-		return
-
-	old_umask = os.umask(0022)
-	r = open(js_src, 'r')
-	f = open(js_file, 'w')
-	f.write(r.read())
-	f.close()
-	r.close()
-	os.umask(old_umask)
+    js_src = os.path.join(os.path.dirname(__file__), 'script.js')
+    js_file = path.www_dir + '/script.js'
+    # skip if file exists and code is not newer
+    if os.path.exists(js_file) and os.stat(js_src).st_mtime < os.stat(js_file).st_mtime:
+        return
+
+    old_umask = os.umask(0022)
+    r = open(js_src, 'r')
+    f = open(js_file, 'w')
+    f.write(r.read())
+    f.close()
+    r.close()
+    os.umask(old_umask)
 
 def main(srv_ssl=False):
-	write_css();
-	write_js();
-	socket.setdefaulttimeout(30)
-	try:
-		init_conf()
-		host = ""
-		port = config.request_handler_server_port
-		if srv_ssl:
-			port = config.request_handler_server_ssl_port
-
-		try:
-			server = HTTPServer((host, port), MyHandler)
-			if srv_ssl:
-				server.socket = ssl.wrap_socket (server.socket,
-						keyfile = config.request_handler_server_ssl_key,
-						certfile = config.request_handler_server_ssl_cert,
-						ca_certs = "/etc/certs/ca-certificates.crt",
-						server_side=True)
-		except Exception, e:
-			log.notice("request_handler_server: can't start server on [%s:%d], ssl=%s: %s" % (host, port, str(srv_ssl), e))
-			print >> sys.stderr, "ERROR: Can't start server on [%s:%d], ssl=%s: %s" % (host, port, str(srv_ssl), e)
-			sys.exit(1)
-
-		log.notice('request_handler_server: started on [%s:%d], ssl=%s...' % (host, port, str(srv_ssl)))
-		server.serve_forever()
-	except KeyboardInterrupt:
-		log.notice('request_handler_server: ^C received, shutting down server')
-		server.socket.close()
+    write_css();
+    write_js();
+    socket.setdefaulttimeout(30)
+    try:
+        init_conf()
+        host = ""
+        port = config.request_handler_server_port
+        if srv_ssl:
+            port = config.request_handler_server_ssl_port
+
+        try:
+            server = HTTPServer((host, port), MyHandler)
+            if srv_ssl:
+                server.socket = ssl.wrap_socket (server.socket,
+                                keyfile = config.request_handler_server_ssl_key,
+                                certfile = config.request_handler_server_ssl_cert,
+                                ca_certs = "/etc/certs/ca-certificates.crt",
+                                server_side=True)
+        except Exception, e:
+            log.notice("request_handler_server: can't start server on [%s:%d], ssl=%s: %s" % (host, port, str(srv_ssl), e))
+            print >> sys.stderr, "ERROR: Can't start server on [%s:%d], ssl=%s: %s" % (host, port, str(srv_ssl), e)
+            sys.exit(1)
+
+        log.notice('request_handler_server: started on [%s:%d], ssl=%s...' % (host, port, str(srv_ssl)))
+        server.serve_forever()
+    except KeyboardInterrupt:
+        log.notice('request_handler_server: ^C received, shutting down server')
+        server.socket.close()
 
 if __name__ == '__main__':
-	srv_ssl = False
-	if len(sys.argv) == 2 and sys.argv[1] == "ssl":
-		srv_ssl = True
-
-	main(srv_ssl)
+    srv_ssl = False
+    if len(sys.argv) == 2 and sys.argv[1] == "ssl":
+        srv_ssl = True
 
+    main(srv_ssl)
diff --git a/PLD_Builder/srpm_builder.py b/PLD_Builder/srpm_builder.py
index 5fccf5e..f1467b6 100644
--- a/PLD_Builder/srpm_builder.py
+++ b/PLD_Builder/srpm_builder.py
@@ -100,9 +100,9 @@ def build_srpm(r, b):
     b.src_rpm = ""
     builder_opts = "-nu -nm --nodeps --http --define \'_pld_builder 1\'"
     if ("test-build" in r.flags):
-                    tag_test=""
+        tag_test=""
     else:
-                    tag_test=" -Tp %s -tt" % (config.tag_prefixes[0],)
+        tag_test=" -Tp %s -tt" % (config.tag_prefixes[0],)
     cmd = ("cd rpm/packages; nice -n %s ./builder %s -bs %s -r %s %s %s %s %s 2>&1" %
              (config.nice, builder_opts, b.bconds_string(), b.branch,
               tag_test, b.kernel_string(), b.defines_string(), b.spec))
diff --git a/client/smtpwrapper.py b/client/smtpwrapper.py
index ad4ff7b..deffb66 100755
--- a/client/smtpwrapper.py
+++ b/client/smtpwrapper.py
@@ -13,4 +13,3 @@ server = smtplib.SMTP(smtp_host)
 # server.set_debuglevel(1)
 server.sendmail("matkor at pld-linux.org","builder-ac at pld-linux.org", msg) # Adresses should be taken from .requestrc
 server.quit()
-
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/a72726342626fd452634ad5ab55cf7c1b82c302f



More information about the pld-cvs-commit mailing list