Blame view

obs/re6st/install-eggs 725 Bytes
Julien Muchembled committed
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 30 31 32 33
#!/usr/bin/python2
import errno, os, shutil, sys

path = set()

class Stop(Exception):
    pass

class SysPath(tuple):
    def __setitem__(self, i, v):
        path.update(v)
        raise Stop

sys_path = sys.path
try:
    sys.path = SysPath(sys_path)
    for x in sys.argv[2:]:
        try:
            execfile(os.path.join("bin", x))
        except Stop:
            pass
finally:
    sys.path = sys_path

dest = sys.argv[1]
for x in path:
    x = os.path.relpath(x)
    d = os.path.join(dest, x)
    try:
        os.mkdir(os.path.basename(x))
    except OSError as e:
        if e.errno != errno.EEXIST:
            raise
Julien Muchembled committed
34 35 36 37
    if os.path.isdir(x):
        shutil.copytree(x, d, True)
    else:
        shutil.copy2(x, d)