Skip to content

Commit

Permalink
allow pre file install check script to be as python version agnostic … (
Browse files Browse the repository at this point in the history
#2612) (#2614)

* allow pre file install check script to be as python version agnostic as possible.
  • Loading branch information
wxtim authored Sep 14, 2022
1 parent aadc8ac commit 9688f6d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ updated. Only the first match gets replaced, so it's fine to leave the old
ones in. -->
--------------------------------------------------------------------------------

## 2.0.1 (<span actions:bind='release-date'>Released 2022-07-28</span>)

### Fixes

[#2612](https://github.com/metomi/rose/pull/2612) - Allows the pre
remote install checks to use any Python version >= 2.7.

--------------------------------------------------------------------------------

## 2.0.0 (<span actions:bind='release-date'>Released 2022-07-28</span>)

For use with Cylc, see [Cylc-Rose](https://github.com/cylc/cylc-rose).
Expand Down
2 changes: 1 addition & 1 deletion metomi/rose/loc_handlers/rsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def parse(self, loc, _):
# Attempt to obtain the checksum(s) via "ssh"
host, path = loc.name.split(":", 1)
cmd = self.manager.popen.get_cmd(
"ssh", host, "python3", "-", path, loc.TYPE_BLOB, loc.TYPE_TREE
"ssh", host, "python", "-", path, loc.TYPE_BLOB, loc.TYPE_TREE
)
with open(rsync_remote_check_file, 'r') as stdin:
out = self.manager.popen(*cmd, stdin=stdin)[0]
Expand Down
17 changes: 12 additions & 5 deletions metomi/rose/loc_handlers/rsync_remote_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,27 @@
Warning:
This script will not necessarily be run in the Rose Python environment.
It should not have any dependencies outside of the stdlib and should be
compatible with as wide a range of Python3 versions as possible.
compatible with as wide a range of Python versions as possible.
"""
from __future__ import print_function
import os
import sys


def main(path, str_blob, str_tree):
"""Check file exists and print some info:
1. Octal protection bits.
2. Last modified time.
3. Filesize.
4. Path, which has been checked.
Args:
path (str): Path to a file or directory.
str_blob: return this string if path is a file. Default='blob'
str_tree: return this string if path is a directory. Default='tree'
Prints:
1. Access Mode information.
2. Last modified time.
3. Filesize.
4. Path, which has been checked.
"""
if os.path.isdir(path):
print(str_tree)
Expand Down

0 comments on commit 9688f6d

Please sign in to comment.