Morpheus / Mbed OS mbed-Client-Morpheus-hg

Dependencies:   mbed-os

Revision:
18:1b4252106474
Parent:
17:1e487c450f06
Child:
19:6ace1080b8bb
--- a/neo.py	Wed Mar 30 02:29:18 2016 -0500
+++ b/neo.py	Wed Mar 30 02:41:05 2016 -0500
@@ -207,13 +207,13 @@
 # Publish command
 @subcommand('publish',
     help='recursively publish changes to remote repositories')
-def publish():
+def publish(always=True):
     cwd = Repo()
 
     for url, lib in iterlibs():
         if os.path.isdir(lib):
             with cd(lib):
-                publish()
+                publish(False)
 
     synch()
 
@@ -228,7 +228,12 @@
         raw_input('Press enter to commit/push')
 
         popen([cwd.type, 'commit'] + (['-a'] if cwd.type == 'git' else []))
-        popen([cwd.type, 'push'] + (['-a'] if cwd.type == 'git' else []))
+
+    if modified or always:
+        try:
+            popen([cwd.type, 'push'] + (['-a'] if cwd.type == 'git' else []))
+        except ProcessException as e:
+            sys.exit(e[0])
 
 # Synch command
 @subcommand('synch',
@@ -286,9 +291,12 @@
     if not os.path.isfile('mbed_settings.py'):
         shutil.copy('mbed-os/tools/settings.py', 'mbed_settings.py')
 
+    env = os.environ.copy()
+    env['PYTHONPATH'] = '.'
     popen(['python', 'mbed-os/tools/project.py',
            '--source=%s' % cwd.path]
-        + args)
+        + args,
+        env=env)
 
 # Parse/run command
 args, remainder = parser.parse_known_args()