aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/util.py')
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/util.py86
1 files changed, 0 insertions, 86 deletions
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/util.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/util.py
deleted file mode 100644
index 26aba0ad..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/util.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# This file is part of Buildbot. Buildbot 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, version 2.
-#
-# 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, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Copyright Buildbot Team Members
-
-import types
-import time
-
-def remove_userpassword(url):
- if '@' not in url:
- return url
- if '://' not in url:
- return url
-
- # urlparse would've been nice, but doesn't support ssh... sigh
- protocol_url = url.split('://')
- protocol = protocol_url[0]
- repo_url = protocol_url[1].split('@')[-1]
-
- return protocol + '://' + repo_url
-
-
-def now(_reactor=None):
- if _reactor and hasattr(_reactor, "seconds"):
- return _reactor.seconds()
- else:
- return time.time()
-
-class Obfuscated:
- """An obfuscated string in a command"""
- def __init__(self, real, fake):
- self.real = real
- self.fake = fake
-
- def __str__(self):
- return self.fake
-
- def __repr__(self):
- return `self.fake`
-
- def __eq__(self, other):
- return other.__class__ is self.__class__ and \
- other.real == self.real and \
- other.fake == self.fake
-
- @staticmethod
- def to_text(s):
- if isinstance(s, (str, unicode)):
- return s
- else:
- return str(s)
-
- @staticmethod
- def get_real(command):
- rv = command
- if type(command) == types.ListType:
- rv = []
- for elt in command:
- if isinstance(elt, Obfuscated):
- rv.append(elt.real)
- else:
- rv.append(Obfuscated.to_text(elt))
- return rv
-
- @staticmethod
- def get_fake(command):
- rv = command
- if type(command) == types.ListType:
- rv = []
- for elt in command:
- if isinstance(elt, Obfuscated):
- rv.append(elt.fake)
- else:
- rv.append(Obfuscated.to_text(elt))
- return rv
-