Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ea1d97

Browse files
committed
The usual.
# Message to all python-checkins readers: we have a problem with the # CVS mirroring software. You can't check out the latest changes yet. # We hope to have fixed this by noon EST today.
1 parent fdd3028 commit 7ea1d97

6 files changed

Lines changed: 45 additions & 27 deletions

File tree

Lib/dos-8x3/cgihttps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def run_cgi(self):
145145
if line[:1] in string.whitespace:
146146
accept.append(string.strip(line))
147147
else:
148-
accept = accept + string.split(line[7:])
148+
accept = accept + string.split(line[7:], ',')
149149
env['HTTP_ACCEPT'] = string.joinfields(accept, ',')
150150
ua = self.headers.getheader('user-agent')
151151
if ua:

Lib/dos-8x3/compilea.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
"""
1414

1515
import os
16+
import stat
1617
import sys
1718
import py_compile
1819

19-
def compile_dir(dir, maxlevels=10, ddir=None):
20+
def compile_dir(dir, maxlevels=10, ddir=None, force=0):
2021
"""Byte-compile all modules in the given directory tree.
2122
2223
Arguments (only dir is required):
@@ -25,6 +26,7 @@ def compile_dir(dir, maxlevels=10, ddir=None):
2526
maxlevels: maximum recursion level (default 10)
2627
ddir: if given, purported directory name (this is the
2728
directory name that will show up in error messages)
29+
force: if 1, force compilation, even if timestamps are up-to-date
2830
2931
"""
3032
print 'Listing', dir, '...'
@@ -43,6 +45,11 @@ def compile_dir(dir, maxlevels=10, ddir=None):
4345
if os.path.isfile(fullname):
4446
head, tail = name[:-3], name[-3:]
4547
if tail == '.py':
48+
cfile = fullname + (__debug__ and 'c' or 'o')
49+
ftime = os.stat(fullname)[stat.ST_MTIME]
50+
try: ctime = os.stat(cfile)[stat.ST_MTIME]
51+
except os.error: ctime = 0
52+
if (ctime > ftime) and not force: continue
4653
print 'Compiling', fullname, '...'
4754
try:
4855
py_compile.compile(fullname, None, dfile)
@@ -58,48 +65,52 @@ def compile_dir(dir, maxlevels=10, ddir=None):
5865
name != os.curdir and name != os.pardir and \
5966
os.path.isdir(fullname) and \
6067
not os.path.islink(fullname):
61-
compile_dir(fullname, maxlevels - 1, dfile)
68+
compile_dir(fullname, maxlevels - 1, dfile, force)
6269

63-
def compile_path(skip_curdir=1, maxlevels=0):
70+
def compile_path(skip_curdir=1, maxlevels=0, force=0):
6471
"""Byte-compile all module on sys.path.
6572
6673
Arguments (all optional):
6774
6875
skip_curdir: if true, skip current directory (default true)
6976
maxlevels: max recursion level (default 0)
77+
force: as for compile_dir() (default 0)
7078
7179
"""
7280
for dir in sys.path:
7381
if (not dir or dir == os.curdir) and skip_curdir:
7482
print 'Skipping current directory'
7583
else:
76-
compile_dir(dir, maxlevels)
84+
compile_dir(dir, maxlevels, None, force)
7785

7886
def main():
7987
"""Script main program."""
8088
import getopt
8189
try:
82-
opts, args = getopt.getopt(sys.argv[1:], 'ld:')
90+
opts, args = getopt.getopt(sys.argv[1:], 'lfd:')
8391
except getopt.error, msg:
8492
print msg
85-
print "usage: compileall [-l] [-d destdir] [directory ...]"
93+
print "usage: compileall [-l] [-f] [-d destdir] [directory ...]"
8694
print "-l: don't recurse down"
95+
print "-f: force rebuild even if timestamps are up-to-date"
8796
print "-d destdir: purported directory name for error messages"
88-
print "if no arguments, -l sys.path is assumed"
97+
print "if no directory arguments, -l sys.path is assumed"
8998
sys.exit(2)
9099
maxlevels = 10
91100
ddir = None
101+
force = 0
92102
for o, a in opts:
93103
if o == '-l': maxlevels = 0
94104
if o == '-d': ddir = a
105+
if o == '-f': force = 1
95106
if ddir:
96107
if len(args) != 1:
97108
print "-d destdir require exactly one directory argument"
98109
sys.exit(2)
99110
try:
100111
if args:
101112
for dir in args:
102-
compile_dir(dir, maxlevels, ddir)
113+
compile_dir(dir, maxlevels, ddir, force)
103114
else:
104115
compile_path()
105116
except KeyboardInterrupt:

Lib/dos-8x3/exceptio.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
1313
Here is a rundown of the class hierarchy. You can change this by editing this
1414
file, but it isn't recommended. The class names described here are expected
15-
to be found by the bltinmodule.c file.
15+
to be found by the bltinmodule.c file. If you add classes here, you must
16+
modify bltinmodule.c or the exceptions won't be available in the __builtin__
17+
module, nor will they be accessible from C.
1618
17-
The classes with a `*' are new as of Python 1.5. They are defined as tuples
19+
The classes with a `*' are new since Python 1.5. They are defined as tuples
1820
containing the derived exceptions when string-based exceptions are used. If
1921
you define your own class based exceptions, they should be derived from
2022
Exception.
@@ -33,6 +35,9 @@
3335
|
3436
+-- EOFError
3537
+-- RuntimeError
38+
| |
39+
| +-- NotImplementedError(*)
40+
|
3641
+-- NameError
3742
+-- AttributeError
3843
+-- SyntaxError
@@ -130,6 +135,9 @@ class OSError(EnvironmentError):
130135
class RuntimeError(StandardError):
131136
pass
132137

138+
class NotImplementedError(RuntimeError):
139+
pass
140+
133141
class SystemError(StandardError):
134142
pass
135143

Lib/dos-8x3/simpleht.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def send_head(self):
6464
self.send_error(403, "Directory listing not supported")
6565
return None
6666
try:
67-
f = open(path)
67+
f = open(path, 'rb')
6868
except IOError:
6969
self.send_error(404, "File not found")
7070
return None
@@ -148,7 +148,7 @@ def guess_type(self, path):
148148

149149

150150
def test(HandlerClass = SimpleHTTPRequestHandler,
151-
ServerClass = SocketServer.TCPServer):
151+
ServerClass = BaseHTTPServer.HTTPServer):
152152
BaseHTTPServer.test(HandlerClass, ServerClass)
153153

154154

Lib/dos-8x3/socketse.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -273,18 +273,6 @@ def server_activate(self):
273273
pass
274274

275275

276-
if hasattr(socket, 'AF_UNIX'):
277-
278-
class UnixStreamServer(TCPServer):
279-
280-
address_family = socket.AF_UNIX
281-
282-
283-
class UnixDatagramServer(UDPServer):
284-
285-
address_family = socket.AF_UNIX
286-
287-
288276
class ForkingMixIn:
289277

290278
"""Mix-in class to handle each request in a new process."""
@@ -339,6 +327,17 @@ class ForkingTCPServer(ForkingMixIn, TCPServer): pass
339327
class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
340328
class ThreadingTCPServer(ThreadingMixIn, TCPServer): pass
341329

330+
if hasattr(socket, 'AF_UNIX'):
331+
332+
class UnixStreamServer(TCPServer):
333+
address_family = socket.AF_UNIX
334+
335+
class UnixDatagramServer(UDPServer):
336+
address_family = socket.AF_UNIX
337+
338+
class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): pass
339+
340+
class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): pass
342341

343342
class BaseRequestHandler:
344343

@@ -351,7 +350,7 @@ class BaseRequestHandler:
351350
defines a handle() method.
352351
353352
The handle() method can find the request as self.request, the
354-
client address as self.client_request, and the server (in case it
353+
client address as self.client_address, and the server (in case it
355354
needs access to per-server information) as self.server. Since a
356355
separate instance is created for each request, the handle() method
357356
can define arbitrary other instance variariables.

Lib/dos-8x3/userlist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def __getitem__(self, i): return self.data[i]
1919
def __setitem__(self, i, item): self.data[i] = item
2020
def __delitem__(self, i): del self.data[i]
2121
def __getslice__(self, i, j):
22-
userlist = UserList()
22+
userlist = self.__class__()
2323
userlist.data[:] = self.data[i:j]
2424
return userlist
2525
def __setslice__(self, i, j, list):

0 commit comments

Comments
 (0)