Changeset 127 in tailor for vcpx/tailor.py
- Timestamp:
- 08/02/04 17:38:10 (9 years ago)
- Hash name:
- 20040802153810-e4df3-99fb5cf64efcee831e26d2ac025bf588113f1b0b
- File:
-
- 1 edited
-
vcpx/tailor.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vcpx/tailor.py
r126 r127 21 21 LOG_FILENAME = 'tailor.log' 22 22 23 def relpathto(source, dest): 24 from os.path import abspath, split, commonprefix 25 26 source = abspath(source) 27 dest = abspath(dest) 28 29 if source.startswith(dest): 30 return source[len(dest)+1:] 31 32 prefix = commonprefix([source, dest]) 33 34 source = source[len(prefix):] 35 dest = dest[len(prefix):] 36 37 return '../' * len(dest.split('/')) + source 38 39 23 40 class TailorConfig(object): 24 41 def __init__(self, options): 42 from os.path import split 43 25 44 self.options = options 45 self.basedir = split(options.configfile)[0] 26 46 27 47 def __call__(self, args): 28 from os.path import abspath 48 from os.path import abspath, join 29 49 30 50 self.__load() 31 51 32 52 if len(args) == 0 and self.options.update: 33 args = self.config.keys()53 args = [join(self.basedir, r) for r in self.config.keys()] 34 54 35 55 for a in args: … … 70 90 71 91 def loadProject(self, project): 72 info = self.config.get(project.root) 73 92 relpath = relpathto(project.root, self.basedir) 93 94 info = self.config.get(relpath) 74 95 if info: 75 96 project.source_kind = info['source_kind'] … … 82 103 83 104 def saveProject(self, project): 84 self.config[project.root] = { 105 relpath = relpathto(project.root, self.basedir) 106 107 self.config[relpath] = { 85 108 'source_kind': project.source_kind, 86 109 'target_kind': project.target_kind,
Note: See TracChangeset
for help on using the changeset viewer.
