Commit d4aa732a authored by Petr Pacner's avatar Petr Pacner

another adjustments

parent 34d6cd9e
...@@ -33,7 +33,7 @@ from os.path import join ...@@ -33,7 +33,7 @@ from os.path import join
from subprocess import PIPE, Popen, CalledProcessError, getstatusoutput from subprocess import PIPE, Popen, CalledProcessError, getstatusoutput
commands_os = 'auto' commands_os = ''
set_of_commands = {} set_of_commands = {}
test = "" test = ""
...@@ -57,10 +57,16 @@ def set_commands_os(name): ...@@ -57,10 +57,16 @@ def set_commands_os(name):
if test == 'Windows' and status: if test == 'Windows' and status:
logging.info("windows version of commands") logging.info("windows version of commands")
set_of_commands = {"del" : "del /s /q /f", set_of_commands = {"del" : "del /s /q /f",
"rmdir": "rmdir /s /q",
"mkdir": "mkdir",
"copy": "copy",
"touch" : "type NUL >"} "touch" : "type NUL >"}
else: else:
logging.info("linux version of commands") logging.info("linux version of commands")
set_of_commands = {"del" : "rm -rf", set_of_commands = {"del" : "rm -rf",
"rmdir": "rmdir -rf",
"copy": "cp",
"mkdir": "mkdir -p",
"touch" : "touch"} "touch" : "touch"}
def run(command): def run(command):
...@@ -91,6 +97,7 @@ def tclpath(path): ...@@ -91,6 +97,7 @@ def tclpath(path):
def command_path(path): def command_path(path):
path_list = split(r'/|\\', path) path_list = split(r'/|\\', path)
logging.debug(f"joining path:{join(*path_list)}")
return join(*path_list) return join(*path_list)
def makefile_path(path): def makefile_path(path):
...@@ -105,7 +112,6 @@ def check_windows_tools(): ...@@ -105,7 +112,6 @@ def check_windows_tools():
"""Check if we are using windows version of synthesis/simulation tools""" """Check if we are using windows version of synthesis/simulation tools"""
return is_windows_python() return is_windows_python()
def check_windows_commands(): def check_windows_commands():
"""Check if we are using windows commands (del/type) and not a unix shell. """Check if we are using windows commands (del/type) and not a unix shell.
False on cygwin""" False on cygwin"""
...@@ -114,33 +120,21 @@ def check_windows_commands(): ...@@ -114,33 +120,21 @@ def check_windows_commands():
else: else:
return commands_os == 'windows' return commands_os == 'windows'
def del_command(): def del_command():
"""Get a string with the O.S. specific delete command""" """Get a string with the O.S. specific delete command"""
return set_of_commands["del"] return set_of_commands["del"]
def rmdir_command(): def rmdir_command():
"""Get a string with the O.S. specific remove directory command""" """Get a string with the O.S. specific remove directory command"""
if check_windows_commands(): return set_of_commands["rmdir"]
return "rmdir /s /q"
else:
return "rm -rf"
def copy_command(): def copy_command():
"""Get a string with the O.S. specific copy command""" """Get a string with the O.S. specific copy command"""
if check_windows_commands(): return set_of_commands["copy"]
return "copy"
else:
return "cp"
def mkdir_command(): def mkdir_command():
"""Get a string with the O.S. specific mkdir command""" """Get a string with the O.S. specific mkdir command"""
if check_windows_commands(): return set_of_commands["mkdir"]
return "mkdir"
else:
return "mkdir -p"
def touch_command(): def touch_command():
"""Get a string with the O.S. specific mkdir command""" """Get a string with the O.S. specific mkdir command"""
...@@ -159,10 +153,7 @@ def which(filename): ...@@ -159,10 +153,7 @@ def which(filename):
def makefile_slash_char(): def makefile_slash_char():
"""Return the OS specific path separator for use in makefile""" """Return the OS specific path separator for use in makefile"""
if check_windows_commands(): return os.sep
return "\\"
else:
return "/"
def architecture(): def architecture():
......
Markdown is supported
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