[gnoduino] allow compilation on missing sketch filename



commit 8b92cfdd16d865d82d6dbb814b64d4c7e454546e
Author: Lucian Langa <lucilanga gnome org>
Date:   Mon Oct 20 22:47:44 2014 +0200

    allow compilation on missing sketch filename

 src/compiler.py |    5 +++--
 src/preproc.py  |   34 ++++++++++++++++++----------------
 2 files changed, 21 insertions(+), 18 deletions(-)
---
diff --git a/src/compiler.py b/src/compiler.py
index d795555..c1b80ac 100644
--- a/src/compiler.py
+++ b/src/compiler.py
@@ -343,8 +343,9 @@ def validateLib(library, tempobj, flags, output, notify):
        paths = ["", misc.getArduinoLibsPath(), misc.getLocalPath()]
        if config.user_library != None and config.user_library != -1:
                paths.extend(i.strip() for i in config.user_library.split(';'))
-       paths.append(os.path.dirname(config.sketchFile))
-       paths.append(os.path.abspath(os.path.join(os.path.dirname(config.sketchFile), "..")))
+       if config.sketchFile:
+               paths.append(os.path.dirname(config.sketchFile))
+               paths.append(os.path.abspath(os.path.join(os.path.dirname(config.sketchFile), "..")))
        dirs = ["", "utility"]
        b = board.Board()
        res = []
diff --git a/src/preproc.py b/src/preproc.py
index 148f683..fd47641 100644
--- a/src/preproc.py
+++ b/src/preproc.py
@@ -95,22 +95,24 @@ def findIncludes(instr, local=False):
                                os.path.exists(z.strip(".h").upper())):
                        my.append(z.strip(".h"))
 
-               sketchPath = os.path.dirname(config.sketchFile)
-               "is this really required"
-               if local and os.path.exists(sketchPath):
-                       my.append(sketchPath)
-
-               sp = os.path.join(sketchPath, z.strip(".h"))
-               if local and os.path.exists(sp):
-                       my.append(sp)
-
-               sp = os.path.abspath(os.path.join(sketchPath, ".."))
-               if local and os.path.exists(sp):
-                       my.append(sp)
-
-               sp = os.path.abspath(os.path.join(sketchPath, "..", z.strip(".h")))
-               if local and os.path.exists(sp):
-                       my.append(sp)
+               if config.sketchFile:
+                       sketchPath = os.path.dirname(config.sketchFile)
+                       "is this really required"
+                       if local and os.path.exists(sketchPath):
+                               my.append(sketchPath)
+
+                       sp = os.path.join(sketchPath, z.strip(".h"))
+                       if local and os.path.exists(sp):
+                               my.append(sp)
+
+                       sp = os.path.abspath(os.path.join(sketchPath, ".."))
+                       if local and os.path.exists(sp):
+                               my.append(sp)
+
+                       sp = os.path.abspath(os.path.join(sketchPath, "..", z.strip(".h")))
+                       if local and os.path.exists(sp):
+                               my.append(sp)
+
 
        for z in l:
                for r, d, f in os.walk(misc.getArduinoLibsPath()):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]