|
25 | 25 |
|
26 | 26 | from mig.shared.defaults import keyword_all
|
27 | 27 |
|
28 |
| -# TODO: phase out lowercase names once all scripts switched to get_code_files |
| 28 | +# TODO: phase out lowercase names once all scripts switched to list_code_files |
29 | 29 |
|
30 | 30 | # Top dir with all code
|
31 |
| -CODE_ROOT = code_root = 'mig' |
| 31 | +code_root = "mig" |
| 32 | +CODE_ROOT = code_root |
32 | 33 |
|
33 | 34 | # Ignore backup and dot files in wild card match
|
34 |
| -PLAIN = '[a-zA-Z0-9]*.py' |
| 35 | +PLAIN = "[a-zA-Z0-9]*.py" |
35 | 36 | py_code_files = [
|
36 | 37 | # a few scripts are in parent dir of code_root
|
37 |
| - '../%s' % PLAIN, |
38 |
| - '../bin/%s' % PLAIN, |
39 |
| - '../sbin/%s' % PLAIN, |
40 |
| - '%s' % PLAIN, |
41 |
| - 'lib/%s' % PLAIN, |
42 |
| - 'cgi-bin/%s' % PLAIN, |
43 |
| - 'cgi-sid/%s' % PLAIN, |
44 |
| - 'install/%s' % PLAIN, |
45 |
| - 'migfs-fuse/%s' % PLAIN, |
46 |
| - 'resource/bin/%s' % PLAIN, |
47 |
| - 'resource/image-scripts/%s' % PLAIN, |
48 |
| - 'resource/keepalive-scripts/%s' % PLAIN, |
49 |
| - 'server/%s' % PLAIN, |
50 |
| - 'shared/%s' % PLAIN, |
51 |
| - 'shared/functionality/%s' % PLAIN, |
52 |
| - 'shared/distos/%s' % PLAIN, |
53 |
| - 'shared/gdp/%s' % PLAIN, |
54 |
| - 'shared/griddaemons/%s' % PLAIN, |
55 |
| - 'simulation/%s' % PLAIN, |
56 |
| - 'user/%s' % PLAIN, |
57 |
| - 'vm-proxy/%s' % PLAIN, |
58 |
| - 'webserver/%s' % PLAIN, |
59 |
| - 'wsgi-bin/%s' % PLAIN, |
| 38 | + "../%s" % PLAIN, |
| 39 | + "../bin/%s" % PLAIN, |
| 40 | + "../sbin/%s" % PLAIN, |
| 41 | + "%s" % PLAIN, |
| 42 | + "lib/%s" % PLAIN, |
| 43 | + "cgi-bin/%s" % PLAIN, |
| 44 | + "cgi-sid/%s" % PLAIN, |
| 45 | + "install/%s" % PLAIN, |
| 46 | + "migfs-fuse/%s" % PLAIN, |
| 47 | + "resource/bin/%s" % PLAIN, |
| 48 | + "resource/image-scripts/%s" % PLAIN, |
| 49 | + "resource/keepalive-scripts/%s" % PLAIN, |
| 50 | + "server/%s" % PLAIN, |
| 51 | + "shared/%s" % PLAIN, |
| 52 | + "shared/functionality/%s" % PLAIN, |
| 53 | + "shared/distos/%s" % PLAIN, |
| 54 | + "shared/gdp/%s" % PLAIN, |
| 55 | + "shared/griddaemons/%s" % PLAIN, |
| 56 | + "simulation/%s" % PLAIN, |
| 57 | + "user/%s" % PLAIN, |
| 58 | + "vm-proxy/%s" % PLAIN, |
| 59 | + "webserver/%s" % PLAIN, |
| 60 | + "wsgi-bin/%s" % PLAIN, |
| 61 | +] |
| 62 | +py_code_files += [ |
| 63 | + "cgi-sid/%s" % name for name in ["requestnewjob", "putrespgid"] |
60 | 64 | ]
|
61 |
| -py_code_files += ['cgi-sid/%s' % name for name in ['requestnewjob', |
62 |
| - 'putrespgid']] |
63 | 65 |
|
64 |
| -py_code_files += ['cgi-bin/%s' % name for name in [ |
65 |
| - 'listdir', |
66 |
| - 'mkdir', |
67 |
| - 'put', |
68 |
| - 'remove', |
69 |
| - 'rename', |
70 |
| - 'rmdir', |
71 |
| - 'stat', |
72 |
| - 'walk', |
73 |
| - 'getrespgid', |
74 |
| -]] |
| 66 | +py_code_files += [ |
| 67 | + "cgi-bin/%s" % name |
| 68 | + for name in [ |
| 69 | + "listdir", |
| 70 | + "mkdir", |
| 71 | + "put", |
| 72 | + "remove", |
| 73 | + "rename", |
| 74 | + "rmdir", |
| 75 | + "stat", |
| 76 | + "walk", |
| 77 | + "getrespgid", |
| 78 | + ] |
| 79 | +] |
75 | 80 | PY_CODE_FILES = py_code_files
|
76 | 81 |
|
77 | 82 | sh_code_files = [
|
78 |
| - 'resource/frontend_script.sh', |
79 |
| - 'resource/master_node_script.sh', |
80 |
| - 'resource/leader_node_script.sh', |
81 |
| - 'resource/dummy_node_script.sh', |
| 83 | + "resource/frontend_script.sh", |
| 84 | + "resource/master_node_script.sh", |
| 85 | + "resource/leader_node_script.sh", |
| 86 | + "resource/dummy_node_script.sh", |
82 | 87 | ]
|
83 | 88 | SH_CODE_FILES = sh_code_files
|
84 | 89 |
|
85 | 90 | js_code_files = [
|
86 |
| - 'images/js/jquery.accountform.js', |
87 |
| - 'images/js/jquery.ajaxhelpers.js', |
88 |
| - 'images/js/jquery.confirm.js', |
89 |
| - 'images/js/jquery.filemanager.js', |
90 |
| - 'images/js/jquery.jobmanager.js', |
91 |
| - 'images/js/jquery.migtools.js', |
92 |
| - 'images/js/jquery.prettyprint.js', |
93 |
| - 'images/js/preview-caman.js', |
94 |
| - 'images/js/preview.js', |
95 |
| - 'images/js/preview-paraview.js', |
96 |
| - 'assets/js/shared/ui-dynamic.js', |
97 |
| - 'assets/js/V3/ui-global.js', |
98 |
| - 'assets/js/V3/ui-extra.js', |
| 91 | + "images/js/jquery.accountform.js", |
| 92 | + "images/js/jquery.ajaxhelpers.js", |
| 93 | + "images/js/jquery.confirm.js", |
| 94 | + "images/js/jquery.filemanager.js", |
| 95 | + "images/js/jquery.jobmanager.js", |
| 96 | + "images/js/jquery.migtools.js", |
| 97 | + "images/js/jquery.prettyprint.js", |
| 98 | + "images/js/preview-caman.js", |
| 99 | + "images/js/preview.js", |
| 100 | + "images/js/preview-paraview.js", |
| 101 | + "assets/js/shared/ui-dynamic.js", |
| 102 | + "assets/js/V3/ui-global.js", |
| 103 | + "assets/js/V3/ui-extra.js", |
99 | 104 | ]
|
100 | 105 | JS_CODE_FILES = js_code_files
|
101 | 106 |
|
102 | 107 | code_files = py_code_files + sh_code_files + js_code_files
|
103 | 108 | CODE_FILES = code_files
|
104 | 109 |
|
105 | 110 | PYTHON, SHELL, JAVASCRIPT = "PYTHON", "SHELL", "JAVASCRIPT"
|
106 |
| -LANG_MAP = {keyword_all: CODE_FILES, PYTHON: PY_CODE_FILES, |
107 |
| - JAVASCRIPT: JS_CODE_FILES, SHELL: SH_CODE_FILES} |
| 111 | +LANG_MAP = { |
| 112 | + keyword_all: CODE_FILES, |
| 113 | + PYTHON: PY_CODE_FILES, |
| 114 | + JAVASCRIPT: JS_CODE_FILES, |
| 115 | + SHELL: SH_CODE_FILES, |
| 116 | +} |
108 | 117 |
|
109 | 118 |
|
110 | 119 | def list_code_files(code_langs=[keyword_all]):
|
111 | 120 | """Get list of all code files."""
|
112 | 121 | match = []
|
113 | 122 | for lang in code_langs:
|
114 |
| - if not lang in LANG_MAP: |
| 123 | + if lang not in LANG_MAP: |
115 | 124 | print("Warning: no such code lang: %s" % lang)
|
116 | 125 | else:
|
117 | 126 | match += LANG_MAP[lang]
|
|
0 commit comments