mirror of
https://github.com/vofy/fekt-scara.git
synced 2025-05-06 23:21:01 +02:00
Add commit hash to generated files
This commit is contained in:
parent
0834add188
commit
e0452426fa
28 changed files with 5 additions and 1 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/freecadcmd
|
#!/usr/bin/freecadcmd
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
import FreeCAD as App # type: ignore
|
import FreeCAD as App # type: ignore
|
||||||
import Mesh # type: ignore
|
import Mesh # type: ignore
|
||||||
|
|
||||||
|
@ -13,6 +14,9 @@ project_root = os.path.abspath(
|
||||||
printed_cad_dir = os.path.join(project_root, "cad", "printed")
|
printed_cad_dir = os.path.join(project_root, "cad", "printed")
|
||||||
printed_3mf_dir = os.path.join(project_root, "3mf")
|
printed_3mf_dir = os.path.join(project_root, "3mf")
|
||||||
|
|
||||||
|
# Get the short hash of the current Git commit
|
||||||
|
git_short_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip()
|
||||||
|
|
||||||
# Create the 3mf directory if it doesn't exist
|
# Create the 3mf directory if it doesn't exist
|
||||||
os.makedirs(printed_3mf_dir, exist_ok=True)
|
os.makedirs(printed_3mf_dir, exist_ok=True)
|
||||||
|
|
||||||
|
@ -41,7 +45,7 @@ for root, dirs, files in os.walk(printed_cad_dir):
|
||||||
output_path = os.path.join(
|
output_path = os.path.join(
|
||||||
printed_3mf_dir,
|
printed_3mf_dir,
|
||||||
os.path.relpath(root, printed_cad_dir),
|
os.path.relpath(root, printed_cad_dir),
|
||||||
f"{obj.Label}.3mf",
|
f"{obj.Label}_{git_short_hash}.3mf",
|
||||||
)
|
)
|
||||||
# Create the output directory if it doesn't already exist
|
# Create the output directory if it doesn't already exist
|
||||||
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
||||||
|
|
Loading…
Reference in a new issue