Created
November 4, 2019 17:59
-
-
Save jgsogo/8570ed51bea04ada7f6b622da607caf6 to your computer and use it in GitHub Desktop.
This is patch that might be used in https://github.com/conan-io/conan/pull/6014. Remove if merged.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/conans/client/cache/cache.py b/conans/client/cache/cache.py | |
index 52a6803f6..eede92fc9 100644 | |
--- a/conans/client/cache/cache.py | |
+++ b/conans/client/cache/cache.py | |
@@ -124,7 +124,7 @@ class ClientCache(object): | |
return join(self.cache_folder, ARTIFACTS_PROPERTIES_FILE) | |
def read_artifacts_properties(self): | |
- ret = {} | |
+ ret = [] | |
if not os.path.exists(self.artifacts_properties_path): | |
save(self.artifacts_properties_path, "") | |
return ret | |
@@ -137,7 +137,7 @@ class ClientCache(object): | |
raise Exception() | |
name = tmp[0].strip() | |
value = tmp[1].strip() | |
- ret[str(name)] = str(value) | |
+ ret.append((name, value)) | |
return ret | |
except Exception: | |
raise ConanException("Invalid %s file!" % self.artifacts_properties_path) | |
diff --git a/conans/client/rest/client_routes.py b/conans/client/rest/client_routes.py | |
index 8719231c3..4bcee3b2c 100644 | |
--- a/conans/client/rest/client_routes.py | |
+++ b/conans/client/rest/client_routes.py | |
@@ -22,10 +22,10 @@ def _format_pref(url, pref, matrix_params=""): | |
def _remove_put_prefix(artifacts_properties): | |
len_prefix = len(ARTIFACTS_PROPERTIES_PUT_PREFIX) | |
- for key, value in artifacts_properties.items(): | |
+ for (key, value) in artifacts_properties: | |
if key.startswith(ARTIFACTS_PROPERTIES_PUT_PREFIX): | |
key = key[len_prefix:] | |
- yield key, value | |
+ yield (key, value) | |
class ClientCommonRouter(object): | |
@@ -36,9 +36,9 @@ class ClientCommonRouter(object): | |
self.base_url = base_url | |
if artifacts_properties: | |
- matrix_params = dict(_remove_put_prefix(artifacts_properties)) | |
+ matrix_params = list(_remove_put_prefix(artifacts_properties)) | |
self._matrix_params_str = ";" + ";".join(["{}={}".format(key, quote(value, safe='')) | |
- for key, value in matrix_params.items()]) | |
+ for key, value in matrix_params]) | |
else: | |
self._matrix_params_str = "" | |
diff --git a/conans/client/rest/rest_client_v1.py b/conans/client/rest/rest_client_v1.py | |
index 8fffac231..9da373971 100644 | |
--- a/conans/client/rest/rest_client_v1.py | |
+++ b/conans/client/rest/rest_client_v1.py | |
@@ -156,9 +156,10 @@ class RestV1Methods(RestCommonMethods): | |
output.rewrite_line("Uploading %s" % filename) | |
auth, dedup = self._file_server_capabilities(resource_url) | |
try: | |
+ art_properties = {key: value for (key, value) in self._artifacts_properties} | |
uploader.upload(resource_url, files[filename], auth=auth, dedup=dedup, | |
retry=retry, retry_wait=retry_wait, | |
- headers=self._artifacts_properties) | |
+ headers=art_properties) | |
except Exception as exc: | |
output.error("\nError uploading file: %s, '%s'" % (filename, exc)) | |
failed.append(filename) | |
diff --git a/conans/client/rest/rest_client_v2.py b/conans/client/rest/rest_client_v2.py | |
index da9e08bf3..46a38036c 100644 | |
--- a/conans/client/rest/rest_client_v2.py | |
+++ b/conans/client/rest/rest_client_v2.py | |
@@ -180,10 +180,11 @@ class RestV2Methods(RestCommonMethods): | |
self._output.rewrite_line("Uploading %s" % filename) | |
resource_url = urls[filename] | |
try: | |
+ art_properties = {key: value for (key, value) in self._artifacts_properties} | |
uploader.upload(resource_url, files[filename], auth=self.auth, | |
dedup=self._checksum_deploy, retry=retry, | |
retry_wait=retry_wait, | |
- headers=self._artifacts_properties) | |
+ headers=art_properties) | |
except (AuthenticationException, ForbiddenException): | |
raise | |
except Exception as exc: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment