File: remove.py

package info (click to toggle)
python-jpype 1.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,308 kB
  • sloc: python: 19,275; cpp: 18,053; java: 8,638; xml: 1,454; makefile: 155; sh: 37
file content (22 lines) | stat: -rw-r--r-- 747 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# This script was used to scrub the harness of old code
#   First a set of sed patterns found all the harness classes
#   that are in used directly.  They were moved out of place using,
#   this script, then those that were used indirectly were moved
#   back in place.
import glob
import re
import os

with open("keep", "r") as fd:
    lines = fd.readlines()
    lines = [i.strip() for i in lines]
    keep = set(lines)

for fl in glob.iglob('harness/**/*.java', recursive=True):
    m = re.match('.*(jpype.*).java', fl)
    name = m.group(1).replace('/', '.')
    if name in keep:
        continue
    m = re.match('(.*)/[^/]*.java', fl)
    os.makedirs(os.path.join("old", m.group(1)), exist_ok=True)
    os.rename(fl, os.path.join("old", fl))