entangled-cli 2.1.2__tar.gz → 2.1.4__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.
Files changed (42) hide show
  1. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/PKG-INFO +1 -1
  2. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/filedb.py +4 -4
  3. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/transaction.py +8 -1
  4. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/pyproject.toml +1 -1
  5. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/LICENSE +0 -0
  6. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/README.md +0 -0
  7. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/__init__.py +0 -0
  8. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/code_reader.py +0 -0
  9. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/commands/__init__.py +0 -0
  10. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/commands/brei.py +0 -0
  11. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/commands/new.py +0 -0
  12. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/commands/status.py +0 -0
  13. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/commands/stitch.py +0 -0
  14. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/commands/sync.py +0 -0
  15. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/commands/tangle.py +0 -0
  16. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/commands/watch.py +0 -0
  17. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/config/__init__.py +0 -0
  18. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/config/language.py +0 -0
  19. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/config/templates.py +0 -0
  20. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/config/version.py +0 -0
  21. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/construct.py +0 -0
  22. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/document.py +0 -0
  23. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/errors/__init__.py +0 -0
  24. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/errors/internal.py +0 -0
  25. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/errors/user.py +0 -0
  26. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/hooks/__init__.py +0 -0
  27. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/hooks/base.py +0 -0
  28. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/hooks/build.py +0 -0
  29. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/hooks/quarto_attributes.py +0 -0
  30. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/hooks/shebang.py +0 -0
  31. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/hooks/task.py +0 -0
  32. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/logging.py +0 -0
  33. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/main.py +0 -0
  34. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/markdown_reader.py +0 -0
  35. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/parsing.py +0 -0
  36. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/properties.py +0 -0
  37. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/py.typed +0 -0
  38. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/status.py +0 -0
  39. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/tangle.py +0 -0
  40. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/text_location.py +0 -0
  41. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/utility.py +0 -0
  42. {entangled_cli-2.1.2 → entangled_cli-2.1.4}/entangled/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: entangled-cli
3
- Version: 2.1.2
3
+ Version: 2.1.4
4
4
  Summary: Literate Programming toolbox
5
5
  Home-page: https://entangled.github.io/
6
6
  License: Apache 2
@@ -20,7 +20,7 @@ def hexdigest(s: str) -> str:
20
20
  """Creates a MD5 hash digest from a string. Before hashing, the string has
21
21
  linefeed `\\r` characters and trailing newlines removed, and the string
22
22
  is encoded as UTF-8."""
23
- content = s.replace("\r", "").rstrip("\n").encode()
23
+ content = s.replace("\r", "").rstrip().encode()
24
24
  return hashlib.sha256(content).hexdigest()
25
25
 
26
26
 
@@ -111,9 +111,9 @@ class FileDB:
111
111
  logging.debug("Writing FileDB")
112
112
  raw = {
113
113
  "version": __version__,
114
- "files": [stat.to_json() for stat in self._files.values()],
115
- "source": list(map(str, self._source)),
116
- "target": list(map(str, self._target)),
114
+ "files": sorted([stat.to_json() for stat in self._files.values()], key=lambda s: s["path"]),
115
+ "source": list(sorted(map(str, self._source))),
116
+ "target": list(sorted(map(str, self._target))),
117
117
  }
118
118
  json.dump(raw, open(FileDB.path(), "w"), indent=2, sort_keys=True)
119
119
 
@@ -75,6 +75,13 @@ class Create(Action):
75
75
  return f"create `{self.target}`"
76
76
 
77
77
 
78
+ def assure_final_newline(str) -> str:
79
+ if str[-1] != "\n":
80
+ return str + "\n"
81
+ else:
82
+ return str
83
+
84
+
78
85
  @dataclass
79
86
  class Write(Action):
80
87
  content: str
@@ -96,7 +103,7 @@ class Write(Action):
96
103
  tmp_dir = Path() / ".entangled" / "tmp"
97
104
  tmp_dir.mkdir(exist_ok=True, parents=True)
98
105
  with tempfile.NamedTemporaryFile(mode="w", delete=False, dir=tmp_dir) as f:
99
- f.write(self.content)
106
+ f.write(assure_final_newline(self.content))
100
107
  # Flush and sync contents to disk
101
108
  f.flush()
102
109
  if self.mode is not None:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "entangled-cli"
3
- version = "2.1.2"
3
+ version = "2.1.4"
4
4
  description = "Literate Programming toolbox"
5
5
  repository = "https://github.com/entangled/entangled.py"
6
6
  homepage = "https://entangled.github.io/"
File without changes
File without changes