Skip to content

Commit

Permalink
WiP: publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
corey committed Nov 5, 2023
1 parent 763abef commit ebc3dd8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
14 changes: 12 additions & 2 deletions python/origen/build_helpers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
publish_step = True
else:
publish_step = \
os.getenv("GITHUB_WORKFLOW", "") == "publish" \
or "PEP517_BUILD_BACKEND" not in os.environ
os.getenv("GITHUB_WORKFLOW", "") == "publish"
# or "PEP517_BUILD_BACKEND" not in os.environ

def compile_rust(dir, target=None, workspace=False):
cmd = ['cargo', 'build']
Expand All @@ -28,3 +28,13 @@ def compile_rust(dir, target=None, workspace=False):
if compile_result.returncode != 0:
print(f"Failed to build target from {dir}. Received return code {compile_result.returncode}")
exit(1)

def ls_dir(dir):
print(f"Showing directory: {dir}")
subprocess.run(
["dir" if windows else "ls"],
stderr=sys.stderr,
stdout=sys.stdout,
cwd=dir,
shell=windows,
)
4 changes: 3 additions & 1 deletion python/origen/poetry_build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pathlib, shutil, os
from build_helpers import windows, compile_rust, publish_step
from build_helpers import windows, compile_rust, publish_step, ls_dir

if __name__ == '__main__':
if publish_step:
Expand Down Expand Up @@ -27,13 +27,15 @@
compile_rust(origen_cli_src, rust_build_target, True)
if copy_cli:
print(f"Copying CLI for packaging from ({origen_cli_target} to {origen_cli_pkg_dir})")
ls_dir(origen_cli_target.parent)
shutil.copy2(origen_cli_target, origen_cli_pkg_dir)

# Build and copy Origen library
if build_lib:
compile_rust(origen_lib_src, rust_build_target, False)
if copy_lib:
print(f"Copying CLI for packaging ({origen_lib_target} to {origen_pkg_lib})")
ls_dir(origen_lib_target.parent)
shutil.copy2(origen_lib_target, origen_pkg_lib)
print("Libraries built!")
else:
Expand Down
3 changes: 2 additions & 1 deletion python/origen_metal/poetry_build.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pathlib, shutil, os, sys

sys.path.insert(0, str(pathlib.Path(__file__).parent.parent.joinpath("origen")))
from build_helpers import windows, compile_rust, publish_step
from build_helpers import windows, compile_rust, publish_step, ls_dir

if __name__ == '__main__':
if publish_step:
Expand All @@ -22,6 +22,7 @@
compile_rust(om_lib_src, rust_build_target, False)
if copy_build_target:
print(f"Copying compiled library '{om_lib_target}' to '{om_lib}'")
ls_dir(om_lib_target.parent)
shutil.copy2(om_lib_target, om_lib)

# Final check that compiled library is present
Expand Down

0 comments on commit ebc3dd8

Please sign in to comment.