Skip to content

Commit c8d98c1

Browse files
CHG: Cleanup; MATLAB -> Python; documentation
1 parent b73355e commit c8d98c1

File tree

6 files changed

+33
-35
lines changed

6 files changed

+33
-35
lines changed

src/m/os/issmscpin.m

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,37 @@ function issmscpin(host, login,port,path, packages)
33
%
44
% usage: issmscpin(host,packages,path)
55
%
6+
% NOTE: If users again have issues with file list (i.e.
7+
%
8+
% {<FILE1>,<FILE2>,...<FILEN>}
9+
%
10+
% ), note that this a bash'ism and default shell should be checked. View file
11+
% history for potential fix (i.e. some combination of -O and -T options).
612
%
713

814
%first get hostname
915
hostname=oshostname();
1016

11-
%first be sure packages are not in the current directory, this could conflict with pscp on windows.
12-
for i=1:numel(packages),
13-
if exist(packages{i},'file')
14-
delete(packages{i});
15-
end
16-
end
17-
1817
%if hostname and host are the same, do a simple copy
1918
if strcmpi(hostname,host)
2019
for i=1:numel(packages)
2120
system(['cp ' path '/' packages{i} ' .']);
2221
end
2322
else
24-
%just use standard unix scp string to copy multiple files using scp:
2523
if numel(packages)==1,
26-
string=packages{1};
24+
fileliststr=packages{1};
2725
else
28-
string='\{';
26+
fileliststr='\{';
2927
for i=1:numel(packages)-1,
30-
string=[string packages{i} ','];
28+
fileliststr=[fileliststr packages{i} ','];
3129
end
32-
string=[string packages{end} '\}'];
30+
fileliststr=[fileliststr packages{end} '\}'];
3331
end
3432

3533
if port,
36-
eval(['!scp -P ' num2str(port) ' ' login '@localhost:' path '/' string ' ./']);
34+
eval(['!scp -P ' num2str(port) ' ' login '@localhost:' path '/' fileliststr ' ./']);
3735
else
38-
eval(['!scp ' login '@' host ':' path '/' string ' ./']);
36+
eval(['!scp ' login '@' host ':' path '/' fileliststr ' ./']);
3937
end
4038

4139
%check scp worked

src/m/os/issmscpin.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,37 @@
55

66

77
def issmscpin(host, login, port, path, packages):
8-
"""ISSMSCPIN get packages from host, using scp on unix, and pscp on windows
8+
"""issmscpin get packages from host using scp
99
1010
Usage:
1111
issmscpin(host, packages, path)
12+
13+
NOTE: If users again have issues with file list (i.e.
14+
15+
{<FILE1>,<FILE2>,...<FILEN>}
16+
17+
), note that this a bash'ism and default shell should be checked. View file
18+
history for potential fix (i.e. some combination of -O and -T options).
1219
"""
1320

14-
#first get hostname
21+
# First get hostname
1522
hostname = oshostname()
16-
#first be sure packages are not in the current directory, this could conflict with pscp on windows.
17-
#remove warnings in case the files do not exist
18-
for package in packages:
19-
try:
20-
os.remove(package)
21-
except OSError as e:
22-
pass
23-
#if hostname and host are the same, do a simple copy
24-
if strcmpi(hostname, host): #hostname == host:
23+
24+
# If hostname and host are the same, do a simple copy
25+
if strcmpi(hostname, host):
2526
for package in packages:
2627
try:
27-
shutil.copy(os.path.join(path, package), os.getcwd()) #keep going, even if success = 0
28+
shutil.copy(os.path.join(path, package), os.getcwd()) # keep going, even if success == 0
2829
except OSError as e:
2930
pass
3031
else:
31-
#just use standard unix scp string to copy multiple files using scp
3232
filelist = [os.path.join(directory, x) for x in packages]
3333
fileliststr = ' '.join([str(x) for x in filelist])
3434
if port:
35-
subprocess.call('scp -OT -P {} {}@localhost:"{}" {}'.format(port, login, fileliststr, os.getcwd()), shell=True)
35+
subprocess.call('scp -P {} {}@localhost:"{}" {}'.format(port, login, fileliststr, os.getcwd()), shell=True)
3636
else:
37-
subprocess.call('scp -OT {}@{}:"{}" {}'.format(login, host, fileliststr, os.getcwd()), shell=True)
38-
#check scp worked
37+
subprocess.call('scp {}@{}:"{}" {}'.format(login, host, fileliststr, os.getcwd()), shell=True)
38+
# Check scp worked
3939
for package in packages:
4040
if not os.path.exists(os.path.join('.', package)):
41-
raise OSError("issmscpin error message: could not call scp on *nix system for file '{}'".format(package))
41+
raise OSError('issmscpin error message: could not scp {}'.format(package))

src/wrappers/matlab/io/ApiPrintf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* \file ApiPrintf.c:
2-
* \brief: API specific symbols from libISSMCore that we need to resolve here
2+
* \brief: MATLAB API-specific symbols from libISSMCore that we need to resolve here
33
*/
44

55
#ifdef HAVE_CONFIG_H

src/wrappers/matlab/io/matlabio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*\file matlabio.h
2-
*\brief: I/O for ISSM in matlab mode
2+
*\brief: I/O for ISSM when running from MATLAB interface
33
*/
44

55
#ifndef _MATLAB_IO_H_

src/wrappers/python/io/ApiPrintf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* \file ApiPrintf.c:
2-
* \brief: pyton api specific symbols which are unresolved from libISSMCore.a
2+
* \brief: Python API-specific symbols which are unresolved from libISSMCore.a
33
*/
44

55
#ifdef HAVE_CONFIG_H

src/wrappers/python/io/pythonio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*\file pythonio.h
2-
*\brief: I/O for ISSM in python mode
2+
*\brief: I/O for ISSM when running from Python interface
33
*/
44

55
#ifndef _PYTHON_IO_H_

0 commit comments

Comments
 (0)