Skip to content

Commit 106d516

Browse files
authored
Merge pull request #53 from NCAR/hua-work-common
add and use Pg.PFSIZE
2 parents f6d8df7 + a9e19ac commit 106d516

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
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.43"
7+
version = "1.0.44"
88
authors = [
99
{ name="Zaihua Ji", email="[email protected]" },
1010
]

src/rda_python_common/PgFile.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,10 @@ def local_file_stat(file, fstat, opt, logact):
16361636

16371637
info = {}
16381638
info['isfile'] = (1 if stat.S_ISREG(fstat.st_mode) else 0)
1639-
info['data_size'] = fstat.st_size if info['isfile'] else local_path_size(file)
1639+
if info['isfile'] == 0 and logact&PgLOG.PFSIZE:
1640+
info['data_size'] = local_path_size(file)
1641+
else:
1642+
info['data_size'] = fstat.st_size
16401643
info['fname'] = op.basename(file)
16411644
if not opt: return info
16421645
if opt&64 and info['isfile'] and info['data_size'] < PgLOG.PGLOG['MINSIZE']:
@@ -2573,7 +2576,7 @@ def local_file_size(file, opt = 0, logact = 0):
25732576
if opt&4: lmsg(file, PgLOG.PGLOG['MISSFILE'], logact)
25742577
return -1 # file not eixsts
25752578

2576-
info = check_local_file(file, 0, logact)
2579+
info = check_local_file(file, 0, logact|PgLOG.PFSIZE)
25772580
if info:
25782581
if info['isfile'] and info['data_size'] < PgLOG.PGLOG['MINSIZE']:
25792582
if opt:

src/rda_python_common/PgLOG.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
SKPTRC = (0x400000) # action to skip tracing when log errors
6868
UCNAME = (0x800000) # action to change query field names to upper case
6969
UCLWEX = (0x800015) # UCNAME|MSGLOG|WARNLG|EXITLG
70+
PFSIZE = (0x1000000) # total file size under a path
7071

7172
SUCCESS = 1 # Successful function call
7273
FINISH = 2 # go through a function, including time out

0 commit comments

Comments
 (0)