diff options
-rw-r--r-- | project.py | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -63,6 +63,10 @@ def _error(fmt, *args): | |||
63 | msg = fmt % args | 63 | msg = fmt % args |
64 | print('error: %s' % msg, file=sys.stderr) | 64 | print('error: %s' % msg, file=sys.stderr) |
65 | 65 | ||
66 | def _warn(fmt, *args): | ||
67 | msg = fmt % args | ||
68 | print('warn: %s' % msg, file=sys.stderr) | ||
69 | |||
66 | def not_rev(r): | 70 | def not_rev(r): |
67 | return '^' + r | 71 | return '^' + r |
68 | 72 | ||
@@ -1092,8 +1096,7 @@ class Project(object): | |||
1092 | tar.extractall(path=path) | 1096 | tar.extractall(path=path) |
1093 | return True | 1097 | return True |
1094 | except (IOError, tarfile.TarError) as e: | 1098 | except (IOError, tarfile.TarError) as e: |
1095 | print("error: Cannot extract archive %s: " | 1099 | _error("Cannot extract archive %s: %s", tarpath, str(e)) |
1096 | "%s" % (tarpath, str(e)), file=sys.stderr) | ||
1097 | return False | 1100 | return False |
1098 | 1101 | ||
1099 | def Sync_NetworkHalf(self, | 1102 | def Sync_NetworkHalf(self, |
@@ -1110,8 +1113,7 @@ class Project(object): | |||
1110 | """ | 1113 | """ |
1111 | if archive and not isinstance(self, MetaProject): | 1114 | if archive and not isinstance(self, MetaProject): |
1112 | if self.remote.url.startswith(('http://', 'https://')): | 1115 | if self.remote.url.startswith(('http://', 'https://')): |
1113 | print("error: %s: Cannot fetch archives from http/https " | 1116 | _error("%s: Cannot fetch archives from http/https remotes.", self.name) |
1114 | "remotes." % self.name, file=sys.stderr) | ||
1115 | return False | 1117 | return False |
1116 | 1118 | ||
1117 | name = self.relpath.replace('\\', '/') | 1119 | name = self.relpath.replace('\\', '/') |
@@ -1122,7 +1124,7 @@ class Project(object): | |||
1122 | try: | 1124 | try: |
1123 | self._FetchArchive(tarpath, cwd=topdir) | 1125 | self._FetchArchive(tarpath, cwd=topdir) |
1124 | except GitError as e: | 1126 | except GitError as e: |
1125 | print('error: %s' % str(e), file=sys.stderr) | 1127 | _error('%s', e) |
1126 | return False | 1128 | return False |
1127 | 1129 | ||
1128 | # From now on, we only need absolute tarpath | 1130 | # From now on, we only need absolute tarpath |
@@ -1133,8 +1135,7 @@ class Project(object): | |||
1133 | try: | 1135 | try: |
1134 | os.remove(tarpath) | 1136 | os.remove(tarpath) |
1135 | except OSError as e: | 1137 | except OSError as e: |
1136 | print("warn: Cannot remove archive %s: " | 1138 | _warn("Cannot remove archive %s: %s", tarpath, str(e)) |
1137 | "%s" % (tarpath, str(e)), file=sys.stderr) | ||
1138 | self._CopyAndLinkFiles() | 1139 | self._CopyAndLinkFiles() |
1139 | return True | 1140 | return True |
1140 | if is_new is None: | 1141 | if is_new is None: |