rda-python-miscs 1.0.3__tar.gz → 1.0.5__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.
- {rda_python_miscs-1.0.3/src/rda_python_miscs.egg-info → rda_python_miscs-1.0.5}/PKG-INFO +1 -1
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/pyproject.toml +1 -1
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/gdexls.py +21 -21
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/gdexls.usg +12 -12
- rda_python_miscs-1.0.5/src/rda_python_miscs/gdexls_standalone.py +12 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5/src/rda_python_miscs.egg-info}/PKG-INFO +1 -1
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs.egg-info/SOURCES.txt +1 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/LICENSE +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/MANIFEST.in +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/README.md +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/setup.cfg +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/__init__.py +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/bashqsub.py +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/bashqsub.usg +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/pgwget.py +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdacp.py +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdacp.usg +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdakill.py +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdakill.usg +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdals.py +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdals.usg +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdamod.py +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdamod.usg +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdaown.py +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdaown.usg +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdaps.py +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdaps.usg +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdasub.py +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdasub.usg +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdazip.py +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/rdazip.usg +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/tcshqsub.py +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs/tcshqsub.usg +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs.egg-info/dependency_links.txt +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs.egg-info/entry_points.txt +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs.egg-info/requires.txt +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs.egg-info/top_level.txt +0 -0
- {rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/tests/test_miscs.py +0 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
# https://github.com/NCAR/rda-utility-programs.git
|
|
10
10
|
# 2025-09-21 copied from rdals to gdexls
|
|
11
11
|
# Purpose: list files/directories in a local directory and show additional
|
|
12
|
-
# information recorded in
|
|
12
|
+
# information recorded in GDEXDB if any
|
|
13
13
|
#
|
|
14
14
|
# Github: https://github.com/NCAR/rda-python-miscs.git
|
|
15
15
|
#
|
|
@@ -31,7 +31,7 @@ CLMT = 500 # reformat list if count reach this limit
|
|
|
31
31
|
WIDTHS = [0, 0, 0] # WIDTHS for formated display
|
|
32
32
|
ALIGNS = [0, 1, 1] # alignment, 0 - left; 1 - right
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
GDEXLS = {
|
|
35
35
|
'd' : 0, # 1 to list directory information only
|
|
36
36
|
'f' : 0, # 1 to list file information only
|
|
37
37
|
'N' : 0, # 1 to list files unformatted
|
|
@@ -70,9 +70,9 @@ def main():
|
|
|
70
70
|
ms = re.match(r'-(\w)$', arg)
|
|
71
71
|
if ms:
|
|
72
72
|
option = ms.group(1)
|
|
73
|
-
if option not in
|
|
73
|
+
if option not in GDEXLS: PgLOG.pglog(arg + ": Unknown Option", PgLOG.LGEREX)
|
|
74
74
|
if 'dfNr'.find(option) > -1:
|
|
75
|
-
|
|
75
|
+
GDEXLS[option] = 1
|
|
76
76
|
option = defopt
|
|
77
77
|
continue
|
|
78
78
|
if not option: PgLOG.pglog(arg + ": Value provided without option", PgLOG.LGEREX)
|
|
@@ -81,9 +81,9 @@ def main():
|
|
|
81
81
|
defopt = None
|
|
82
82
|
else:
|
|
83
83
|
if option == 'R':
|
|
84
|
-
|
|
84
|
+
GDEXLS[option] = int(arg)
|
|
85
85
|
else:
|
|
86
|
-
|
|
86
|
+
GDEXLS[option] = arg
|
|
87
87
|
option = defopt
|
|
88
88
|
|
|
89
89
|
if not LINFO['files']:
|
|
@@ -92,10 +92,10 @@ def main():
|
|
|
92
92
|
sys.stderr.write(LINFO['curdir'] + ": Empty directory\n")
|
|
93
93
|
PgLOG.pgexit(1)
|
|
94
94
|
|
|
95
|
-
if not (
|
|
96
|
-
|
|
97
|
-
if not
|
|
98
|
-
if not
|
|
95
|
+
if not (GDEXLS['d'] or GDEXLS['f']):
|
|
96
|
+
GDEXLS['d'] = GDEXLS['f'] = 1 # list both directories and files as default
|
|
97
|
+
if not GDEXLS['D']: GDEXLS['D'] = '|' if GDEXLS['N'] else " " # default delimiter for no format display
|
|
98
|
+
if not GDEXLS['R'] and GDEXLS['r']: GDEXLS['R'] = 1000
|
|
99
99
|
|
|
100
100
|
display_top_list(LINFO['files']) # display or cache file/directory list
|
|
101
101
|
if LINFO['pcnt'] > 0: display_format_list() # if some left over
|
|
@@ -115,7 +115,7 @@ def main():
|
|
|
115
115
|
msg += "{} File{}".format(LINFO['fcnt'], s)
|
|
116
116
|
print("Total {} displayed".format(msg))
|
|
117
117
|
elif (LINFO['dcnt'] + LINFO['gcnt'] + LINFO['fcnt']) == 0:
|
|
118
|
-
sys.stderr.write((LINFO['tpath'] if LINFO['tpath'] else LINFO['curdir']) + ": No
|
|
118
|
+
sys.stderr.write((LINFO['tpath'] if LINFO['tpath'] else LINFO['curdir']) + ": No GDEX data information found\n")
|
|
119
119
|
PgLOG.pgexit(1)
|
|
120
120
|
|
|
121
121
|
PgLOG.pgexit(0)
|
|
@@ -140,7 +140,7 @@ def display_top_list(files):
|
|
|
140
140
|
if not re.match(r'^/', file): file = PgLOG.join_paths(LINFO['curdir'], file)
|
|
141
141
|
LINFO['tpath'] = (op.dirname(file) if display else file) + "/"
|
|
142
142
|
if display: display_line(file, isdir)
|
|
143
|
-
if isdir and (
|
|
143
|
+
if isdir and (GDEXLS['R'] or not display or not LINFO['dsid']):
|
|
144
144
|
fs = sorted(glob.glob(file + "/*"))
|
|
145
145
|
display_list(fs, 1)
|
|
146
146
|
if LINFO['pcnt'] > CLMT: display_format_list()
|
|
@@ -153,7 +153,7 @@ def display_list(files, level):
|
|
|
153
153
|
for file in files:
|
|
154
154
|
isdir = 1 if op.isdir(file) else 0
|
|
155
155
|
display_line(file, isdir)
|
|
156
|
-
if isdir and level <
|
|
156
|
+
if isdir and level < GDEXLS['R']:
|
|
157
157
|
fs = sorted(glob.glob(file + "/*"))
|
|
158
158
|
display_list(fs, level+1)
|
|
159
159
|
if LINFO['pcnt'] > CLMT: display_format_list()
|
|
@@ -170,7 +170,7 @@ def display_line(file, isdir):
|
|
|
170
170
|
wfile = ms.group(1)
|
|
171
171
|
getwfile = 0
|
|
172
172
|
if getwfile:
|
|
173
|
-
LINFO['dsid'] = PgUtil.find_dataset_id(file
|
|
173
|
+
LINFO['dsid'] = PgUtil.find_dataset_id(file)
|
|
174
174
|
if LINFO['dsid'] == None: return # skip for missing dsid
|
|
175
175
|
|
|
176
176
|
pgrec = PgDBI.pgget("dataset", "title, (dwebcnt + nwebcnt) nc, (dweb_size + nweb_size) ns", "dsid = '{}'".format(LINFO['dsid']), PgLOG.LGEREX)
|
|
@@ -179,7 +179,7 @@ def display_line(file, isdir):
|
|
|
179
179
|
LINFO['dhome'] = "{}/{}".format(PgLOG.PGLOG['DSDHOME'], LINFO['dsid'])
|
|
180
180
|
if LINFO['dhome'] == file:
|
|
181
181
|
file = re.sub(r'^{}'.format(LINFO['tpath']), '', file, 1)
|
|
182
|
-
if
|
|
182
|
+
if GDEXLS['d']:
|
|
183
183
|
title = pgrec['title'] if pgrec['title'] else ''
|
|
184
184
|
display_record(["D" + file, pgrec['ns'], str(pgrec['nc']), title])
|
|
185
185
|
LINFO['dcnt'] += 1
|
|
@@ -192,7 +192,7 @@ def display_line(file, isdir):
|
|
|
192
192
|
return
|
|
193
193
|
|
|
194
194
|
if isdir:
|
|
195
|
-
if
|
|
195
|
+
if GDEXLS['d']: # check and display group info for directory
|
|
196
196
|
pgrec = PgDBI.pgget("dsgroup", "title, (dwebcnt + nwebcnt) nc, (dweb_size + nweb_size) ns",
|
|
197
197
|
"dsid = '{}' AND webpath = '{}'".format(LINFO['dsid'], wfile), PgLOG.LGEREX)
|
|
198
198
|
if pgrec:
|
|
@@ -201,7 +201,7 @@ def display_line(file, isdir):
|
|
|
201
201
|
display_record(["G" + file, pgrec['ns'], str(pgrec['nc']), title])
|
|
202
202
|
LINFO['gcnt'] += 1
|
|
203
203
|
|
|
204
|
-
elif
|
|
204
|
+
elif GDEXLS['f']: # check and display file info
|
|
205
205
|
pgrec = PgSplit.pgget_wfile(LINFO['dsid'], "data_size, data_format, note",
|
|
206
206
|
"wfile = '{}'".format(wfile), PgLOG.LGEREX)
|
|
207
207
|
if pgrec:
|
|
@@ -219,8 +219,8 @@ def display_line(file, isdir):
|
|
|
219
219
|
def display_record(disp):
|
|
220
220
|
|
|
221
221
|
disp[1] = get_float_string(disp[1])
|
|
222
|
-
if
|
|
223
|
-
print(
|
|
222
|
+
if GDEXLS['N']:
|
|
223
|
+
print(GDEXLS['D'].join(disp))
|
|
224
224
|
else:
|
|
225
225
|
LINFO['pgrecs'].append(disp)
|
|
226
226
|
LINFO['pcnt'] += 1
|
|
@@ -240,7 +240,7 @@ def display_format_list():
|
|
|
240
240
|
disp[i] = "{:>{}}".format(disp[i], WIDTHS[i])
|
|
241
241
|
else:
|
|
242
242
|
disp[i] = "{:{}}".format(disp[i], WIDTHS[i])
|
|
243
|
-
print(
|
|
243
|
+
print(GDEXLS['D'].join(disp))
|
|
244
244
|
|
|
245
245
|
LINFO['pcnt'] = 0
|
|
246
246
|
|
|
@@ -271,7 +271,7 @@ def get_real_path(path):
|
|
|
271
271
|
elif re.match(r'^/gpfs/csfs1/', path):
|
|
272
272
|
path = re.sub(r'^/gpfs/csfs1', '/glade/campaign', path, 1)
|
|
273
273
|
|
|
274
|
-
return path
|
|
274
|
+
return op.realpath(path)
|
|
275
275
|
|
|
276
276
|
#
|
|
277
277
|
# call main() to start program
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
|
|
19
19
|
- Option -d, list directory information only. Directory information
|
|
20
20
|
is included as default. Add this option to exclude file information;
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
- Option -f, list file information only. File information
|
|
23
23
|
is included as default. Add this option to exclude directory information;
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
- Option -N, list files unformatted;
|
|
26
26
|
|
|
27
27
|
- Option -h, display this help document;
|
|
@@ -42,19 +42,19 @@
|
|
|
42
42
|
|
|
43
43
|
This utility program can be executed anywhere. Nothing is displayed if neither
|
|
44
44
|
directory nor file information pre-gathered in database.
|
|
45
|
-
|
|
46
|
-
For examples, to check directories and files of
|
|
47
|
-
|
|
48
|
-
1. Change into the dataset home data directory as 'cd /PathTo/
|
|
45
|
+
|
|
46
|
+
For examples, to check directories and files of d277006, you can
|
|
47
|
+
|
|
48
|
+
1. Change into the dataset home data directory as 'cd /PathTo/d277006' and
|
|
49
49
|
execute 'gdexls'; add recursive option '-r' to check directories and files
|
|
50
50
|
further into the sub-directories, or change directory into a sub-directory
|
|
51
51
|
to check files inside of it.
|
|
52
|
-
|
|
53
|
-
2. Pass an absolute path to gdexls as 'gdexls /PathTo/
|
|
54
|
-
'gdexls /PathTo/
|
|
52
|
+
|
|
53
|
+
2. Pass an absolute path to gdexls as 'gdexls /PathTo/d277006/' or as
|
|
54
|
+
'gdexls /PathTo/d277006/*'; without the ending by '/' or an appended
|
|
55
55
|
wildcard symbol '*' information of the dataset itself is check unless
|
|
56
56
|
the recursive option '-r' or '-R RecursiveLevel' is present
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
3. If the current directory is in another dataset home data directory,
|
|
59
|
-
such as /PathTo/
|
|
60
|
-
as 'gdexls ../
|
|
59
|
+
such as /PathTo/d277006, you can pass a relative path to gdexls
|
|
60
|
+
as 'gdexls ../d277006/' or as 'gdexls ../d277006/*'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/glade/work/zji/conda-envs/pg-rda/bin/python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# 2025-09-23, zji@ucar.edu, created for a standalone version of gdexls
|
|
4
|
+
import re
|
|
5
|
+
import sys
|
|
6
|
+
pgpath = '/glade/work/zji/conda-envs/pg-rda/lib/python3.10/site-packages'
|
|
7
|
+
if pgpath not in sys.path: sys.path.insert(0, pgpath)
|
|
8
|
+
|
|
9
|
+
from rda_python_miscs.gdexls import main
|
|
10
|
+
if __name__ == '__main__':
|
|
11
|
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
12
|
+
sys.exit(main())
|
|
@@ -7,6 +7,7 @@ src/rda_python_miscs/bashqsub.py
|
|
|
7
7
|
src/rda_python_miscs/bashqsub.usg
|
|
8
8
|
src/rda_python_miscs/gdexls.py
|
|
9
9
|
src/rda_python_miscs/gdexls.usg
|
|
10
|
+
src/rda_python_miscs/gdexls_standalone.py
|
|
10
11
|
src/rda_python_miscs/pgwget.py
|
|
11
12
|
src/rda_python_miscs/rdacp.py
|
|
12
13
|
src/rda_python_miscs/rdacp.usg
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs.egg-info/requires.txt
RENAMED
|
File without changes
|
{rda_python_miscs-1.0.3 → rda_python_miscs-1.0.5}/src/rda_python_miscs.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|