summaryrefslogtreecommitdiffstats
path: root/Demo/scripts/mkrcs.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-07-18 05:56:09 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-07-18 05:56:09 (GMT)
commite6ddc8b20b493fef2e7cffb2e1351fe1d238857e (patch)
tree3b3d8fcd92e1d8f0cad44297d5c2ae8522bb984c /Demo/scripts/mkrcs.py
parent4fba4521e836e0cab08316592392b1e4d06eb6ef (diff)
downloadcpython-e6ddc8b20b493fef2e7cffb2e1351fe1d238857e.zip
cpython-e6ddc8b20b493fef2e7cffb2e1351fe1d238857e.tar.gz
cpython-e6ddc8b20b493fef2e7cffb2e1351fe1d238857e.tar.bz2
Whitespace normalization. Ran reindent.py over the entire source tree.
Diffstat (limited to 'Demo/scripts/mkrcs.py')
-rwxr-xr-xDemo/scripts/mkrcs.py90
1 files changed, 45 insertions, 45 deletions
diff --git a/Demo/scripts/mkrcs.py b/Demo/scripts/mkrcs.py
index 917b4fe..45a68b9 100755
--- a/Demo/scripts/mkrcs.py
+++ b/Demo/scripts/mkrcs.py
@@ -9,52 +9,52 @@
import os
def main():
- rcstree = 'RCStree'
- rcs = 'RCS'
- if os.path.islink(rcs):
- print '%r is a symlink to %r' % (rcs, os.readlink(rcs))
- return
- if os.path.isdir(rcs):
- print '%r is an ordinary directory' % (rcs,)
- return
- if os.path.exists(rcs):
- print '%r is a file?!?!' % (rcs,)
- return
- #
- p = os.getcwd()
- up = ''
- down = ''
- # Invariants:
- # (1) join(p, down) is the current directory
- # (2) up is the same directory as p
- # Ergo:
- # (3) join(up, down) is the current directory
- #print 'p =', repr(p)
- while not os.path.isdir(os.path.join(p, rcstree)):
- head, tail = os.path.split(p)
- #print 'head = %r; tail = %r' % (head, tail)
- if not tail:
- print 'Sorry, no ancestor dir contains %r' % (rcstree,)
- return
- p = head
- up = os.path.join(os.pardir, up)
- down = os.path.join(tail, down)
- #print 'p = %r; up = %r; down = %r' % (p, up, down)
- there = os.path.join(up, rcstree)
- there = os.path.join(there, down)
- there = os.path.join(there, rcs)
- if os.path.isdir(there):
- print '%r already exists' % (there, )
- else:
- print 'making %r' % (there,)
- makedirs(there)
- print 'making symlink %r -> %r' % (rcs, there)
- os.symlink(there, rcs)
+ rcstree = 'RCStree'
+ rcs = 'RCS'
+ if os.path.islink(rcs):
+ print '%r is a symlink to %r' % (rcs, os.readlink(rcs))
+ return
+ if os.path.isdir(rcs):
+ print '%r is an ordinary directory' % (rcs,)
+ return
+ if os.path.exists(rcs):
+ print '%r is a file?!?!' % (rcs,)
+ return
+ #
+ p = os.getcwd()
+ up = ''
+ down = ''
+ # Invariants:
+ # (1) join(p, down) is the current directory
+ # (2) up is the same directory as p
+ # Ergo:
+ # (3) join(up, down) is the current directory
+ #print 'p =', repr(p)
+ while not os.path.isdir(os.path.join(p, rcstree)):
+ head, tail = os.path.split(p)
+ #print 'head = %r; tail = %r' % (head, tail)
+ if not tail:
+ print 'Sorry, no ancestor dir contains %r' % (rcstree,)
+ return
+ p = head
+ up = os.path.join(os.pardir, up)
+ down = os.path.join(tail, down)
+ #print 'p = %r; up = %r; down = %r' % (p, up, down)
+ there = os.path.join(up, rcstree)
+ there = os.path.join(there, down)
+ there = os.path.join(there, rcs)
+ if os.path.isdir(there):
+ print '%r already exists' % (there, )
+ else:
+ print 'making %r' % (there,)
+ makedirs(there)
+ print 'making symlink %r -> %r' % (rcs, there)
+ os.symlink(there, rcs)
def makedirs(p):
- if not os.path.isdir(p):
- head, tail = os.path.split(p)
- makedirs(head)
- os.mkdir(p, 0777)
+ if not os.path.isdir(p):
+ head, tail = os.path.split(p)
+ makedirs(head)
+ os.mkdir(p, 0777)
main()