Skip to content

Commit f03febb

Browse files
authored
Merge pull request #54 from NCAR/hua-work-common
Hua work common
2 parents 106d516 + beb82c4 commit f03febb

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "rda_python_common"
7-
version = "1.0.44"
7+
version = "1.0.45"
88
authors = [
99
{ name="Zaihua Ji", email="[email protected]" },
1010
]

src/rda_python_common/PgFile.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,7 @@ def local_file_stat(file, fstat, opt, logact):
16641664
if opt&8:
16651665
info['gid'] = fstat.st_gid
16661666
info['group'] = grp.getgrgid(info['gid']).gr_name
1667-
if opt&32: info['checksum'] = get_md5sum(file, 0, logact)
1667+
if opt&32 and info['isfile']: info['checksum'] = get_md5sum(file, 0, logact)
16681668

16691669
return info
16701670

@@ -2305,16 +2305,18 @@ def get_md5sum(file, count = 0, logact = 0):
23052305
if count > 0:
23062306
checksum = [None]*count
23072307
for i in range(count):
2308-
chksm = PgLOG.pgsystem(cmd + file[i], logact, 20)
2309-
if chksm:
2310-
ms = re.search(r'(\w{32})', chksm)
2311-
if ms: checksum[i] = ms.group(1)
2308+
if op.isfile(file[i]):
2309+
chksm = PgLOG.pgsystem(cmd + file[i], logact, 20)
2310+
if chksm:
2311+
ms = re.search(r'(\w{32})', chksm)
2312+
if ms: checksum[i] = ms.group(1)
23122313
else:
2313-
chksm = PgLOG.pgsystem(cmd + file, logact, 20)
23142314
checksum = None
2315-
if chksm:
2316-
ms = re.search(r'(\w{32})', chksm)
2317-
if ms: checksum = ms.group(1)
2315+
if op.isfile(file):
2316+
chksm = PgLOG.pgsystem(cmd + file, logact, 20)
2317+
if chksm:
2318+
ms = re.search(r'(\w{32})', chksm)
2319+
if ms: checksum = ms.group(1)
23182320

23192321
return checksum
23202322

src/rda_python_common/PgLOG.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def write_message(msg, file, logact):
474474
if logact&BRKLIN: OUT.write("\n")
475475
if logact&SEPLIN: OUT.write(PGLOG['SEPLINE'])
476476
OUT.write(msg)
477-
if errlog and not logact&(EMLALL|SKPTRC): OUT.write(get_call_trace())
477+
if errlog and file and not logact&(EMLALL|SKPTRC): OUT.write(get_call_trace())
478478
if doclose: OUT.close()
479479

480480
#

0 commit comments

Comments
 (0)