summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-09-23 16:21:30 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-09-23 16:21:30 +0100
commitf9c02205608356b4c57611509b574e3874d243a9 (patch)
tree8fd0e561102a9956d295313e87916789c4c2fccc
parentb64bdc52c6158ae6aca62baaf68d8fb66687a37b (diff)
downloadmorph-f9c02205608356b4c57611509b574e3874d243a9.tar.gz
Initial python 3
Change-Id: Ie47cd287118ff5269274e0f1324371c96bbcf6c6
-rw-r--r--morphlib/artifactsplitrule.py9
-rw-r--r--morphlib/buildbranch.py7
2 files changed, 12 insertions, 4 deletions
diff --git a/morphlib/artifactsplitrule.py b/morphlib/artifactsplitrule.py
index b5ebdf83..8e3fc2c8 100644
--- a/morphlib/artifactsplitrule.py
+++ b/morphlib/artifactsplitrule.py
@@ -62,7 +62,8 @@ class ArtifactMatch(Rule):
# Possible optimisation: compile regexes as one pattern
self._regexes = [re.compile(r) for r in regexes]
- def match(self, (source_name, artifact_name)):
+ def match(self, pair):
+ source_name, artifact_name = pair
return any(r.match(artifact_name) for r in self._regexes)
def __repr__(self):
@@ -82,7 +83,8 @@ class ArtifactAssign(Rule):
def __init__(self, source_name, artifact_name):
self._key = (source_name, artifact_name)
- def match(self, (source_name, artifact_name)):
+ def match(self, pair):
+ source_name, artifact_name = pair
return (source_name, artifact_name) == self._key
def __repr__(self):
@@ -101,7 +103,8 @@ class SourceAssign(Rule):
def __init__(self, source_name):
self._source = source_name
- def match(self, (source_name, artifact_name)):
+ def match(self, pair):
+ source_name, artifact_name = pair
return source_name == self._source
def __repr__(self):
diff --git a/morphlib/buildbranch.py b/morphlib/buildbranch.py
index e16bf2b4..4c1baaa7 100644
--- a/morphlib/buildbranch.py
+++ b/morphlib/buildbranch.py
@@ -16,13 +16,18 @@
import collections
import contextlib
import os
-import urlparse
+import sys
import cliapp
import fs.tempfs
import morphlib
+if sys.version_info[0] == 2:
+ import urlparse
+else:
+ import urllib.parse as urlparse
+
class BuildBranchCleanupError(cliapp.AppException):
def __init__(self, bb, exceptions):