Morpheus / Mbed OS mbed-Client-Morpheus-hg

Dependencies:   mbed-os

Revision:
72:08d69d476038
Parent:
69:eb600c35d6ac
Child:
73:f8ed8e727640
--- a/neo.py	Wed Mar 30 20:23:51 2016 -0500
+++ b/neo.py	Wed Mar 30 20:43:47 2016 -0500
@@ -51,7 +51,7 @@
     repo = Repo.fromrepo()
     if repo.scm is None:
         error("Current folder is not a repository", -1)
-    
+
 # Process execution
 class ProcessException(Exception):
     pass
@@ -83,6 +83,9 @@
     finally:
         os.chdir(prevdir)
 
+def relpath(root, path):
+    return path[len(root)+1:]
+
 # Handling for multiple version controls
 scms = OrderedDict()
 def scm(name):
@@ -342,7 +345,7 @@
     with cd(repo.path):
         for lib in repo.libs:
             import_(lib.url, lib.path)
-            repo.scm.ignore(lib.path[len(repo.path)+1:])
+            repo.scm.ignore(relpath(repo.path, lib.path))
 
         if (not os.path.isfile('mbed_settings.py') and 
             os.path.isfile('mbed-os/tools/settings.py')):
@@ -355,7 +358,7 @@
     repo = Repo.fromrepo()
     for lib in repo.libs:
         import_(lib.url, lib.path)
-        repo.scm.ignore(lib.path[len(repo.path)+1:])
+        repo.scm.ignore(relpath(repo.path, lib.path))
 
 # Install/uninstall command
 @subcommand('add', 'url', 'name?',
@@ -365,7 +368,7 @@
 
     lib = Repo.fromurl(url, path)
     import_(lib.url, lib.path)
-    repo.scm.ignore(lib.path[len(repo.path)+1:])
+    repo.scm.ignore(relpath(repo.path, lib.path))
     lib.synch()
 
     lib.write()
@@ -379,7 +382,7 @@
 
     repo.scm.remove(lib.lib)
     shutil.rmtree(lib.path)
-    repo.scm.unignore(lib.path[len(repo.path)+1:])
+    repo.scm.unignore(relpath(repo.path, lib.path))
 
 # Publish command
 @subcommand('publish',
@@ -422,7 +425,7 @@
                         % (lib.name, lib.path), 1)
 
             shutil.rmtree(lib.path)
-            repo.scm.unignore(lib.path[len(repo.path)+1:])
+            repo.scm.unignore(relpath(repo.path, lib.path))
 
     repo.synch()
 
@@ -432,7 +435,7 @@
                 update(lib.hash)
         else:
             import_(lib.url, lib.path)
-            repo.scm.ignore(lib.path[len(repo.path)+1:])
+            repo.scm.ignore(relpath(repo.path, lib.path))
 
 # Synch command
 @subcommand('synch',