Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: third_party/twisted_8_1/twisted/conch/ls.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2001-2005 Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 import array
5 import stat
6 import time
7
8 def lsLine(name, s):
9 mode = s.st_mode
10 perms = array.array('c', '-'*10)
11 ft = stat.S_IFMT(mode)
12 if stat.S_ISDIR(ft): perms[0] = 'd'
13 elif stat.S_ISCHR(ft): perms[0] = 'c'
14 elif stat.S_ISBLK(ft): perms[0] = 'b'
15 elif stat.S_ISREG(ft): perms[0] = '-'
16 elif stat.S_ISFIFO(ft): perms[0] = 'f'
17 elif stat.S_ISLNK(ft): perms[0] = 'l'
18 elif stat.S_ISSOCK(ft): perms[0] = 's'
19 else: perms[0] = '!'
20 # user
21 if mode&stat.S_IRUSR:perms[1] = 'r'
22 if mode&stat.S_IWUSR:perms[2] = 'w'
23 if mode&stat.S_IXUSR:perms[3] = 'x'
24 # group
25 if mode&stat.S_IRGRP:perms[4] = 'r'
26 if mode&stat.S_IWGRP:perms[5] = 'w'
27 if mode&stat.S_IXGRP:perms[6] = 'x'
28 # other
29 if mode&stat.S_IROTH:perms[7] = 'r'
30 if mode&stat.S_IWOTH:perms[8] = 'w'
31 if mode&stat.S_IXOTH:perms[9] = 'x'
32 # suid/sgid
33 if mode&stat.S_ISUID:
34 if perms[3] == 'x': perms[3] = 's'
35 else: perms[3] = 'S'
36 if mode&stat.S_ISGID:
37 if perms[6] == 'x': perms[6] = 's'
38 else: perms[6] = 'S'
39 l = perms.tostring()
40 l += str(s.st_nlink).rjust(5) + ' '
41 un = str(s.st_uid)
42 l += un.ljust(9)
43 gr = str(s.st_gid)
44 l += gr.ljust(9)
45 sz = str(s.st_size)
46 l += sz.rjust(8)
47 l += ' '
48 sixmo = 60 * 60 * 24 * 7 * 26
49 if s.st_mtime + sixmo < time.time(): # last edited more than 6mo ago
50 l += time.strftime("%b %2d %Y ", time.localtime(s.st_mtime))
51 else:
52 l += time.strftime("%b %2d %H:%S ", time.localtime(s.st_mtime))
53 l += name
54 return l
55
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/conch/interfaces.py ('k') | third_party/twisted_8_1/twisted/conch/manhole.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698