File: localsetup.py

package info (click to toggle)
psyco-doc 1.6-2
  • links: PTS
  • area: contrib
  • in suites: squeeze
  • size: 1,832 kB
  • ctags: 3,236
  • sloc: ansic: 23,895; python: 5,646; perl: 1,309; makefile: 153
file content (20 lines) | stat: -rw-r--r-- 689 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os

dir = os.path.join(os.path.dirname(__file__), 'prolog')
for filename in os.listdir(dir):
    if filename.lower().endswith('.default'):
        basename = os.path.join(dir, filename[:-8])
        filename = os.path.join(dir, filename)
        if not os.path.exists(basename):
            copy = 2
        else:
            try:
                copy = os.stat(filename).st_mtime > os.stat(basename).st_mtime
            except OSError:
                copy = 0
        if copy:
            print 'Copying', filename, '->', basename
            if copy != 2:
                print '(OVERRIDING the older file)'
            import shutil
            shutil.copy(filename, basename)