summaryrefslogtreecommitdiff
path: root/licensecheck
diff options
context:
space:
mode:
authorjesusalva <cpntb1@ymail.com>2018-02-27 18:11:46 -0300
committerjesusalva <cpntb1@ymail.com>2018-02-27 18:11:46 -0300
commit5c10b1766dc138eda45e55dc35ce11cd6659e186 (patch)
treeb9afedfaf1f9a3088875e3e8bbe5d90a5f84887e /licensecheck
parentdea73714dd66efbe2cb74025d8d74d459f45f26b (diff)
downloadtools-5c10b1766dc138eda45e55dc35ce11cd6659e186.tar.gz
tools-5c10b1766dc138eda45e55dc35ce11cd6659e186.tar.bz2
tools-5c10b1766dc138eda45e55dc35ce11cd6659e186.tar.xz
tools-5c10b1766dc138eda45e55dc35ce11cd6659e186.zip
Include a small, simple and dumb script to check for missing license headers
I should read everything from _imports but I do not do that. This means not all files covered.
Diffstat (limited to 'licensecheck')
-rwxr-xr-xlicensecheck/serverdata.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/licensecheck/serverdata.py b/licensecheck/serverdata.py
new file mode 100755
index 0000000..5412e13
--- /dev/null
+++ b/licensecheck/serverdata.py
@@ -0,0 +1,47 @@
+#! /usr/bin/env python2.7
+# -*- coding: utf8 -*-
+#
+# Copyright (C) 2018 TMW-2
+# Author: Jesusalva
+
+import os
+
+sv="../../server-data/npc/"
+erp=[]
+err=0
+
+print("Checking license info for second level NPCs")
+
+for mp in os.listdir(sv):
+
+ # we actually should read scripts and imports, but this script is designed to be dumb
+ if "." in mp or mp == "dev":
+ continue
+
+ for script in os.listdir(sv+mp):
+ if (not ".txt" in script) and (not ".conf" in script):
+ continue
+ if ("~" in script) or ("#" in script) or ("mapflags.txt" in script):
+ continue
+
+ a=open(sv+mp+'/'+script, 'r')
+ ok=False
+ for line in a:
+ if 'tmw2 script' in line.lower() or 'tmw-2 script' in line.lower() or 'tmw 2 script' in line.lower() or 'This file is generated automatically' in line:
+ ok=True
+ break
+
+ a.close()
+ if not ok:
+ erp.append(mp+'/'+script)
+ err+=1
+
+if len(erp) > 0:
+ print("-----------------------------------------------------------------------")
+
+for i in sorted(erp):
+ print(i)
+
+print("-----------------------------------------------------------------------")
+print("Serverdata license check result")
+print("Errors: %d" % (err))