summaryrefslogtreecommitdiffstats
path: root/Demo
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-04-26 22:57:12 (GMT)
committerGuido van Rossum <guido@python.org>1995-04-26 22:57:12 (GMT)
commitbec818a14f18cf3b5f4acf8291f59daea5185d77 (patch)
tree1f186f2e109ba929d6f6485ce9ebaf4b80274c3d /Demo
parent5f07b84796c207a0068f6ac5a0d6981d14801ff6 (diff)
downloadcpython-bec818a14f18cf3b5f4acf8291f59daea5185d77.zip
cpython-bec818a14f18cf3b5f4acf8291f59daea5185d77.tar.gz
cpython-bec818a14f18cf3b5f4acf8291f59daea5185d77.tar.bz2
first remote commit test!!!
Diffstat (limited to 'Demo')
-rwxr-xr-xDemo/pdist/cmptree.py31
-rwxr-xr-xDemo/pdist/server.py2
2 files changed, 28 insertions, 5 deletions
diff --git a/Demo/pdist/cmptree.py b/Demo/pdist/cmptree.py
index 84ed3f0..7eaa6c3 100755
--- a/Demo/pdist/cmptree.py
+++ b/Demo/pdist/cmptree.py
@@ -35,7 +35,7 @@ d - delete disappearing files, either remote or local
t2 = time.time()
dt = t2-t1
mins, secs = divmod(dt, 60)
- print mins, "minutes and", secs, "seconds"
+ print mins, "minutes and", round(secs), "seconds"
raw_input("[Return to exit] ")
def ask(prompt, default):
@@ -103,6 +103,18 @@ def compare(local, remote, mode):
common.append(name)
else:
print "Remote subdirectory", repr(name), "not found locally"
+ if 'r' in mode and 'c' in mode:
+ pr = "Create local subdirectory %s? [y] " % \
+ repr(name)
+ if 'y' in mode:
+ ok = 'y'
+ else:
+ ok = ask(pr, "y")
+ if ok[:1] in ('y', 'Y'):
+ local.mkdir(name)
+ print "Subdirectory %s made" % \
+ repr(name)
+ common.append(name)
lsubdirs = local.listsubdirs()
for name in lsubdirs:
if name not in subdirs:
@@ -135,12 +147,23 @@ def sendfile(local, remote, name):
t2 = time.time()
dt = t2-t1
- print len(data), "bytes in", t2-t1, "seconds",
+ print len(data), "bytes in", round(dt), "seconds",
if dt:
- print "i.e.", len(data)/dt, "bytes/sec",
+ print "i.e.", round(len(data)/dt), "bytes/sec",
print
def recvfile(local, remote, name):
+ ok = 0
+ try:
+ rv = recvfile_real(local, remote, name)
+ ok = 1
+ return rv
+ finally:
+ if not ok:
+ print "*** recvfile of %s failed, deleting" % `name`
+ local.delete(name)
+
+def recvfile_real(local, remote, name):
try:
local.create(name)
except (IOError, os.error), msg:
@@ -172,7 +195,7 @@ def recvfile(local, remote, name):
f.close()
dt = t2-t1
- print size, "bytes in", dt, "seconds",
+ print size, "bytes in", round(dt), "seconds",
if dt:
print "i.e.", int(size/dt), "bytes/sec",
print
diff --git a/Demo/pdist/server.py b/Demo/pdist/server.py
index 5d42abc..c8acf19 100755
--- a/Demo/pdist/server.py
+++ b/Demo/pdist/server.py
@@ -58,7 +58,7 @@ class Server:
if self._verbose > 1: print "Wait for next request ..."
ok = self._dorequest(rf, wf)
- _valid = ['192.16.201.*', '192.16.197.*']
+ _valid = ['192.16.201.*', '192.16.197.*', '132.151.1.*']
def _verify(self, conn, address):
host, port = address