diff options
Diffstat (limited to 'main.py')
-rwxr-xr-x | main.py | 20 |
1 files changed, 5 insertions, 15 deletions
@@ -46,6 +46,7 @@ from error import NoSuchProjectError | |||
46 | from error import RepoChangedException | 46 | from error import RepoChangedException |
47 | from manifest_xml import XmlManifest | 47 | from manifest_xml import XmlManifest |
48 | from pager import RunPager | 48 | from pager import RunPager |
49 | from wrapper import WrapperPath, Wrapper | ||
49 | 50 | ||
50 | from subcmds import all_commands | 51 | from subcmds import all_commands |
51 | 52 | ||
@@ -169,21 +170,10 @@ class _Repo(object): | |||
169 | 170 | ||
170 | return result | 171 | return result |
171 | 172 | ||
173 | |||
172 | def _MyRepoPath(): | 174 | def _MyRepoPath(): |
173 | return os.path.dirname(__file__) | 175 | return os.path.dirname(__file__) |
174 | 176 | ||
175 | def _MyWrapperPath(): | ||
176 | return os.path.join(os.path.dirname(__file__), 'repo') | ||
177 | |||
178 | _wrapper_module = None | ||
179 | def WrapperModule(): | ||
180 | global _wrapper_module | ||
181 | if not _wrapper_module: | ||
182 | _wrapper_module = imp.load_source('wrapper', _MyWrapperPath()) | ||
183 | return _wrapper_module | ||
184 | |||
185 | def _CurrentWrapperVersion(): | ||
186 | return WrapperModule().VERSION | ||
187 | 177 | ||
188 | def _CheckWrapperVersion(ver, repo_path): | 178 | def _CheckWrapperVersion(ver, repo_path): |
189 | if not repo_path: | 179 | if not repo_path: |
@@ -193,7 +183,7 @@ def _CheckWrapperVersion(ver, repo_path): | |||
193 | print('no --wrapper-version argument', file=sys.stderr) | 183 | print('no --wrapper-version argument', file=sys.stderr) |
194 | sys.exit(1) | 184 | sys.exit(1) |
195 | 185 | ||
196 | exp = _CurrentWrapperVersion() | 186 | exp = Wrapper().VERSION |
197 | ver = tuple(map(int, ver.split('.'))) | 187 | ver = tuple(map(int, ver.split('.'))) |
198 | if len(ver) == 1: | 188 | if len(ver) == 1: |
199 | ver = (0, ver[0]) | 189 | ver = (0, ver[0]) |
@@ -205,7 +195,7 @@ def _CheckWrapperVersion(ver, repo_path): | |||
205 | !!! You must upgrade before you can continue: !!! | 195 | !!! You must upgrade before you can continue: !!! |
206 | 196 | ||
207 | cp %s %s | 197 | cp %s %s |
208 | """ % (exp_str, _MyWrapperPath(), repo_path), file=sys.stderr) | 198 | """ % (exp_str, WrapperPath(), repo_path), file=sys.stderr) |
209 | sys.exit(1) | 199 | sys.exit(1) |
210 | 200 | ||
211 | if exp > ver: | 201 | if exp > ver: |
@@ -214,7 +204,7 @@ def _CheckWrapperVersion(ver, repo_path): | |||
214 | ... You should upgrade soon: | 204 | ... You should upgrade soon: |
215 | 205 | ||
216 | cp %s %s | 206 | cp %s %s |
217 | """ % (exp_str, _MyWrapperPath(), repo_path), file=sys.stderr) | 207 | """ % (exp_str, WrapperPath(), repo_path), file=sys.stderr) |
218 | 208 | ||
219 | def _CheckRepoDir(repo_dir): | 209 | def _CheckRepoDir(repo_dir): |
220 | if not repo_dir: | 210 | if not repo_dir: |