Skip to content

Commit

Permalink
windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
joknarf committed Jun 24, 2024
1 parent 62040b5 commit 73aa955
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ maintainers = [
]

description = "Interactive Parallel SSH jobs manager"
dependencies = ["colorama","dataclasses>=0.6; python_version < '3.7'"]
dependencies = [
"colorama",
"dataclasses>=0.6; python_version < '3.7'",
"windows-curses>=2.3.3; platform_system == 'Windows'",
]
dynamic=["version"]
readme = "README.md"
license = {file = "LICENSE"}
Expand Down
16 changes: 11 additions & 5 deletions ssh_para/ssh_para.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,11 @@ def __init__(self, command, nbthreads, nbjobs, dirlog):
self.startsec = time()
self.stdscr = None
self.paused = False
home = os.environ["HOME"]
self.pdirlog = sub(f"^{home}/", "~/", self.dirlog)
home = os.environ.get("HOME")
if home:
self.pdirlog = sub(rf"^{home}/", "~/", self.dirlog)
else:
self.pdirlog = self.dirlog
if sys.stdout.isatty():
self.init_curses()
super().__init__()
Expand Down Expand Up @@ -547,12 +550,15 @@ def main():
if args.job:
dirlog += f"/{args.job}"
dirlog += "/" + str(int(time()))
if not os.path.isdir(dirlog):
os.makedirs(dirlog)
latest = f"{args.dirlog}/latest"
if os.path.exists(latest):
os.unlink(latest)
os.symlink(dirlog, latest)
if not os.path.isdir(dirlog):
os.makedirs(dirlog)
try:
os.symlink(dirlog, latest)
except OSError:
pass
hosts = []
with open(args.hostsfile, "r", encoding="UTF-8") as fhosts:
for i in fhosts.readlines():
Expand Down

0 comments on commit 73aa955

Please sign in to comment.