lovelytics-cli 0.4.16__tar.gz → 0.4.18__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lovelytics-cli
3
- Version: 0.4.16
3
+ Version: 0.4.18
4
4
  Summary: Development tools for Lovelytics Labs.
5
5
  License: LICENSE
6
6
  License-File: LICENSE
@@ -1,5 +1,7 @@
1
1
  """Core logic for installing crates from CodeArtifact."""
2
2
 
3
+ import csv
4
+ import io
3
5
  import json
4
6
  import logging
5
7
  import os
@@ -146,6 +148,17 @@ def ensure_crate_binary() -> str:
146
148
  )
147
149
 
148
150
 
151
+ def _csv_quote(entry: str) -> str:
152
+ """CSV-encode one entry, since crate's --variable flag parses its value as CSV.
153
+
154
+ Entries containing a comma or double quote come back quoted (quotes doubled);
155
+ all other entries are returned unchanged.
156
+ """
157
+ buf = io.StringIO()
158
+ csv.writer(buf, lineterminator="").writerow([entry])
159
+ return buf.getvalue()
160
+
161
+
149
162
  def build_crate_install_args(source_path: str, params: dict) -> list:
150
163
  """Build the list of CLI arguments for the crate install command."""
151
164
  args = ["--path", source_path]
@@ -155,12 +168,7 @@ def build_crate_install_args(source_path: str, params: dict) -> list:
155
168
  if flag:
156
169
  args.extend([flag, str(value)])
157
170
  else:
158
- # crate's --variable splits on commas and quotes; such values can't round-trip.
159
- if "," in str(value) or '"' in str(value):
160
- raise click.ClickException(
161
- f"Parameter '{key}' must not contain a comma or double quote."
162
- )
163
171
  # Anything else is a crate variable (crate.yaml `variables:`).
164
- args.extend(["--variable", f"{key}={value}"])
172
+ args.extend(["--variable", _csv_quote(f"{key}={value}")])
165
173
 
166
174
  return args
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "lovelytics-cli"
3
- version = "0.4.16"
3
+ version = "0.4.18"
4
4
  description = "Development tools for Lovelytics Labs."
5
5
  authors = ["Lovelytics Labs <labs@lovelytics.com>"]
6
6
  readme = "README.md"
File without changes