f3d2solidcraft 0.3.0__tar.gz → 0.3.2__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 (135) hide show
  1. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/.github/workflows/ci.yml +1 -0
  2. f3d2solidcraft-0.3.2/.github/workflows/release.yml +257 -0
  3. f3d2solidcraft-0.3.2/CHANGELOG.md +44 -0
  4. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/PKG-INFO +3 -1
  5. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/README.md +2 -0
  6. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/docs/guia.md +2 -0
  7. f3d2solidcraft-0.3.2/docs/media/demo.gif +0 -0
  8. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/pyproject.toml +1 -1
  9. f3d2solidcraft-0.3.2/scripts/fetch_cadmpeg.py +125 -0
  10. f3d2solidcraft-0.3.2/scripts/smoke_packaged.py +151 -0
  11. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/__init__.py +1 -1
  12. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/cli.py +17 -0
  13. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/sketch.py +2 -2
  14. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/__main__.py +6 -1
  15. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/runner.py +32 -6
  16. f3d2solidcraft-0.3.2/src/f3d2solidcraft_app/stdio.py +122 -0
  17. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/window.py +100 -24
  18. f3d2solidcraft-0.3.2/src/f3d2solidcraft_app/winjob.py +181 -0
  19. f3d2solidcraft-0.3.2/tests/app/test_stdio.py +101 -0
  20. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/app/test_window.py +312 -33
  21. f3d2solidcraft-0.3.2/tests/app/test_winjob.py +84 -0
  22. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_cli.py +85 -0
  23. f3d2solidcraft-0.3.2/tests/test_fetch_cadmpeg.py +77 -0
  24. f3d2solidcraft-0.3.0/.github/workflows/release.yml +0 -152
  25. f3d2solidcraft-0.3.0/CHANGELOG.md +0 -20
  26. f3d2solidcraft-0.3.0/scripts/fetch_cadmpeg.py +0 -81
  27. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/LICENSE +0 -0
  28. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/__main__.py +0 -0
  29. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/_vendor/__init__.py +0 -0
  30. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/_vendor/ezf3d/LICENSE +0 -0
  31. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/_vendor/ezf3d/__init__.py +0 -0
  32. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/_vendor/ezf3d/container/__init__.py +0 -0
  33. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/_vendor/ezf3d/container/archive.py +0 -0
  34. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/_vendor/ezf3d/model/__init__.py +0 -0
  35. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/_vendor/ezf3d/model/parameters.py +0 -0
  36. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/_vendor/ezf3d/model/sketch.py +0 -0
  37. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/_vendor/ezf3d/model/timeline.py +0 -0
  38. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/_vendor/ezf3d/streams/__init__.py +0 -0
  39. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/_vendor/ezf3d/streams/manifest.py +0 -0
  40. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/_vendor/ezf3d/streams/primitives.py +0 -0
  41. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/_vendor/ezf3d/streams/segment.py +0 -0
  42. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/engine.py +0 -0
  43. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/fallback.py +0 -0
  44. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/geometry.py +0 -0
  45. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/__init__.py +0 -0
  46. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/bodies.py +0 -0
  47. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/combine.py +0 -0
  48. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/components.py +0 -0
  49. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/edges.py +0 -0
  50. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/extrude.py +0 -0
  51. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/faces.py +0 -0
  52. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/loft.py +0 -0
  53. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/outputs.py +0 -0
  54. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/params.py +0 -0
  55. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/pattern.py +0 -0
  56. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/planes.py +0 -0
  57. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/primitives.py +0 -0
  58. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/records.py +0 -0
  59. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/revolve.py +0 -0
  60. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/sheet.py +0 -0
  61. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mappers/shell.py +0 -0
  62. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/mcp.py +0 -0
  63. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/model.py +0 -0
  64. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/oracle.py +0 -0
  65. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/pairing.py +0 -0
  66. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/reader/__init__.py +0 -0
  67. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/reader/cadir.py +0 -0
  68. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/reader/fusion.py +0 -0
  69. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/reader/locale.py +0 -0
  70. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/replay.py +0 -0
  71. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/report.py +0 -0
  72. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/tools.py +0 -0
  73. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/verify.py +0 -0
  74. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft/visibility.py +0 -0
  75. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/__init__.py +0 -0
  76. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/engines.py +0 -0
  77. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/events.py +0 -0
  78. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/opener.py +0 -0
  79. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/outcome.py +0 -0
  80. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/resources/icon-128.png +0 -0
  81. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/resources/icon-16.png +0 -0
  82. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/resources/icon-256.png +0 -0
  83. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/resources/icon-32.png +0 -0
  84. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/resources/icon-512.png +0 -0
  85. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/resources/icon-64.png +0 -0
  86. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/resources/icon.icns +0 -0
  87. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/resources/icon.ico +0 -0
  88. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/resources/icon.svg +0 -0
  89. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/src/f3d2solidcraft_app/texts.py +0 -0
  90. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/app/__init__.py +0 -0
  91. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/app/conftest.py +0 -0
  92. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/app/test_engines_runner.py +0 -0
  93. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/app/test_events_outcome.py +0 -0
  94. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/app/test_icon.py +0 -0
  95. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/app/test_opener.py +0 -0
  96. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/app/test_packaging.py +0 -0
  97. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/app/test_texts.py +0 -0
  98. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/conftest.py +0 -0
  99. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_bench.py +0 -0
  100. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_bezier_spans.py +0 -0
  101. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_bodies.py +0 -0
  102. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_combine.py +0 -0
  103. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_components.py +0 -0
  104. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_condemnation.py +0 -0
  105. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_conics.py +0 -0
  106. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_declared_edges.py +0 -0
  107. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_engine.py +0 -0
  108. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_extents.py +0 -0
  109. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_faces.py +0 -0
  110. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_geometry.py +0 -0
  111. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_inspect_json.py +0 -0
  112. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_locations.py +0 -0
  113. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_loft.py +0 -0
  114. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_mappers.py +0 -0
  115. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_mcp.py +0 -0
  116. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_naming.py +0 -0
  117. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_oracle.py +0 -0
  118. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_pairing.py +0 -0
  119. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_partial_sketches.py +0 -0
  120. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_pattern.py +0 -0
  121. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_primitives.py +0 -0
  122. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_progress.py +0 -0
  123. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_reader.py +0 -0
  124. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_replay.py +0 -0
  125. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_revolve.py +0 -0
  126. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_rollback.py +0 -0
  127. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_sheet.py +0 -0
  128. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_shell.py +0 -0
  129. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_tilted_planes.py +0 -0
  130. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_tools.py +0 -0
  131. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_trimmed_region.py +0 -0
  132. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_unmeasurable.py +0 -0
  133. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_unnamed_sketches.py +0 -0
  134. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_verify.py +0 -0
  135. {f3d2solidcraft-0.3.0 → f3d2solidcraft-0.3.2}/tests/test_visibility.py +0 -0
