diff options
Diffstat (limited to 'main.py')
| -rwxr-xr-x | main.py | 19 |
1 files changed, 9 insertions, 10 deletions
| @@ -23,10 +23,10 @@ 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 |
| 29 | import re | ||
| 30 | import sys | 30 | import sys |
| 31 | import time | 31 | import time |
| 32 | import urllib2 | 32 | import urllib2 |
| @@ -167,16 +167,15 @@ def _MyRepoPath(): | |||
| 167 | def _MyWrapperPath(): | 167 | def _MyWrapperPath(): |
| 168 | return os.path.join(os.path.dirname(__file__), 'repo') | 168 | return os.path.join(os.path.dirname(__file__), 'repo') |
| 169 | 169 | ||
| 170 | _wrapper_module = None | ||
| 171 | def WrapperModule(): | ||
| 172 | global _wrapper_module | ||
| 173 | if not _wrapper_module: | ||
| 174 | _wrapper_module = imp.load_source('wrapper', _MyWrapperPath()) | ||
| 175 | return _wrapper_module | ||
| 176 | |||
| 170 | def _CurrentWrapperVersion(): | 177 | def _CurrentWrapperVersion(): |
| 171 | VERSION = None | 178 | 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 | 179 | ||
| 181 | def _CheckWrapperVersion(ver, repo_path): | 180 | def _CheckWrapperVersion(ver, repo_path): |
| 182 | if not repo_path: | 181 | if not repo_path: |
