Fix setup.py script to allow calling it from different localizations 51/23751/1
authorPawel Broda <p.broda@partner.samsung.com>
Wed, 9 Apr 2014 13:34:24 +0000 (15:34 +0200)
committerLukasz Kostyra <l.kostyra@samsung.com>
Wed, 2 Jul 2014 09:53:51 +0000 (11:53 +0200)
[Bug/Feature]   N/A
[Cause]         it was possible to call setup.py script only
                from the dir where it was placed.
[Solution]      modify setup.py script.
[Verification]  run script setup.py from few different
                localizations (even on your host PC).

Change-Id: If23bc006e6169bf06c721303f37314101794599e
Signed-off-by: Lukasz Kostyra <l.kostyra@samsung.com>
image_creator/input/domains/host/scripts/setup.py

index 6308ba3..7d71d89 100644 (file)
@@ -20,15 +20,16 @@ cwd = os.path.dirname(os.path.abspath(__file__))
 
 noScriptFound = True
 for dirEntry in sorted(os.listdir(cwd)):
-    if os.path.isfile(dirEntry):
+    fullDirEntry = os.path.join(cwd, dirEntry)
+    if os.path.isfile(fullDirEntry):
         if dirEntry != scriptName:
-            fileName, fileExtension = os.path.splitext(dirEntry)
+            fileExtension = os.path.splitext(fullDirEntry)[1]
             if fileExtension == '.py':
                 noScriptFound = False
-                subprocess.call(["python", dirEntry])
+                subprocess.call(['python', fullDirEntry])
             elif fileExtension == '.sh':
                 noScriptFound = False
-                subprocess.call(["sh", dirEntry])
+                subprocess.call(['sh', fullDirEntry])
 
 if noScriptFound == True:
     print 'no scripts found...'