File: uninstall.py

package info (click to toggle)
python-japanese-codecs 1.4.9-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,980 kB
  • ctags: 3,460
  • sloc: python: 28,854; ansic: 1,524; makefile: 61; sh: 3
file content (27 lines) | stat: -rw-r--r-- 851 bytes parent folder | download | duplicates (2)
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
# Tamito KAJIYAMA <12 December 2000>

import os
import sys

def remove_module(dir, name):
    for ext in [".py", ".pyc", ".pyo"]:
        path = os.path.join(dir, name + ext)
        if os.path.exists(path):
            os.remove(path)

def main():
    libdir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3],
                          'encodings')
    for module in ["euc_jp", "shift_jis", "jis_7",
                   os.path.join("japanese", "__init__"),
                   os.path.join("japanese", "euc2utf"),
                   os.path.join("japanese", "utf2euc"),
                   os.path.join("japanese", "sjis2utf"),
                   os.path.join("japanese", "utf2sjis")]:
        remove_module(libdir, module)
    os.rmdir(os.path.join(libdir, "japanese"))

try:
    main()
except OSError, e:
    sys.stderr.write(str(e) + "\n")