Commit 35f84553 authored by Benoit Formet's avatar Benoit Formet Committed by Matias Guijarro
Browse files

various fixes for windows compatibility

parent 098c0aa4
......@@ -190,6 +190,10 @@ class Session:
os.path.dirname(self.__setup_file), "scripts"
)
# convert windows-style path to linux-style
if self.__scripts_module_path:
self.__scripts_module_path = self._scripts_module_path.replace("\\", "/")
try:
self.__synoptic_file = config_tree.get("synoptic").get("svg-file")
except AttributeError:
......
......@@ -418,7 +418,7 @@ class Connection(object):
if address is None:
address = self.get_redis_connection_address()
host, port = address
if host == "localhost":
if host == "localhost" and os.name != "nt":
return redis.Redis(unix_socket_path=port, db=db)
return redis.Redis(host=host, port=port, db=db)
......@@ -666,7 +666,7 @@ class Connection(object):
if queue is not None:
queue.put(StopIteration)
elif messageType == protocol.REDIS_QUERY_ANSWER:
host, port = message.split(b":")
host, port = message.split(b":", 1)
self._redis_host = host.decode()
self._redis_port = port.decode()
self._redis_query_event.set()
......
......@@ -947,7 +947,11 @@ def main(args=None):
log_server_rp = log_server_process = None
# Logviewer Web application
if _options.log_server_port and _options.log_viewer_port > 0:
if (
sys.platform not in ["win32", "cygwin"]
and _options.log_server_port
and _options.log_viewer_port > 0
):
log_viewer_rp, log_viewer_wp = os.pipe()
args = ["tailon"]
args += ["-b", f"0.0.0.0:{_options.log_viewer_port}"]
......
......@@ -765,7 +765,11 @@ class Config:
def _get_or_create_path_node(self, base_path):
node = self._root_node
sp_path = base_path.split(os.path.sep)
if "/" in base_path:
sp_path = base_path.split("/") # beacon server runs on linux
else:
sp_path = base_path.split("\\") # beacon server runs on windows
if sp_path[-1].startswith("@"):
sp_path.pop()
......
......@@ -12,7 +12,6 @@ import time
import datetime
import numpy
import operator
import termios
import shutil
import signal
import atexit
......@@ -35,6 +34,7 @@ from bliss.scanning.chain import ChainPreset, ChainIterationPreset
if sys.platform not in ["win32", "cygwin"]:
import termios
from blessings import Terminal
else:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment