File: pack.py

package info (click to toggle)
m2crypto 0.16-1.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,064 kB
  • ctags: 3,165
  • sloc: python: 16,936; makefile: 69; sh: 12; ansic: 10
file content (37 lines) | stat: -rw-r--r-- 842 bytes parent folder | download | duplicates (6)
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
#!/usr/bin/env python

# Clean up M2Crypto source base.

import glob, os, os.path, sys

def zap(arg, dirname, names):
    for f in glob.glob(dirname + arg):
        try:
            os.remove(f)
        except:
            pass

if __name__ == "__main__":
    start = sys.argv[1]

    os.path.walk(start, zap, "/*.pyc")

    if os.name == 'nt':
        zap_m2 = ("__m2cryptoc.pyd","_m2crypto.py")
    elif os.name == 'posix':
        zap_m2 = ("__m2crypto.so","_m2crypto.py")
    for x in zap_m2:
        try:
            os.remove("%s/M2Crypto/%s" % (start, x))
        except:
            pass

    zap_swig = ("_m2crypto_wrap*", "_m2crypto.c", "_m2crypto.py", "vc60.pdb")
    for x in zap_swig:
        for z in glob.glob("%s/SWIG/%s" % (start, x)):
            try:
                os.remove(z)
            except:
                pass