Mercurial > cgi-bin > hgweb.cgi > tincan
comparison install-static @ 50:ccd52fb45cff draft
Fix some bugs.
author | David Barts <n5jrn@me.com> |
---|---|
date | Thu, 30 May 2019 21:55:26 -0700 |
parents | 15f665a620a2 |
children | caed7c5e8318 |
comparison
equal
deleted
inserted
replaced
49:15f665a620a2 | 50:ccd52fb45cff |
---|---|
32 if entry.startswith(".") or os.path.splitext(entry)[1] in NOT_STATIC: | 32 if entry.startswith(".") or os.path.splitext(entry)[1] in NOT_STATIC: |
33 continue | 33 continue |
34 spath = os.path.join(source, entry) | 34 spath = os.path.join(source, entry) |
35 tpath = os.path.join(target, entry) | 35 tpath = os.path.join(target, entry) |
36 stype = os.stat(spath).st_mode | 36 stype = os.stat(spath).st_mode |
37 try: | |
38 ttype = os.stat(tpath).st_mode | |
39 except FileNotFoundError: | |
40 ttype = None | |
37 if S_ISREG(stype): | 41 if S_ISREG(stype): |
42 if ttype is not None and not S_ISREG(ttype): | |
43 sys.stderr.write( | |
44 "{0}: {1!r} not a file\n".format(MYNAME, tpath)) | |
45 sys.exit(1) | |
38 if args.move: | 46 if args.move: |
39 print("mv", repr(spath), repr(tpath)) | 47 print("mv", repr(spath), repr(tpath)) |
40 shutil.move(spath, tpath) | 48 shutil.move(spath, tpath) |
41 else: | 49 else: |
42 print("cp", repr(spath), repr(tpath)) | 50 print("cp", repr(spath), repr(tpath)) |
43 copyfile(spath, tpath) | 51 copyfile(spath, tpath) |
44 elif S_ISDIR(stype): | 52 elif S_ISDIR(stype): |
45 if not os.path.isdir(tpath): | 53 if ttype is not None and not S_ISDIR(ttype): |
54 sys.stderr.write( | |
55 "{0}: {1!r} not a directory\n".format(MYNAME, tpath)) | |
56 sys.exit(1) | |
57 if not S_ISDIR(ttype): | |
46 print("mkdir", repr(tpath)) | 58 print("mkdir", repr(tpath)) |
47 os.mkdir(tpath) | 59 os.mkdir(tpath) |
48 copydir(spath, tpath, False) | 60 copydir(spath, tpath, False) |
49 else: | 61 else: |
50 sys.stderr.write( | 62 sys.stderr.write( |