File: make_symlinks.py

package info (click to toggle)
python-discogs-client 2.7.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 568 kB
  • sloc: python: 1,685; sh: 83; makefile: 18
file content (16 lines) | stat: -rwxr-xr-x 470 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env python
import os
import sys
from itertools import permutations

for name in sys.argv[1:]:
    print("doing {}".format(name))
    root, next = name.split('?')
    data, ext = next.split('.')
    elems = data.split('&')
    for permut in permutations(elems):
        link_name = "{}?{}.{}".format(root, '&'.join(permut), ext)
        if link_name == name:
            continue
        os.symlink(name, link_name)
        print("wrote {}".format(link_name))