File: SLOCCount.py

package info (click to toggle)
swift-im 5.0~alpha2.145.g12d031cf8%2Bdfsg-4.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,256 kB
  • sloc: cpp: 134,640; python: 2,701; sh: 774; xml: 561; javascript: 69; makefile: 59
file content (17 lines) | stat: -rw-r--r-- 685 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import SCons.Util, os.path, os

def generate(env) :
    def createSLOCCount(env, source) :
        myenv = env.Clone()
        myenv["ENV"]["HOME"] = os.environ["HOME"]
        source = myenv.Dir(source)
        target = myenv.File("#/" + source.path + ".sloccount")
        # FIXME: There's probably a better way to force building the .sc
        if os.path.exists(target.abspath) :
            os.unlink(target.abspath)
        return myenv.Command(target, source, [SCons.Action.Action("sloccount --duplicates --wide --details " + source.path + " | grep -v qrc_ > $TARGET", cmdstr = "$GENCOMSTR")])

    env.AddMethod(createSLOCCount, "SLOCCount")

def exists(env) :
    return True