~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to bin/svn_relocate.py

  • Committer: Matt Giuca
  • Date: 2009-12-01 04:27:58 UTC
  • mfrom: (1164.2.46 sphinx-docs)
  • Revision ID: matt.giuca@gmail.com-20091201042758-wuxd9bdec00c283i
Merged sphinx-docs branch. This adds Sphinx documentation for the entire IVLE system (for system administrators and developers), and removes all of our random old document files (all either irrelevant, or moved into the Sphinx docs nicely). Currently incomplete, but ready to merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
 
3
 
import os, stat, sys
4
 
 
5
 
def update(file, pattern, replacement, verbose=False):
6
 
    if verbose:
7
 
        print "Updating:", file
8
 
 
9
 
    # make sure we can write the file   
10
 
    old_perm = os.stat(file)[0]
11
 
    if not os.access(file, os.W_OK):
12
 
        os.chmod(file, old_perm | stat.S_IWRITE)
13
 
 
14
 
    # write the file
15
 
    s = open(file, 'rb').read()
16
 
    out = open(file, 'wb')
17
 
    out.write(s.replace(pattern, replacement))
18
 
    out.close()
19
 
   
20
 
    # restore permissions
21
 
    os.chmod(file, old_perm)
22
 
 
23
 
            
24
 
old_uuid = "4d949360-5a40-0410-921c-d637654a4d6e" # IVLE at SourceForge
25
 
new_uuid = "2b9c9e99-6f39-0410-b283-7f802c844ae2" # IVLE at GoogleCode
26
 
 
27
 
for root, dirs, files in os.walk('.'):
28
 
    if root.endswith('.svn'):
29
 
        update(os.path.join(root, 'entries'), old_uuid, new_uuid, True)
30
 
 
31