File: ofiles

package info (click to toggle)
libmceliece 0~20241009-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,528 kB
  • sloc: asm: 32,164; ansic: 30,689; python: 4,053; sh: 279; makefile: 35
file content (29 lines) | stat: -rwxr-xr-x 570 bytes parent folder | download | duplicates (10)
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
#!/usr/bin/env python3

import os
import sys
import shutil

shutil.rmtree('ofiles',ignore_errors=True)
os.makedirs('ofiles',exist_ok=True)

done = set()

i = 0

def doit(d):
  global i
  if d in done: return
  done.add(d)
  for fn in sorted(os.listdir(d)):
    if fn.endswith('.o'):
      shutil.copy2('%s/%s' % (d,fn),'ofiles/%d-%s-%s' % (i,d.replace('/','_').replace('-','_'),fn))
      i += 1
  if os.path.exists(d+'/dependencies'):
    with open(d+'/dependencies') as f:
      for line in f:
        doit(line.strip())

for d in sys.stdin:
  d = d.strip()
  doit(d)