File: ofiles

package info (click to toggle)
lib25519 0~20241004-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 51,500 kB
  • sloc: asm: 317,113; ansic: 36,370; python: 5,332; sh: 482; makefile: 156; pascal: 13
file content (29 lines) | stat: -rwxr-xr-x 570 bytes parent folder | download | duplicates (8)
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)