diff options
Diffstat (limited to 'main.py')
-rwxr-xr-x | main.py | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -23,6 +23,7 @@ if __name__ == '__main__': | |||
23 | del magic | 23 | del magic |
24 | 24 | ||
25 | import getpass | 25 | import getpass |
26 | import imp | ||
26 | import netrc | 27 | import netrc |
27 | import optparse | 28 | import optparse |
28 | import os | 29 | import os |
@@ -167,16 +168,15 @@ def _MyRepoPath(): | |||
167 | def _MyWrapperPath(): | 168 | def _MyWrapperPath(): |
168 | return os.path.join(os.path.dirname(__file__), 'repo') | 169 | return os.path.join(os.path.dirname(__file__), 'repo') |
169 | 170 | ||
171 | _wrapper_module = None | ||
172 | def WrapperModule(): | ||
173 | global _wrapper_module | ||
174 | if not _wrapper_module: | ||
175 | _wrapper_module = imp.load_source('wrapper', _MyWrapperPath()) | ||
176 | return _wrapper_module | ||
177 | |||
170 | def _CurrentWrapperVersion(): | 178 | def _CurrentWrapperVersion(): |
171 | VERSION = None | 179 | return WrapperModule().VERSION |
172 | pat = re.compile(r'^VERSION *=') | ||
173 | fd = open(_MyWrapperPath()) | ||
174 | for line in fd: | ||
175 | if pat.match(line): | ||
176 | fd.close() | ||
177 | exec line | ||
178 | return VERSION | ||
179 | raise NameError, 'No VERSION in repo script' | ||
180 | 180 | ||
181 | def _CheckWrapperVersion(ver, repo_path): | 181 | def _CheckWrapperVersion(ver, repo_path): |
182 | if not repo_path: | 182 | if not repo_path: |