Skip to content

Commit

Permalink
Added if only posix
Browse files Browse the repository at this point in the history
  • Loading branch information
antohami committed May 29, 2017
1 parent c204dbf commit 638737b
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 13 deletions.
3 changes: 1 addition & 2 deletions yaplcconnectors/YAPLC/YAPLCObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# YAPLC connector, based on LPCObject.py and LPCAppObjet.py
# from PLCManager


import os
import sys

Expand Down Expand Up @@ -271,7 +270,7 @@ def __init__(self):
else:
lib_ext = ".so"

if (os.path.isfile("/usr/lib64/libYaPySerial.so")):
if (os.name=='posix' and os.path.isfile("/usr/lib64/libYaPySerial.so")):
TstLib = "/usr/lib64/libYaPySerial.so"
elif (os.path.isfile("/usr/lib/libYaPySerial.so")):
TstLib = "/usr/lib/libYaPySerial.so"
Expand Down
4 changes: 2 additions & 2 deletions yaplcconnectors/YAPLC/YaPySerial.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ def __del__(self):
else:
lib_ext = ".so"

if (os.path.isfile("/usr/lib64/libYaPySerial.so")):
if (os.name=='posix' and os.path.isfile("/usr/lib64/libYaPySerial.so")):
TestLib = "/usr/lib64/libYaPySerial.so"
elif (os.path.isfile("/usr/lib/libYaPySerial.so")):
elif (os.name=='posix' and os.path.isfile("/usr/lib/libYaPySerial.so")):
TestLib = "/usr/lib/libYaPySerial.so"
else:
TestLib = os.path.dirname(os.path.realpath(__file__)) + "/../../../YaPySerial/bin/libYaPySerial" + lib_ext
Expand Down
4 changes: 2 additions & 2 deletions yaplcconnectors/YAPLC/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def YAPLC_connector_factory(uri, confnodesroot):
else:
lib_ext = ".so"

if (os.path.isfile("/usr/lib64/libYaPySerial.so")):
if (os.name=='posix' and os.path.isfile("/usr/lib64/libYaPySerial.so")):
YaPySerialLib = "/usr/lib64/libYaPySerial.so"
elif (os.path.isfile("/usr/lib/libYaPySerial.so")):
elif (os.name=='posix' and os.path.isfile("/usr/lib/libYaPySerial.so")):
YaPySerialLib = "/usr/lib/libYaPySerial.so"
else:
YaPySerialLib = os.path.dirname(os.path.realpath(__file__)) + "/../../../YaPySerial/bin/libYaPySerial" + lib_ext
Expand Down
2 changes: 1 addition & 1 deletion yaplctargets/nuc242/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

target_dir = os.path.dirname(os.path.realpath(__file__))
base_dir = os.path.join(os.path.join(os.path.join(target_dir, ".."), ".."), "..")
if (os.path.isdir(os.environ["HOME"]+"/YAPLC/RTE")):
if (os.name=='posix' and os.path.isdir(os.environ["HOME"]+"/YAPLC/RTE")):
plc_rt_dir = os.environ["HOME"]+"/YAPLC/RTE"
else:
plc_rt_dir = os.path.join(os.path.join(base_dir, "RTE"), "src")
Expand Down
3 changes: 2 additions & 1 deletion yaplctargets/nuc243/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import platform
import os, sys
from yaplctargets.toolchain_yaplc_stm32 import toolchain_yaplc_stm32

target_dir = os.path.dirname(os.path.realpath(__file__))
base_dir = os.path.join(os.path.join(os.path.join(target_dir, ".."), ".."), "..")
if (os.path.isdir(os.environ["HOME"]+"/YAPLC/RTE")):
if (os.name=='posix' os.path.isdir(os.environ["HOME"]+"/YAPLC/RTE")):
plc_rt_dir = os.environ["HOME"]+"/YAPLC/RTE"
else:
plc_rt_dir = os.path.join(os.path.join(base_dir, "RTE"), "src")
Expand Down
2 changes: 1 addition & 1 deletion yaplctargets/nuc247/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

target_dir = os.path.dirname(os.path.realpath(__file__))
base_dir = os.path.join(os.path.join(os.path.join(target_dir, ".."), ".."), "..")
if (os.path.isdir(os.environ["HOME"]+"/YAPLC/RTE")):
if (os.name=='posix' and os.path.isdir(os.environ["HOME"]+"/YAPLC/RTE")):
plc_rt_dir = os.environ["HOME"]+"/YAPLC/RTE"
else:
plc_rt_dir = os.path.join(os.path.join(base_dir, "RTE"), "src")
Expand Down
2 changes: 1 addition & 1 deletion yaplctargets/nuc251/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

target_dir = os.path.dirname(os.path.realpath(__file__))
base_dir = os.path.join(os.path.join(os.path.join(target_dir, ".."), ".."), "..")
if (os.path.isdir(os.environ["HOME"]+"/YAPLC/RTE")):
if (os.name=='posix' and os.path.isdir(os.environ["HOME"]+"/YAPLC/RTE")):
plc_rt_dir = os.environ["HOME"]+"/YAPLC/RTE"
else:
plc_rt_dir = os.path.join(os.path.join(base_dir, "RTE"), "src")
Expand Down
2 changes: 1 addition & 1 deletion yaplctargets/toolchain_yaplc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

toolchain_dir = os.path.dirname(os.path.realpath(__file__))
base_dir = os.path.join(os.path.join(toolchain_dir, ".."), "..")
if (os.path.isdir(os.environ["HOME"]+"/YAPLC/RTE")):
if (os.name=='posix' and os.path.isdir(os.environ["HOME"]+"/YAPLC/RTE")):
runtime_dir = os.environ["HOME"]+"/YAPLC/RTE"
else:
runtime_dir = os.path.join(os.path.join(base_dir, "RTE"), "src")
Expand Down
3 changes: 2 additions & 1 deletion yaplctargets/toolchain_yaplc_stm32.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import platform
import os, sys
from toolchain_yaplc import toolchain_yaplc

Expand All @@ -8,7 +9,7 @@ class toolchain_yaplc_stm32(toolchain_yaplc):

def GetBinaryCode(self):
if os.path.exists(self.exe_path):
if (os.path.isfile("/usr/bin/stm32flash")):
if (os.name=='posix' and os.path.isfile("/usr/bin/stm32flash")):
yaplc_boot_loader = "/usr/bin/stm32flash"
else:
yaplc_boot_loader = os.path.join(os.path.join(base_dir, "stm32flash"), "stm32flash")
Expand Down
2 changes: 1 addition & 1 deletion yaplctargets/yaplc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

target_dir = os.path.dirname(os.path.realpath(__file__))
base_dir = os.path.join(os.path.join(os.path.join(target_dir, ".."), ".."), "..")
if (os.path.isdir(os.environ["HOME"]+"/YAPLC/RTE")):
if (os.name=='posix' and os.path.isdir(os.environ["HOME"]+"/YAPLC/RTE")):
plc_rt_dir = os.environ["HOME"]+"/YAPLC/RTE"
else:
plc_rt_dir = os.path.join(os.path.join(base_dir, "RTE"), "src")
Expand Down

0 comments on commit 638737b

Please sign in to comment.