rda-python-common 1.0.40__tar.gz → 1.0.41__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.40 → rda_python_common-1.0.41}/PKG-INFO +1 -1
  2. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/pyproject.toml +1 -1
  3. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common/PgLOG.py +26 -19
  4. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common.egg-info/PKG-INFO +1 -1
  5. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/LICENSE +0 -0
  6. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/README.md +0 -0
  7. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/setup.cfg +0 -0
  8. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common/PgCMD.py +0 -0
  9. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common/PgDBI.py +0 -0
  10. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common/PgFile.py +0 -0
  11. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common/PgLock.py +0 -0
  12. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common/PgOPT.py +0 -0
  13. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common/PgSIG.py +0 -0
  14. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common/PgSplit.py +0 -0
  15. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common/PgUtil.py +0 -0
  16. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common/__init__.py +0 -0
  17. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common.egg-info/SOURCES.txt +0 -0
  18. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common.egg-info/dependency_links.txt +0 -0
  19. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common.egg-info/requires.txt +0 -0
  20. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/src/rda_python_common.egg-info/top_level.txt +0 -0
  21. {rda_python_common-1.0.40 → rda_python_common-1.0.41}/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.40
3
+ Version: 1.0.41
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.40"
7
+ version = "1.0.41"
8
8
  authors = [
9
9
  { name="Zaihua Ji", email="zji@ucar.edu" },
10
10
  ]
@@ -440,35 +440,42 @@ def pglog(msg, logact = MSGLOG):
440
440
  if not logact&NOTLOG:
441
441
  if logact&ERRLOG:
442
442
  if not PGLOG['ERRFILE']: PGLOG['ERRFILE'] = re.sub(r'.log$', '.err', PGLOG['LOGFILE'])
443
- try:
444
- ERR = open("{}/{}".format(PGLOG['LOGPATH'], PGLOG['ERRFILE']), 'a')
445
- except FileNotFoundError:
446
- ERR = open("error.log", 'a')
447
- ERR.write(f"Error File not found: {PGLOG['LOGPATH']}/{PGLOG['ERRFILE']}")
448
- ERR.write(msg)
449
- if not logact&(EMLALL|SKPTRC): ERR.write(get_call_trace())
450
- ERR.close()
443
+ write_message(msg, f"{PGLOG['LOGPATH']}/{PGLOG['ERRFILE']}", logact)
451
444
  if logact&EXITLG:
452
- LOG = open("{}/{}".format(PGLOG['LOGPATH'], PGLOG['LOGFILE']), "a")
453
- LOG.write(cmdstr)
454
- LOG.close()
445
+ write_message(cmdstr, f"{PGLOG['LOGPATH']}/{PGLOG['LOGFILE']}", logact)
455
446
  else:
456
- LOG = open("{}/{}".format(PGLOG['LOGPATH'], PGLOG['LOGFILE']), 'a')
457
- LOG.write(msg)
458
- LOG.close()
447
+ write_message(msg, f"{PGLOG['LOGPATH']}/{PGLOG['LOGFILE']}", logact)
459
448
 
460
449
  if not PGLOG['BCKGRND'] and logact&(ERRLOG|WARNLG):
461
- OUT = sys.stderr if logact&(ERRLOG|EXITLG) else sys.stdout
462
- if logact&BRKLIN: OUT.write("\n")
463
- if logact&SEPLIN: OUT.write(PGLOG['SEPLINE'])
464
- OUT.write(msg)
465
-
450
+ write_message(msg, None, logact)
466
451
 
467
452
  if logact&EXITLG:
468
453
  pgexit(1)
469
454
  else:
470
455
  return (retmsg if retmsg else FAILURE)
471
456
 
457
+ #
458
+ # write a log message
459
+ #
460
+ def write_message(msg, file, logact):
461
+
462
+ doclose = False
463
+ errlog = logact&ERRLOG
464
+ if file:
465
+ try:
466
+ OUT = open(file, 'a')
467
+ doclose = True
468
+ except FileNotFoundError:
469
+ OUT = sys.stderr if logact&(ERRLOG|EXITLG) else sys.stdout
470
+ OUT.write(f"Log File not found: {file}")
471
+ else:
472
+ OUT = sys.stderr if logact&(ERRLOG|EXITLG) else sys.stdout
473
+ if logact&BRKLIN: OUT.write("\n")
474
+ if logact&SEPLIN: OUT.write(PGLOG['SEPLINE'])
475
+ OUT.write(msg)
476
+ if errlog and not logact&(EMLALL|SKPTRC): OUT.write(get_call_trace())
477
+ if doclose: OUT.close()
478
+
472
479
  #
473
480
  # check and disconnet database before exit
474
481
  #
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 1.0.40
3
+ Version: 1.0.41
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