Mercurial > dive4elements > river
comparison flys-backend/contrib/shpimporter/utils.py @ 3654:59ca5dab2782
Shape importer: use python's OptionParse to read user specific configuration from command line.
flys-backend/trunk@5231 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 22 Aug 2012 11:55:55 +0000 |
parents | 5a654f2e35bc |
children | b1d7e600b43b |
comparison
equal
deleted
inserted
replaced
3653:20d249e1589f | 3654:59ca5dab2782 |
---|---|
1 import os | 1 import os |
2 from shpimporter import DEBUG, INFO, ERROR | |
2 | 3 |
3 SHP='.shp' | 4 SHP='.shp' |
4 | 5 |
5 def findShapefiles(path): | 6 def findShapefiles(path): |
6 shapes = [] | 7 shapes = [] |
7 | 8 |
8 for root, dirs, files in os.walk(path): | 9 for root, dirs, files in os.walk(path): |
9 if len(files) == 0: | 10 if len(files) == 0: |
10 continue | 11 continue |
11 | 12 |
12 print "Processing directory '%s' with %i files " % (root, len(files)) | 13 DEBUG("Processing directory '%s' with %i files " % (root, len(files))) |
13 | 14 |
14 for f in files: | 15 for f in files: |
15 idx = f.find(SHP) | 16 idx = f.find(SHP) |
16 if (idx+len(SHP)) == len(f): | 17 if (idx+len(SHP)) == len(f): |
17 shapes.append((f.replace(SHP, ''), root + "/" + f)) | 18 shapes.append((f.replace(SHP, ''), root + "/" + f)) |