Merged revisions 3264-3278 via svnmerge from
file:///home/developper/svn/phpcompta/branches/rel510 ........ r3268 | danydb | 2010-06-03 00:41:59 +0200 (Thu, 03 Jun 2010) | 1 line Add script for creating class based on a table ........ r3269 | danydb | 2010-06-03 00:42:51 +0200 (Thu, 03 Jun 2010) | 1 line Add script for creating class based on a table ........ r3271 | danydb | 2010-06-03 22:01:05 +0200 (Thu, 03 Jun 2010) | 10 lines remove obsolete comment ======================= include/class_lettering.php Improve generation of PHP Class for a table =========================================== dev/create_phpclass.py dev/create_file_table.sql ........ r3272 | danydb | 2010-06-03 22:30:59 +0200 (Thu, 03 Jun 2010) | 2 lines remove obsolete ........ r3273 | danydb | 2010-06-03 22:38:28 +0200 (Thu, 03 Jun 2010) | 1 line create_phpclass.php improve it ........ r3274 | danydb | 2010-06-04 01:06:20 +0200 (Fri, 04 Jun 2010) | 2 lines create_phpclass : add insert, new comment, fix load function ........ r3275 | danydb | 2010-06-04 14:02:59 +0200 (Fri, 04 Jun 2010) | 1 line add doc ........ r3276 | danydb | 2010-06-04 14:44:55 +0200 (Fri, 04 Jun 2010) | 1 line Generate child object ........ r3277 | danydb | 2010-06-09 15:57:54 +0200 (Wed, 09 Jun 2010) | 1 line Remove useless transform.py ........ r3278 | danydb | 2010-06-09 15:58:26 +0200 (Wed, 09 Jun 2010) | 1 line Housekeeping : create subfolders ........
This commit is contained in:
parent
6d140ff76d
commit
110335b08c
14 changed files with 848 additions and 19 deletions
65
dev/manage-code/housekeeping/usage_function.py
Executable file
65
dev/manage-code/housekeeping/usage_function.py
Executable file
|
|
@ -0,0 +1,65 @@
|
|||
#!/usr/bin/python
|
||||
# Check if a function is still used
|
||||
#
|
||||
# This file is a part of PhpCompta under GPL
|
||||
# Author D. DE BONTRIDDER ddebontridder@yahoo.fr
|
||||
|
||||
from transform import *
|
||||
import sys
|
||||
import os
|
||||
import glob
|
||||
if len(sys.argv) < 2 :
|
||||
print "you need at least one argument : the file containing the function"
|
||||
print " the second and the thirst are the files where you look for those functions"
|
||||
sys.exit(3)
|
||||
|
||||
files=glob.glob(sys.argv[1])
|
||||
total=len(files)
|
||||
print "Total file to handle %d " % (len(files))
|
||||
reFunction=re.compile('(function) (\w+).*\((.*)\)')
|
||||
function_name=[]
|
||||
fList=open("function.txt","a+")
|
||||
for file in files:
|
||||
print "Working on file "+file
|
||||
if file.find('class_') != -1:
|
||||
continue
|
||||
fold=open(file)
|
||||
lines=fold.readlines()
|
||||
for line in lines:
|
||||
found=reFunction.findall(line)
|
||||
if len(found) != 0 :
|
||||
fctname=found[0][1]
|
||||
tmp={file:fctname}
|
||||
function_name.append(tmp)
|
||||
fList.write(file + ";" + fctname+"\n")
|
||||
fold.close()
|
||||
total=total-1
|
||||
print 'finished, remaining %d' % (total)
|
||||
fList.close()
|
||||
if len(sys.argv) == 2 :
|
||||
print "the fonctions are "
|
||||
for e in function_name:
|
||||
fct=e.values()[0]
|
||||
print fct
|
||||
|
||||
used={}
|
||||
for e in function_name:
|
||||
fct=e.values()[0]
|
||||
used[fct]=0
|
||||
for a in range(2,len(sys.argv)):
|
||||
print str(a)+ ': '+sys.argv[a]
|
||||
files_target=glob.glob(sys.argv[a])
|
||||
|
||||
for e in function_name:
|
||||
fct=e.values()[0]
|
||||
for file in files_target:
|
||||
fd=open(file)
|
||||
buffer=fd.readlines()
|
||||
for line in buffer:
|
||||
if line.find(fct)!= -1:
|
||||
used[fct]=used[fct]+1
|
||||
fd.close()
|
||||
|
||||
|
||||
for u in used.keys():
|
||||
print "%s : %d " % ( u,used[u])
|
||||
Loading…
Add table
Add a link
Reference in a new issue