@@ -10,6 +10,7 @@ on:
10
10
  push:
11
11
  branches: [main]
12
12
  pull_request:
13
+ workflow_dispatch: # a branch run by hand (Actions -> ci -> Run workflow), e.g. before a fix is a PR
13
14
  permissions:
14
15
  contents: read
15
16
  jobs:
@@ -0,0 +1,257 @@
1
+ name: release
2
+ # A tag `vX.Y.Z` publishes that version to PyPI and attaches the three desktop installers to its GitHub
3
+ # release. The release is created as a draft, each installer leg uploads to the draft, and only when all
4
+ # three legs succeeded does the last job publish it: a leg that fails leaves a draft nobody sees, never a
5
+ # public release with an installer missing.
6
+ #
7
+ # Run by hand (Actions -> release -> Run workflow), it is a rehearsal that publishes nothing: it builds
8
+ # and checks the package and builds the three desktop installers, kept only as downloadable workflow
9
+ # artifacts (dist, installer-windows, installer-macOS, installer-linux). It touches no GitHub release and
10
+ # no PyPI, even when started from a tag. Ticking the `testpypi` box on that run also uploads the package
11
+ # to TestPyPI; it is off unless ticked.
12
+ #
13
+ # Publishing uses PyPI's Trusted Publishing (OIDC): no token is stored anywhere. Each index has to be
14
+ # told once to trust this repository's `release.yml` and the environment named below.
15
+ on:
16
+ push:
17
+ tags: ["v*"]
18
+ workflow_dispatch:
19
+ inputs:
20
+ testpypi:
21
+ description: "Also upload the package to TestPyPI"
22
+ type: boolean
23
+ default: false
24
+ permissions:
25
+ contents: read
26
+ jobs:
27
+ build:
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+ - uses: astral-sh/setup-uv@v6
32
+ with:
33
+ python-version: "3.13"
34
+ - name: The tag is the version
35
+ if: startsWith(github.ref, 'refs/tags/v')
36
+ run: |
37
+ set -euo pipefail
38
+ version=$(python3 -c "import re,sys; print(re.search(r'__version__ = \"([^\"]+)\"', open('src/f3d2solidcraft/__init__.py').read()).group(1))")
39
+ test "v$version" = "$GITHUB_REF_NAME" || { echo "tag $GITHUB_REF_NAME is not version $version"; exit 1; }
40
+ - run: uv build
41
+ - name: Metadata
42
+ run: uvx twine check --strict dist/*
43
+ - name: The wheel installs and runs on its own
44
+ run: |
45
+ set -euo pipefail
46
+ uv venv /tmp/smoke
47
+ uv pip install --python /tmp/smoke/bin/python dist/*.whl
48
+ /tmp/smoke/bin/f3d2solidcraft --help
49
+ /tmp/smoke/bin/f3d2solidcraft --version
50
+ /tmp/smoke/bin/python -c "import f3d2solidcraft; print(f3d2solidcraft.__version__)"
51
+ - uses: actions/upload-artifact@v4
52
+ with:
53
+ name: dist
54
+ path: dist/
55
+
56
+ testpypi:
57
+ if: github.event_name == 'workflow_dispatch' && inputs.testpypi # a manual run publishes nothing unless asked
58
+ needs: build
59
+ runs-on: ubuntu-latest
60
+ environment: testpypi
61
+ permissions:
62
+ id-token: write
63
+ steps:
64
+ - uses: actions/download-artifact@v4
65
+ with:
66
+ name: dist
67
+ path: dist/
68
+ - uses: pypa/gh-action-pypi-publish@release/v1
69
+ with:
70
+ repository-url: https://test.pypi.org/legacy/
71
+
72
+ pypi:
73
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') # a dispatch, even from a tag, never publishes
74
+ # Last, after the GitHub release is out with all three installers: PyPI cannot be undone, so it
75
+ # waits until nothing else can still fail and leave PyPI ahead of the installers.
76
+ needs: [build, publish]
77
+ runs-on: ubuntu-latest
78
+ environment: pypi
79
+ permissions:
80
+ id-token: write
81
+ steps:
82
+ - uses: actions/download-artifact@v4
83
+ with:
84
+ name: dist
85
+ path: dist/
86
+ - uses: pypa/gh-action-pypi-publish@release/v1
87
+
88
+ # The desktop app, packaged by Briefcase on each system, attached to the tag's GitHub release. Briefcase
89
+ # is pinned to the version these steps were measured with. Each leg puts a cadmpeg checked against its
90
+ # pinned sha256 inside the app first (on macOS a universal one, joined with `lipo`).
91
+ #
92
+ # Linux, measured in an ubuntu:22.04 x86_64 container (the runner below): Briefcase 0.4.7's AppImage
93
+ # template (branch v0.4.7, also v0.4.5 and v0.4.6) renders `cookiecutter.host_arch` without declaring
94
+ # it in its cookiecutter.json, so cookiecutter drops the value Briefcase passes and `create` stops on
95
+ # "'collections.OrderedDict object' has no attribute 'host_arch'". The v0.4.4 template predates that
96
+ # line; with it the AppImage builds, and it opens, answers `--check` and runs `--worker` on ubuntu
97
+ # 22.04 and 24.04. `--no-docker` builds on the runner itself: PySide6 6.12 ships only manylinux_2_34
98
+ # wheels, which ubuntu 22.04 (glibc 2.35) installs, so a Docker manylinux image would not make the
99
+ # AppImage reach older systems anyway. The apt step gives linuxdeploy the libraries Qt links against,
100
+ # so it can copy into the AppImage the ones a desktop may lack: without libxcb-cursor0 (and the three
101
+ # xcb libraries linuxdeploy stops on before it, icccm, keysyms and shape) on the build machine, the
102
+ # AppImage measured under Xvfb on a fresh ubuntu 22.04 aborted with "From 6.5.0, xcb-cursor0 or
103
+ # libxcb-cursor0 is needed to load the Qt xcb platform plugin".
104
+ #
105
+ # Run by hand, this job is the installers' rehearsal: it builds them and uploads them as workflow
106
+ # artifacts, and the release steps are skipped. A tag does both.
107
+ installers:
108
+ # `!cancelled()` so a hand run, where `draft` is skipped, still builds; the result checks keep a
109
+ # failed build or a draft that was not made from going on.
110
+ if: >-
111
+ !cancelled() && needs.build.result == 'success' &&
112
+ (needs.draft.result == 'success' || needs.draft.result == 'skipped') &&
113
+ (startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch')
114
+ needs: [build, draft]
115
+ runs-on: ${{ matrix.os }}
116
+ strategy:
117
+ fail-fast: false
118
+ matrix:
119
+ include:
120
+ - os: windows-latest
121
+ platform: windows
122
+ format: ""
123
+ flags: ""
124
+ - os: macos-latest
125
+ platform: macOS
126
+ format: ""
127
+ flags: ""
128
+ - os: ubuntu-22.04
129
+ platform: linux
130
+ format: appimage
131
+ flags: --no-docker -C 'template_branch="v0.4.4"'
132
+ # `write` is only used by the upload to the draft, which runs on tags alone. A job's permissions cannot
133
+ # depend on the event, so a hand run gets it too; it uploads artifacts and nothing else.
134
+ permissions:
135
+ contents: write
136
+ defaults:
137
+ run:
138
+ shell: bash
139
+ steps:
140
+ - uses: actions/checkout@v4
141
+ - uses: astral-sh/setup-uv@v6
142
+ with:
143
+ python-version: "3.13"
144
+ - name: What Qt links against, for linuxdeploy to find
145
+ if: runner.os == 'Linux'
146
+ run: |
147
+ sudo apt-get update
148
+ sudo apt-get install -y libegl1 libxkbcommon0 libxkbcommon-x11-0 libgl1 libfontconfig1 libglib2.0-0 libdbus-1-3 \
149
+ libxcb-cursor0 libxcb-icccm4 libxcb-keysyms1 libxcb-shape0
150
+ - run: uv run --no-project python scripts/fetch_cadmpeg.py
151
+ - run: uvx briefcase==0.4.7 create ${{ matrix.platform }} ${{ matrix.format }} ${{ matrix.flags }} --no-input
152
+ - run: uvx briefcase==0.4.7 build ${{ matrix.platform }} ${{ matrix.format }} ${{ matrix.flags }} --no-input
153
+ # The built app itself, run as the window runs it, before it is packaged: `--check`, the worker's
154
+ # inspection and a real conversion with `--progress`, each read with the window's own code and
155
+ # failing on empty output. On Windows from a parent with no console, like the window: Briefcase's
156
+ # stub sends stdout to a log file then, which is how 0.3.1's app lost everything its worker wrote
157
+ # («Could not read the file: exit code 0»). The tests run from source through a console Python and
158
+ # never saw it. SolidCraft is the runner's, pinned like in ci.yml; cadmpeg is the one in the app.
159
+ - name: The built app answers as the window expects
160
+ env:
161
+ SOLIDCRAFT: "0.43.0"
162
+ SAMPLE_URL: https://github.com/user-attachments/files/33617507/test.weird.box_f3d.zip
163
+ run: |
164
+ set -euo pipefail
165
+ tmp=$(mktemp -d)
166
+ url="https://github.com/tangency-labs/solidcraft/releases/download/v$SOLIDCRAFT"
167
+ curl -fsSL -o "$tmp/SHA256SUMS.txt" "$url/SHA256SUMS.txt"
168
+ case "$RUNNER_OS" in
169
+ Linux)
170
+ asset="solidcraft-$SOLIDCRAFT-linux-x86_64.tar.gz"
171
+ curl -fsSL -o "$tmp/$asset" "$url/$asset"
172
+ ( cd "$tmp" && grep " $asset\$" SHA256SUMS.txt | sha256sum -c - )
173
+ tar -xzf "$tmp/$asset" -C "$tmp" --strip-components=2 "solidcraft-$SOLIDCRAFT-linux-x86_64/bin/solidcraft-cli"
174
+ cli="$tmp/solidcraft-cli" ;;
175
+ macOS)
176
+ asset="solidcraft-cli-$SOLIDCRAFT-macos-universal.zip"
177
+ curl -fsSL -o "$tmp/$asset" "$url/$asset"
178
+ ( cd "$tmp" && grep " $asset\$" SHA256SUMS.txt | shasum -a 256 -c - )
179
+ unzip -q "$tmp/$asset" -d "$tmp"
180
+ cli="$tmp/solidcraft-cli-$SOLIDCRAFT-macos-universal/solidcraft-cli" ;;
181
+ Windows)
182
+ asset="solidcraft-$SOLIDCRAFT-windows-x64-portable.zip"
183
+ curl -fsSL -o "$tmp/$asset" "$url/$asset"
184
+ ( cd "$tmp" && grep " $asset\$" SHA256SUMS.txt | sha256sum -c - )
185
+ unzip -q "$tmp/$asset" -d "$tmp"
186
+ cli=$(cygpath -w "$tmp/solidcraft-$SOLIDCRAFT-windows-x64-portable/solidcraft-cli.exe") ;;
187
+ esac
188
+ chmod +x "$cli" 2>/dev/null || true
189
+ export F3D2SC_SOLIDCRAFT_CLI="$cli"
190
+ curl -fsSL -o "$tmp/sample.zip" "$SAMPLE_URL"
191
+ uv run --no-project python -m zipfile -e "$tmp/sample.zip" "$tmp/sample"
192
+ uv run --no-project python scripts/smoke_packaged.py build "$tmp/sample/test weird box.f3d" "$tmp/out"
193
+ - run: uvx briefcase==0.4.7 package ${{ matrix.platform }} ${{ matrix.format }} ${{ matrix.flags }} ${{ matrix.platform == 'macOS' && '--adhoc-sign' || '' }} --no-input
194
+ - uses: actions/upload-artifact@v4
195
+ with:
196
+ name: installer-${{ matrix.platform }}
197
+ path: dist/*
198
+ if-no-files-found: error
199
+ - name: Upload to the draft release
200
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
201
+ env:
202
+ GH_TOKEN: ${{ github.token }}
203
+ run: gh release upload "$GITHUB_REF_NAME" dist/* --clobber --repo "$GITHUB_REPOSITORY"
204
+
205
+ # The tag's release, as a draft, before any installer is built: the three legs upload into this one
206
+ # release instead of racing to create it. A draft left from an earlier attempt at the same tag is used
207
+ # as it is; a release already published is not turned back into a draft.
208
+ draft:
209
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
210
+ needs: build
211
+ runs-on: ubuntu-latest
212
+ permissions:
213
+ contents: write
214
+ steps:
215
+ - uses: actions/checkout@v4
216
+ - name: Create the draft release
217
+ env:
218
+ GH_TOKEN: ${{ github.token }}
219
+ run: |
220
+ set -euo pipefail
221
+ if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
222
+ echo "release $GITHUB_REF_NAME already exists; the legs upload to it"
223
+ exit 0
224
+ fi
225
+ # The notes are the version's own section of CHANGELOG.md, from its heading to the next one.
226
+ awk -v v="## ${GITHUB_REF_NAME#v}" '
227
+ index($0, v) == 1 && (length($0) == length(v) || substr($0, length(v) + 1, 1) == " ") { on = 1; next }
228
+ on && /^## / { exit }
229
+ on { print }
230
+ ' CHANGELOG.md > notes.md
231
+ test -s notes.md || { echo "CHANGELOG.md has no section for ${GITHUB_REF_NAME#v}"; exit 1; }
232
+ gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --draft --verify-tag \
233
+ --title "$GITHUB_REF_NAME" --notes-file notes.md
234
+
235
+ # Publishes the draft once every installer leg succeeded. A failed or cancelled leg skips this job, so
236
+ # the release stays a draft with whatever was uploaded, for a re-run of the failed leg to complete.
237
+ publish:
238
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
239
+ needs: [draft, installers]
240
+ runs-on: ubuntu-latest
241
+ permissions:
242
+ contents: write
243
+ steps:
244
+ - name: Every installer is attached
245
+ env:
246
+ GH_TOKEN: ${{ github.token }}
247
+ run: |
248
+ set -euo pipefail
249
+ assets=$(gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --json assets -q '.assets[].name')
250
+ echo "$assets"
251
+ for suffix in .msi .dmg .AppImage; do
252
+ grep -q -- "$suffix\$" <<< "$assets" || { echo "no $suffix attached to $GITHUB_REF_NAME"; exit 1; }
253
+ done
254
+ - name: Publish the release
255
+ env:
256
+ GH_TOKEN: ${{ github.token }}
257
+ run: gh release edit "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --draft=false --latest
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ ## 0.3.2
4
+
5
+ - Windows app: loading a file failed with "Could not read the file: exit code 0", whatever the file. The
6
+ installed app runs its own converter in a second process, and the launcher Briefcase builds sent that process's
7
+ output to a log file instead of back to the window whenever it was started without a console, which is always
8
+ the case from the window. The window now reads the converter's output and errors from one pipe, which survives
9
+ that launcher, and the converter writes back to it.
10
+ - Release: before packaging, each installer's built app is run as the window runs it (from a parent with no
11
+ console on Windows): `--check`, inspecting the public sample and a full conversion with progress, which must
12
+ end verified. A build whose app prints nothing fails the release.
13
+
14
+ ## 0.3.1
15
+
16
+ - Desktop app: the "Save as" line and its "Change…" button only appear once a file is loaded.
17
+ - Desktop app on Windows: cancelling, closing the window or a converter that crashes now ends every process the
18
+ conversion started, SolidCraft included. Before, an engine could be left running after a crash.
19
+ - File and folder names with accents, ñ or other non-ASCII letters convert from the command line and the desktop
20
+ app on Windows, macOS and Linux. The command now writes its output as UTF-8 on every system.
21
+ - `f3d2solidcraft --version` prints the version.
22
+ - The report says "not supported yet" for sketch constraints and dimensions it cannot rebuild, instead of an
23
+ internal milestone name.
24
+ - Release: the installers are attached to a draft release, published only once all three are built; the cadmpeg
25
+ download for the installers times out instead of hanging, and refuses a Linux machine that is not x86_64.
26
+
27
+ ## 0.3.0 — first public release
28
+
29
+ - A desktop program for Windows, macOS and Linux (`f3d2solidcraft[gui]`, or the installers attached to each
30
+ release): a three-step wizard that converts one file at a time, verifies it and opens the result in SolidCraft.
31
+ It ships its own cadmpeg; only SolidCraft 0.43.0 or newer has to be installed.
32
+ - `convert --progress` prints one JSON event per feature and a final `done` event; `inspect --json` prints what a
33
+ file holds as JSON.
34
+ - A part placed more than once keeps every placement. If the saved design ever holds fewer placements than were
35
+ measured, the verification fails (`placements_lost`, exit code 2) instead of passing.
36
+
37
+ - Converts Fusion `.f3d` designs and `.f3z` packages into SolidCraft designs: parameters, sketches and a feature
38
+ timeline, with whatever cannot be rebuilt brought in as imported bodies.
39
+ - Every conversion is verified against the original (bodies, volume, bounding box, centre of mass, face count) and
40
+ reported feature by feature as `exact`, `inferred`, `fallback`, `failed` or `skipped`.
41
+ - Choices the Fusion file does not record (an extrude's profiles, a fillet's edges) are measured against the
42
+ original solid and reported as `inferred`.
43
+ - `inspect` to see what a file holds; `convert` to convert it; `mcp` to serve both over MCP.
44
+ - Requires SolidCraft 0.43.0 or newer and cadmpeg 0.6.11 or newer. Python 3.13 and 3.14.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: f3d2solidcraft
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Convert Autodesk Fusion .f3d/.f3z designs into editable SolidCraft designs
5
5
  Project-URL: Homepage, https://github.com/cristiancarterm/f3d2solidcraft
6
6
  Project-URL: Issues, https://github.com/cristiancarterm/f3d2solidcraft/issues
@@ -38,6 +38,8 @@ bounding box and centre of mass (within 0.01 mm), same face count.
38
38
 
39
39
  *Guía en español: [docs/guia.md](docs/guia.md).*
40
40
 
41
+ ![The desktop app converting a Fusion design, verified against the original and opened in SolidCraft](https://raw.githubusercontent.com/cristiancarterm/f3d2solidcraft/main/docs/media/demo.gif)
42
+
41
43
  ## Status
42
44
 
43
45
  Early, and honest about it. On the corpus of 15 real designs it is developed against:
@@ -9,6 +9,8 @@ bounding box and centre of mass (within 0.01 mm), same face count.
9
9
 
10
10
  *Guía en español: [docs/guia.md](docs/guia.md).*
11
11
 
12
+ ![The desktop app converting a Fusion design, verified against the original and opened in SolidCraft](https://raw.githubusercontent.com/cristiancarterm/f3d2solidcraft/main/docs/media/demo.gif)
13
+
12
14
  ## Status
13
15
 
14
16
  Early, and honest about it. On the corpus of 15 real designs it is developed against:
@@ -9,6 +9,8 @@ Cada conversión se compara con el original antes de entregártela: los mismos c
9
9
  margen de 0,1 %), la misma caja envolvente y el mismo centro de masa (con un margen de 0,01 mm) y la misma cantidad de
10
10
  caras.
11
11
 
12
+ ![El programa de escritorio convierte un diseño de Fusion, lo verifica contra el original y lo abre en SolidCraft](media/demo.gif)
13
+
12
14
  *English: [README.md](../README.md).*
13
15
 
14
16
  ## Estado
Binary file
@@ -59,7 +59,7 @@ packages = ["src/f3d2solidcraft", "src/f3d2solidcraft_app"]
59
59
  [tool.briefcase]
60
60
  project_name = "f3d2solidcraft"
61
61
  bundle = "cl.mitocondria"
62
- version = "0.3.0" # the package's own version: tests/app/test_packaging.py keeps the two equal
62
+ version = "0.3.2" # the package's own version: tests/app/test_packaging.py keeps the two equal
63
63
  url = "https://github.com/cristiancarterm/f3d2solidcraft"
64
64
  # The license comes from [project] (PEP 639: `license` + `license-files`); Briefcase refuses both forms.
65
65
  author = "Cristián Carter"
@@ -0,0 +1,125 @@
1
+ """Put a verified cadmpeg inside the app before Briefcase packages it (spec, Empaque).
2
+
3
+ uv run python scripts/fetch_cadmpeg.py [--dest DIR]
4
+
5
+ Downloads the release asset for this system, checks it against the sha256 pinned here (the same
6
+ numbers the plan's Global Constraints carry), and installs the binary. On macOS it fetches both
7
+ architectures and joins them with `lipo`, so the .dmg runs on Apple silicon and Intel alike.
8
+
9
+ cadmpeg publishes Linux binaries for x86_64 only: on any other Linux machine this stops with a
10
+ message instead of putting an x86_64 binary in an app that could never run it.
11
+ """
12
+
13
+ import hashlib
14
+ import platform
15
+ import shutil
16
+ import subprocess
17
+ import sys
18
+ import tarfile
19
+ import tempfile
20
+ import urllib.error
21
+ import urllib.request
22
+ import zipfile
23
+ from pathlib import Path
24
+
25
+ VERSION = "0.6.11"
26
+ BASE = f"https://github.com/cadmpeg/cadmpeg/releases/download/v{VERSION}"
27
+ SHA256 = {
28
+ "cadmpeg-x86_64-pc-windows-msvc.zip": "4e1ec1f697b089f7ea9a8f8637e1242607b172f502333569a794a8191ecb47f1",
29
+ "cadmpeg-aarch64-apple-darwin.tar.xz": "71b9ba0b224977774e09f5d1374219623401e13c01f695b341dae6de673c0ee6",
30
+ "cadmpeg-x86_64-apple-darwin.tar.xz": "304a6ca4de389a8935601a3a43312eaca8e29b7ec2314e44a8d63de6f6e1123e",
31
+ "cadmpeg-x86_64-unknown-linux-gnu.tar.xz": "cdc95d3e6f07944f8a9a80c99259bd957d5afeecd4337d1a80ed6659e37a3abd",
32
+ }
33
+ DEFAULT_DEST = Path(__file__).resolve().parents[1] / "src/f3d2solidcraft_app/resources/bin"
34
+ #: Seconds a connection may stay silent (connecting, or between two reads) before the download stops.
35
+ TIMEOUT = 60
36
+ #: How `platform.machine()` spells x86_64 on the systems that build the app.
37
+ X86_64 = {"x86_64", "amd64"}
38
+
39
+
40
+ class FetchError(SystemExit):
41
+ """A download or a machine this script cannot serve: the message is what the user reads."""
42
+
43
+
44
+ def assets_for(system: str, machine: str) -> list[str]:
45
+ """The release assets to fetch for `platform.system()` and `platform.machine()`.
46
+
47
+ Windows takes the x86_64 build on any machine (Windows on Arm runs it emulated); macOS takes both
48
+ and joins them. Linux has no emulation to fall back on, so anything but x86_64 is refused.
49
+ """
50
+ if system == "Windows":
51
+ return ["cadmpeg-x86_64-pc-windows-msvc.zip"]
52
+ if system == "Darwin":
53
+ return ["cadmpeg-aarch64-apple-darwin.tar.xz", "cadmpeg-x86_64-apple-darwin.tar.xz"]
54
+ if system == "Linux" and machine.lower() in X86_64:
55
+ return ["cadmpeg-x86_64-unknown-linux-gnu.tar.xz"]
56
+ if system == "Linux":
57
+ raise FetchError(
58
+ f"cadmpeg {VERSION} publishes a Linux binary for x86_64 only, and this machine is "
59
+ f"{machine or 'of an unknown architecture'}: build the Linux app on an x86_64 machine"
60
+ )
61
+ raise FetchError(f"cadmpeg {VERSION} publishes no binary for {system or 'this system'}")
62
+
63
+
64
+ def download(url: str, target: Path, timeout: float = TIMEOUT) -> None:
65
+ """`url` into `target`; a server that does not answer within `timeout` seconds stops it."""
66
+ try:
67
+ with urllib.request.urlopen(url, timeout=timeout) as response, target.open("wb") as sink:
68
+ shutil.copyfileobj(response, sink)
69
+ except TimeoutError:
70
+ raise FetchError(f"downloading {url} timed out: no answer for {timeout:g} s") from None
71
+ except urllib.error.URLError as exc:
72
+ # A timeout while connecting arrives wrapped in a URLError.
73
+ if isinstance(exc.reason, TimeoutError):
74
+ raise FetchError(f"downloading {url} timed out: no answer for {timeout:g} s") from None
75
+ raise FetchError(f"could not download {url}: {exc.reason}") from None
76
+ except OSError as exc:
77
+ raise FetchError(f"could not download {url}: {exc}") from None
78
+
79
+
80
+ def _fetch(asset: str, into: Path) -> Path:
81
+ target = into / asset
82
+ download(f"{BASE}/{asset}", target)
83
+ digest = hashlib.sha256(target.read_bytes()).hexdigest()
84
+ if digest != SHA256[asset]:
85
+ raise FetchError(f"{asset}: sha256 {digest} is not the pinned {SHA256[asset]}")
86
+ return target
87
+
88
+
89
+ def _binary(archive: Path, into: Path, name: str) -> Path:
90
+ out = into / archive.name.split(".")[0]
91
+ if archive.suffix == ".zip":
92
+ with zipfile.ZipFile(archive) as z:
93
+ z.extractall(out)
94
+ else:
95
+ with tarfile.open(archive) as t:
96
+ t.extractall(out, filter="data")
97
+ return next(p for p in out.rglob(name) if p.is_file())
98
+
99
+
100
+ def main(argv: list[str], system: str | None = None, machine: str | None = None) -> int:
101
+ dest = Path(argv[argv.index("--dest") + 1]) if "--dest" in argv else DEFAULT_DEST
102
+ system = platform.system() if system is None else system
103
+ machine = platform.machine() if machine is None else machine
104
+ assets = assets_for(system, machine) # refuses before anything is written or downloaded
105
+ dest.mkdir(parents=True, exist_ok=True)
106
+ name = "cadmpeg.exe" if system == "Windows" else "cadmpeg"
107
+ with tempfile.TemporaryDirectory() as tmp:
108
+ work = Path(tmp)
109
+ binaries = [_binary(_fetch(asset, work), work, name) for asset in assets]
110
+ if len(binaries) > 1:
111
+ subprocess.run(["lipo", "-create", *map(str, binaries), "-output", str(dest / name)], check=True)
112
+ else:
113
+ shutil.copy2(binaries[0], dest / name)
114
+ installed = dest / name
115
+ installed.chmod(0o755)
116
+ print(
117
+ subprocess.run(
118
+ [str(installed), "--version"], capture_output=True, text=True, check=True
119
+ ).stdout.strip()
120
+ )
121
+ return 0
122
+
123
+
124
+ if __name__ == "__main__":
125
+ sys.exit(main(sys.argv[1:]))
@@ -0,0 +1,151 @@
1
+ """Run the app Briefcase built, as the window runs it, before it is packaged (release.yml).
2
+
3
+ python scripts/smoke_packaged.py BUILD_DIR SAMPLE OUT_DIR
4
+
5
+ The tests run the app from source, through a console Python. The installers run the executable
6
+ Briefcase builds, which on Windows is a GUI program: a bug in how that program writes to the pipes
7
+ the window gives it (0.3.1: «Could not read the file: exit code 0» on any file) never reached a test.
8
+ This starts the built executable itself, with pipes, the way the window's QProcess does, and reads
9
+ what comes back with the window's own code (`events.parse`, `outcome_from`):
10
+
11
+ 1. `--check`: the engine lines and the worker line, exit 0.
12
+ 2. `--worker inspect SAMPLE --json`: the counts line the first step shows.
13
+ 3. `--worker convert SAMPLE ... --progress`: feature events, `done` with exit 0, a verified report.
14
+
15
+ On Windows it first lets go of its console: the window is a GUI program and has none, and Briefcase's
16
+ stub decides where the worker's stdout goes by whether its parent has one (`AttachConsole`). Run from
17
+ a CI shell, which has a console, the stub kept the pipes and 0.3.1 passed here. Each run gets one
18
+ pipe for stdout and stderr and `F3D2SC_WORKER_ONE_PIPE=1`, as the window starts the worker
19
+ (`f3d2solidcraft_app.stdio`); `--check` too, as any parent without a console has to.
20
+
21
+ Each fails on empty output, whatever the exit code. SolidCraft is the runner's (`F3D2SC_SOLIDCRAFT_CLI`,
22
+ as the window pins it); cadmpeg is the one inside the built app, as the window points the worker at it.
23
+ Stdlib only, plus the two pure modules of the window it imports from `src/`.
24
+ """
25
+
26
+ from __future__ import annotations
27
+
28
+ import json
29
+ import os
30
+ import subprocess
31
+ import sys
32
+ from pathlib import Path
33
+
34
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
35
+
36
+ from f3d2solidcraft_app.events import Done, Feature, parse
37
+ from f3d2solidcraft_app.outcome import outcome_from
38
+ from f3d2solidcraft_app.stdio import ONE_PIPE
39
+
40
+ #: What `test weird box.f3d`, the public sample the CI uses, holds.
41
+ EXPECTED = {"parameters": 32, "sketches": 8, "features": 26}
42
+ TIMEOUT = 900
43
+
44
+
45
+ class SmokeFailed(SystemExit):
46
+ pass
47
+
48
+
49
+ def built_app(build: Path) -> tuple[Path, Path]:
50
+ """The executable Briefcase built for this system, and the cadmpeg inside it."""
51
+ if sys.platform == "win32":
52
+ candidates = list(build.glob("*/windows/app/src/*.exe"))
53
+ elif sys.platform == "darwin":
54
+ candidates = [p for p in build.glob("*/macos/app/*.app/Contents/MacOS/*") if p.is_file()]
55
+ else:
56
+ # The AppImage users run, wherever this Briefcase leaves it; else the folder it is made from.
57
+ images = [
58
+ *build.rglob("f3d2solidcraft*.AppImage"),
59
+ *build.parent.joinpath("dist").glob("f3d2solidcraft*.AppImage"),
60
+ ]
61
+ candidates = images or list(build.glob("*/linux/appimage/*.AppDir/AppRun"))
62
+ if len(candidates) != 1:
63
+ raise SmokeFailed(f"expected one built executable under {build}, found {candidates}")
64
+ name = "cadmpeg.exe" if sys.platform == "win32" else "cadmpeg"
65
+ cadmpegs = [p for p in build.rglob(name) if p.parent.parts[-2:] == ("resources", "bin")]
66
+ if not cadmpegs:
67
+ raise SmokeFailed(f"no bundled {name} under {build}")
68
+ return candidates[0], cadmpegs[0]
69
+
70
+
71
+ def without_console() -> None:
72
+ """Windows: be a parent with no console, as the window is, for every program started from here.
73
+
74
+ Our own output is a pipe to the CI log, which `FreeConsole` leaves alone.
75
+ """
76
+ if sys.platform == "win32":
77
+ import ctypes
78
+
79
+ ctypes.windll.kernel32.FreeConsole()
80
+
81
+
82
+ def run(command: list[str], env: dict[str, str]) -> tuple[int, str, str]:
83
+ """Exit code, the whole pipe, and its lines that are not progress events (the window's `stderr`)."""
84
+ print("$", " ".join(command), flush=True)
85
+ done = subprocess.run(
86
+ command,
87
+ stdout=subprocess.PIPE,
88
+ stderr=subprocess.STDOUT,
89
+ env={**env, ONE_PIPE: "1"},
90
+ timeout=TIMEOUT,
91
+ check=False,
92
+ )
93
+ out = done.stdout.decode("utf-8", "replace")
94
+ print(f"exit {done.returncode}\n--- stdout and stderr ---\n{out}--------------", flush=True)
95
+ if not out.strip():
96
+ raise SmokeFailed(f"{command[1:3]}: nothing on the pipe (exit {done.returncode})")
97
+ text = "".join(line + "\n" for line in out.splitlines() if parse(line) is None)
98
+ return done.returncode, out, text
99
+
100
+
101
+ def main(argv: list[str]) -> int:
102
+ build, sample, out_dir = (Path(a).resolve() for a in argv)
103
+ exe, cadmpeg = built_app(build)
104
+ without_console()
105
+ print(f"built app: {exe}\nbundled cadmpeg: {cadmpeg}", flush=True)
106
+ out_dir.mkdir(parents=True, exist_ok=True)
107
+ base = dict(os.environ)
108
+ base.pop("F3D2SC_CADMPEG", None)
109
+ if sys.platform.startswith("linux"):
110
+ base["APPIMAGE_EXTRACT_AND_RUN"] = "1" # no FUSE on the runner
111
+
112
+ # 1. `--check` finds the bundled cadmpeg on its own, like the window's first screen.
113
+ code, out, _ = run([str(exe), "--check"], base)
114
+ if code != 0 or "worker:" not in out or "cadmpeg:" not in out:
115
+ raise SmokeFailed(f"--check did not pass (exit {code})")
116
+ # The window starts `worker_command(..., sys.executable)`: it must be this same executable, or the
117
+ # runs below would test a worker the window never starts. (An AppImage runs from a mount or an
118
+ # extracted copy, so on Linux the path differs by design.)
119
+ if not sys.platform.startswith("linux") and f"worker: {exe} --worker " not in out:
120
+ raise SmokeFailed(f"the window would not start {exe} as its worker")
121
+
122
+ # The worker gets what the window puts in its environment (`Wizard._new_process`).
123
+ worker = {**base, "F3D2SC_CADMPEG": str(cadmpeg), "F3D2SC_WORKER_OWN_GROUP": "1"}
124
+
125
+ # 2. The first step's inspection.
126
+ code, out, _ = run([str(exe), "--worker", "inspect", str(sample), "--json"], worker)
127
+ counts = next((json.loads(line) for line in out.splitlines() if line.startswith("{")), None)
128
+ if code != 0 or counts != EXPECTED:
129
+ raise SmokeFailed(f"inspect: exit {code}, counts {counts}, expected {EXPECTED}")
130
+
131
+ # 3. The conversion, read as the window reads it.
132
+ output = out_dir / "sample.solidcraft"
133
+ report = out_dir / "sample.report.json"
134
+ command = [str(exe), "--worker", "convert", str(sample), "-o", str(output)]
135
+ code, out, err = run([*command, "--report", str(report), "--force", "--progress"], worker)
136
+ events = [e for e in map(parse, out.splitlines()) if e is not None]
137
+ features = [e for e in events if isinstance(e, Feature)]
138
+ if not features or events[-1] != Done(0):
139
+ raise SmokeFailed(f"convert: {len(features)} feature events, last event {events[-1:]}")
140
+ data = json.loads(report.read_text(encoding="utf-8"))
141
+ if code != 0 or not output.is_file() or data["verification"]["ok"] is not True:
142
+ raise SmokeFailed(f"convert: exit {code}, verification {data['verification']}")
143
+ outcome = outcome_from(code, data, err)
144
+ if outcome.kind != "verified":
145
+ raise SmokeFailed(f"the window would show {outcome.kind}: {outcome.message}")
146
+ print(f"ok: {len(features)} feature events, verified, {outcome.editable}/{outcome.total} editable")
147
+ return 0
148
+
149
+
150
+ if __name__ == "__main__":
151
+ sys.exit(main(sys.argv[1:]))
@@ -1,3 +1,3 @@
1
1
  """Convert Autodesk Fusion .f3d designs into editable SolidCraft designs."""
2
2
 
3
- __version__ = "0.3.0"
3
+ __version__ = "0.3.2"