drawio-python 0.1.4__py3-none-any.whl → 0.1.5__py3-none-any.whl

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.
drawio/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
drawio/render/desktop.py CHANGED
@@ -12,6 +12,7 @@ import os
12
12
  import shutil
13
13
  import subprocess
14
14
  import sys
15
+ import sysconfig
15
16
  from pathlib import Path
16
17
  from typing import Optional
17
18
 
@@ -34,13 +35,27 @@ _CANDIDATES = {
34
35
 
35
36
 
36
37
  def _is_ours(path: str) -> bool:
37
- """The `drawio` command of this Python package also sits on PATH; skip it."""
38
+ """Whether `path` is the `drawio` command of a Python package rather than draw.io desktop.
39
+
40
+ pip installs that command as a script with a Python shebang on Linux and macOS, and as
41
+ an .exe launcher with the script appended (uncompressed) on Windows. Anything inside a
42
+ Python scripts directory counts as ours too.
43
+ """
44
+ resolved = Path(path).resolve()
45
+ scripts = {sysconfig.get_path("scripts"), str(Path(sys.executable).parent)}
46
+ if any(d and Path(d).resolve() == resolved.parent for d in scripts):
47
+ return True
38
48
  try:
39
- with open(path, "rb") as stream:
49
+ with open(resolved, "rb") as stream:
40
50
  head = stream.read(256)
51
+ stream.seek(0, os.SEEK_END)
52
+ stream.seek(max(0, stream.tell() - 65536))
53
+ tail = stream.read()
41
54
  except OSError:
42
55
  return False
43
- return head.startswith(b"#!") and b"python" in head.lower()
56
+ if head.startswith(b"#!") and b"python" in head.lower():
57
+ return True
58
+ return b"drawio.__main__" in tail or b"from drawio" in tail
44
59
 
45
60
 
46
61
  def find() -> Optional[str]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drawio-python
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Build, check and export editable draw.io diagrams in Python; made for people and agents
5
5
  Home-page: https://github.com/maycuatroi1/drawio/
6
6
  Author: Nguyen Anh Binh
@@ -1,4 +1,4 @@
1
- drawio/VERSION,sha256=ij2tFtNIwWNWakVvz2UNhdeu7aXlPQHuH6jcFSEpFac,6
1
+ drawio/VERSION,sha256=gAzxwDkrJN58ChxupneOy0M97HHEmhULzpaphHdSey8,6
2
2
  drawio/__init__.py,sha256=utyIqB0EqLEch2y-hdeAevKCUJq1Tp3a9RvX_J4-VS4,222
3
3
  drawio/__main__.py,sha256=NY0uvQc2F8rnMe6id38rKlpzZsZTfFDKP_lp36dCS2o,120
4
4
  drawio/base.py,sha256=RVhQSguNXLkwYVuYcdoph-hbdDuY1eg2gx-BhTeuHeY,320
@@ -41,14 +41,14 @@ drawio/itergrations/mermaid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
41
41
  drawio/itergrations/mermaid/mermaid_controller.py,sha256=IAPluuzbE430i_PjDpnhCgwVYQl1naGPLfAqP9JK2vw,4114
42
42
  drawio/render/__init__.py,sha256=G-K3NVKmX5_M9qdlSdDJOwfjTnOObesTijQcintN3y8,7763
43
43
  drawio/render/browser.py,sha256=IYIE2nEu6SOe0A5YOxY9QRAQroj-rVC17sYrkV1eGXY,6614
44
- drawio/render/desktop.py,sha256=Ml_HVAu-9GAyjD0dwh5Oz8c6T7QBTFmNe8J_Ct0Emh0,3661
44
+ drawio/render/desktop.py,sha256=CMzVxsFIye7xt5tr9199VQai0_GtORi_CFiD9EdWdvY,4353
45
45
  drawio/render/fonts.py,sha256=yf-h6ueJ5o3d4Er_p3zIHh4FYplxJnQIdhjGgMsUr94,7283
46
46
  drawio/render/native.py,sha256=pGUZ7QczTaQIpLqWo5oJNqc8HhWD8bD4WmfKAjynI9w,23439
47
47
  drawio/skill/SKILL.md,sha256=n3EClYfqpDehoJLKJTRpPnhk6X_EnfwOasEFKPYLFN8,7954
48
48
  drawio/skill/references/api.md,sha256=Y0hEq2NiQpqDDGjCJGfwN0evs2fPUhYz8cl7_WS3M-E,5197
49
- drawio_python-0.1.4.dist-info/licenses/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
50
- drawio_python-0.1.4.dist-info/METADATA,sha256=wxGYVW_ozOG71xLXo-qPJMZAZy1m1lCyJdJ_k3hGHT4,10997
51
- drawio_python-0.1.4.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
52
- drawio_python-0.1.4.dist-info/entry_points.txt,sha256=_LKXNvyqbiFZ3Oo9j4duRZY1mC4aTOJeHoHJEoKV80M,48
53
- drawio_python-0.1.4.dist-info/top_level.txt,sha256=bvPtjL9Pljj80VHRuE85m5a5UnqqEm_QbCGCuIVfkB0,7
54
- drawio_python-0.1.4.dist-info/RECORD,,
49
+ drawio_python-0.1.5.dist-info/licenses/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
50
+ drawio_python-0.1.5.dist-info/METADATA,sha256=ezE0VXXjCBkwHA1_5cNHmJwi7JY_cqR7MW3zlVYoJLU,10997
51
+ drawio_python-0.1.5.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
52
+ drawio_python-0.1.5.dist-info/entry_points.txt,sha256=_LKXNvyqbiFZ3Oo9j4duRZY1mC4aTOJeHoHJEoKV80M,48
53
+ drawio_python-0.1.5.dist-info/top_level.txt,sha256=bvPtjL9Pljj80VHRuE85m5a5UnqqEm_QbCGCuIVfkB0,7
54
+ drawio_python-0.1.5.dist-info/RECORD,,