Morpheus / Mbed OS mbed-Client-Morpheus-hg

Dependencies:   mbed-os

Revision:
37:bf73ffd98cca
Parent:
36:5f4546dde73b
Child:
38:0ca5eea23af9
--- a/neo.py	Wed Mar 30 12:58:34 2016 -0500
+++ b/neo.py	Wed Mar 30 13:12:06 2016 -0500
@@ -166,6 +166,9 @@
             self.hash = self.gethash()
             self.libs = list(self.getlibs())
 
+        if os.path.isfile(self.lib):
+            self.repo = self.getrepo()
+
     def getscm(self):
         for name, scm in scms.items():
             if os.path.isdir(os.path.join(self.path, '.'+name)):
@@ -184,6 +187,10 @@
                 if file.endswith('.lib'):
                     yield Repo.fromlib(os.path.join(root, file))
 
+    def getrepo(self):
+        with open(self.lib) as f:
+            return Repo.fromurl(f.read()).repo
+
     def write(self):
         print repo.name, '->', repo.url
 
@@ -278,10 +285,11 @@
     repo.scm.pull(ref)
 
     for lib in repo.libs:
-        if not os.path.isfile(lib.lib):
+        if (not os.path.isfile(lib.lib) or
+            lib.repo != Repo.fromrepo(lib.path).repo):
             with cd(lib.path):
                 if lib.cwd.dirty():
-                    sys.stderr.write('Uncommitted changes in %s (%s)'
+                    sys.stderr.write('Uncommitted changes in %s (%s)\n'
                         % (lib.name, lib.path))
                     sys.exit(1)
 
@@ -312,7 +320,7 @@
     repo = Repo.fromrepo()
 
     if not os.path.isdir('mbed-os'):
-        sys.stderr.write('Warning! mbed-os not found?')
+        sys.stderr.write('Warning! mbed-os not found?\n')
         sys.exit(-1)
 
     macros = []
@@ -336,7 +344,7 @@
     repo = Repo.fromrepo()
 
     if not os.path.isdir('mbed-os'):
-        sys.stderr.write('Warning! mbed-os not found?')
+        sys.stderr.write('Warning! mbed-os not found?\n')
         sys.exit(-1)
 
     env = os.environ.copy()