rda-python-common 1.0.42__tar.gz → 1.0.44__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rda-python-common might be problematic. Click here for more details.

Files changed (21) hide show
  1. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/PKG-INFO +1 -1
  2. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/pyproject.toml +1 -1
  3. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common/PgFile.py +18 -3
  4. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common/PgLOG.py +1 -0
  5. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common.egg-info/PKG-INFO +1 -1
  6. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/LICENSE +0 -0
  7. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/README.md +0 -0
  8. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/setup.cfg +0 -0
  9. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common/PgCMD.py +0 -0
  10. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common/PgDBI.py +0 -0
  11. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common/PgLock.py +0 -0
  12. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common/PgOPT.py +0 -0
  13. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common/PgSIG.py +0 -0
  14. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common/PgSplit.py +0 -0
  15. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common/PgUtil.py +0 -0
  16. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common/__init__.py +0 -0
  17. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common.egg-info/SOURCES.txt +0 -0
  18. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common.egg-info/dependency_links.txt +0 -0
  19. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common.egg-info/requires.txt +0 -0
  20. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/src/rda_python_common.egg-info/top_level.txt +0 -0
  21. {rda_python_common-1.0.42 → rda_python_common-1.0.44}/test/test_common.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 1.0.42
3
+ Version: 1.0.44
4
4
  Summary: RDA Python common library codes shared by other RDA python packages
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-common
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rda_python_common"
7
- version = "1.0.42"
7
+ version = "1.0.44"
8
8
  authors = [
9
9
  { name="Zaihua Ji", email="zji@ucar.edu" },
10
10
  ]
@@ -1636,7 +1636,10 @@ def local_file_stat(file, fstat, opt, logact):
1636
1636
 
1637
1637
  info = {}
1638
1638
  info['isfile'] = (1 if stat.S_ISREG(fstat.st_mode) else 0)
1639
- info['data_size'] = fstat.st_size
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
1640
1643
  info['fname'] = op.basename(file)
1641
1644
  if not opt: return info
1642
1645
  if opt&64 and info['isfile'] and info['data_size'] < PgLOG.PGLOG['MINSIZE']:
@@ -1665,6 +1668,18 @@ def local_file_stat(file, fstat, opt, logact):
1665
1668
 
1666
1669
  return info
1667
1670
 
1671
+ #
1672
+ # get total size of files under a given path
1673
+ #
1674
+ def local_path_size(pname):
1675
+
1676
+ if not pname: pname = '.' # To get size of current directory
1677
+ size = 0
1678
+ for path, dirs, files in os.walk(pname):
1679
+ for f in files:
1680
+ size += os.path.getsize(os.path.join(path, f))
1681
+ return size
1682
+
1668
1683
  #
1669
1684
  # check and get file status information of a file on remote host
1670
1685
  #
@@ -2557,11 +2572,11 @@ def rda_file_size(file, host, opt = 0, logact = 0):
2557
2572
  #
2558
2573
  def local_file_size(file, opt = 0, logact = 0):
2559
2574
 
2560
- if not op.isfile(file):
2575
+ if not op.exists(file):
2561
2576
  if opt&4: lmsg(file, PgLOG.PGLOG['MISSFILE'], logact)
2562
2577
  return -1 # file not eixsts
2563
2578
 
2564
- info = check_local_file(file, 0, logact)
2579
+ info = check_local_file(file, 0, logact|PgLOG.PFSIZE)
2565
2580
  if info:
2566
2581
  if info['isfile'] and info['data_size'] < PgLOG.PGLOG['MINSIZE']:
2567
2582
  if opt:
@@ -67,6 +67,7 @@ ADDTBL = (0x200000) # action to add a new table if it does not exist
67
67
  SKPTRC = (0x400000) # action to skip tracing when log errors
68
68
  UCNAME = (0x800000) # action to change query field names to upper case
69
69
  UCLWEX = (0x800015) # UCNAME|MSGLOG|WARNLG|EXITLG
70
+ PFSIZE = (0x1000000) # total file size under a path
70
71
 
71
72
  SUCCESS = 1 # Successful function call
72
73
  FINISH = 2 # go through a function, including time out
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 1.0.42
3
+ Version: 1.0.44
4
4
  Summary: RDA Python common library codes shared by other RDA python packages
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-common