-
Notifications
You must be signed in to change notification settings - Fork 245
/
checkPyConfigs.py
executable file
·61 lines (51 loc) · 1.76 KB
/
checkPyConfigs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python
# TODO had syntax errors, is this file used ?
from __future__ import print_function
import glob
import os
def pythonNameFromCfgName(cfgName):
newName = cfgName.replace("-", "_")
return newName.replace("/data/", "/python/").replace(".cf", "_cf") + ".py"
releaseBase = os.path.expandvars("$CMSSW_RELEASE_BASE/src") + "/"
files = glob.glob(releaseBase + "*/*/data/*cf[fi]")
# give 'em two hours
gracePeriod = 2 * 60 * 60
pkgInfo = {}
pkgList = []
missingFiles = []
for f in files:
pythonFile = pythonNameFromCfgName(f)
if os.path.exists(pythonFile):
if os.path.getmtime(f) > os.path.getmtime(pythonNameFromCfgName(f)) + gracePeriod:
subsys, pkg, pydir, fname = pythonFile.split("/")
pkgName = subsys + "_" + pkg
if pkgName in pkgInfo:
pkgInfo[pkgName].append(pythonFile)
else:
pkgInfo[pkgName] = [pythonFile]
if pkgName not in pkgList:
pkgList.append(pkgName)
# print f
else:
missingFiles.append(pythonFile)
subsys, pkg, pydir, fname = pythonFile.split("/")
pkgName = subsys + "_" + pkg
if pkgName in pkgInfo:
pkgInfo[pkgName].append(pythonFile)
else:
pkgInfo[pkgName] = [pythonFile]
if pkgName not in pkgList:
pkgList.append(pkgName)
# print f
nFiles = 0
pkgList.sort()
for pkg in pkgList:
print("-" * 80)
print("Package:", pkg)
for fName in pkgInfo[pkg]:
status = "update needed :"
if fName in missingFiles:
status = "missing file :"
print(" ", status, fName)
nFiles += 1
print("\nFound a total of ", len(pkgList), "problematic packages and ", nFiles, "files.")