summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-03-10 11:31:45 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-03-10 11:31:45 +0000
commit444ba7c2f0f3d53753abeff6dfd33681279a3d84 (patch)
treeafdd012aa6d6001731e91dd863c9dbc45919d767 /morphlib
parent356e5f60268b154a5aa09b4fbcd716d908262b56 (diff)
parent2c4752d71d35ec31221dcdab1289d2084936ccae (diff)
downloadmorph-444ba7c2f0f3d53753abeff6dfd33681279a3d84.tar.gz
Merge branch 'liw/fix-check-2-rebase'
Reviewed-by: Daniel Silverstone Reviewed-by: Richard Maw
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/sysbranchdir.py10
-rw-r--r--morphlib/sysbranchdir_tests.py6
-rw-r--r--morphlib/workspace_tests.py4
3 files changed, 14 insertions, 6 deletions
diff --git a/morphlib/sysbranchdir.py b/morphlib/sysbranchdir.py
index 1a8b898a..9d96e974 100644
--- a/morphlib/sysbranchdir.py
+++ b/morphlib/sysbranchdir.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 Codethink Limited
+# Copyright (C) 2013-2014 Codethink Limited
#
# 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
@@ -74,6 +74,11 @@ class SystemBranchDirectory(object):
If the URL is a real one (not aliased), the schema and leading //
are removed from it, as is a .git suffix.
+ Any colons in the URL path or network location are replaced
+ with slashes, so that directory paths do not contain colons.
+ This avoids problems with PYTHONPATH, PATH, and other things
+ that use colon as a separator.
+
'''
# Parse the URL. If the path component is absolute, we assume
@@ -93,6 +98,9 @@ class SystemBranchDirectory(object):
else:
relative = repo_url
+ # Replace colons with slashes.
+ relative = '/'.join(relative.split(':'))
+
# Remove anyleading slashes, or os.path.join below will only
# use the relative part (since it's absolute, not relative).
relative = relative.lstrip('/')
diff --git a/morphlib/sysbranchdir_tests.py b/morphlib/sysbranchdir_tests.py
index 7ec8ef5c..8b40f69c 100644
--- a/morphlib/sysbranchdir_tests.py
+++ b/morphlib/sysbranchdir_tests.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 Codethink Limited
+# Copyright (C) 2013-2014 Codethink Limited
#
# 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
@@ -149,7 +149,7 @@ class SystemBranchDirectoryTests(unittest.TestCase):
self.system_branch_name)
self.assertEqual(
sb.get_git_directory_name('baserock:baserock/morph'),
- os.path.join(self.root_directory, 'baserock:baserock/morph'))
+ os.path.join(self.root_directory, 'baserock/baserock/morph'))
def test_reports_correct_name_for_git_directory_from_real_url(self):
stripped = 'git.baserock.org/baserock/baserock/morph'
@@ -169,7 +169,7 @@ class SystemBranchDirectoryTests(unittest.TestCase):
self.system_branch_name)
self.assertEqual(
sb.get_filename('test:chunk', 'foo'),
- os.path.join(self.root_directory, 'test:chunk/foo'))
+ os.path.join(self.root_directory, 'test/chunk/foo'))
def test_reports_correct_name_for_git_directory_from_file_url(self):
stripped = 'foobar/morphs'
diff --git a/morphlib/workspace_tests.py b/morphlib/workspace_tests.py
index b25be35e..9eef1053 100644
--- a/morphlib/workspace_tests.py
+++ b/morphlib/workspace_tests.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 Codethink Limited
+# Copyright (C) 2013-2014 Codethink Limited
#
# 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
@@ -97,7 +97,7 @@ class WorkspaceTests(unittest.TestCase):
url = 'test:morphs'
branch = 'my/new/thing'
sb = ws.create_system_branch_directory(url, branch)
- self.assertTrue(type(sb), morphlib.sysbranchdir.SystemBranchDirectory)
+ self.assertEqual(type(sb), morphlib.sysbranchdir.SystemBranchDirectory)
def test_lists_created_system_branches(self):
self.create_it()