summaryrefslogtreecommitdiff
path: root/sys/src/cmd/python/Demo/scripts/mkrcs.py
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2021-06-14 00:00:37 +0000
committerOri Bernstein <ori@eigenstate.org>2021-06-14 00:00:37 +0000
commita73a964e51247ed169d322c725a3a18859f109a3 (patch)
tree3f752d117274d444bda44e85609aeac1acf313f3 /sys/src/cmd/python/Demo/scripts/mkrcs.py
parente64efe273fcb921a61bf27d33b230c4e64fcd425 (diff)
python, hg: tow outside the environment.
they've served us well, and can ride off into the sunset.
Diffstat (limited to 'sys/src/cmd/python/Demo/scripts/mkrcs.py')
-rwxr-xr-xsys/src/cmd/python/Demo/scripts/mkrcs.py61
1 files changed, 0 insertions, 61 deletions
diff --git a/sys/src/cmd/python/Demo/scripts/mkrcs.py b/sys/src/cmd/python/Demo/scripts/mkrcs.py
deleted file mode 100755
index cacdda0a5..000000000
--- a/sys/src/cmd/python/Demo/scripts/mkrcs.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#! /usr/bin/env python
-
-# A rather specialized script to make sure that a symbolic link named
-# RCS exists pointing to a real RCS directory in a parallel tree
-# referenced as RCStree in an ancestor directory.
-# (I use this because I like my RCS files to reside on a physically
-# different machine).
-
-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)
-
-def makedirs(p):
- if not os.path.isdir(p):
- head, tail = os.path.split(p)
- makedirs(head)
- os.mkdir(p, 0777)
-
-if __name__ == "__main__":
- main()