-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/add-pymeilisearch
- Loading branch information
Showing
86 changed files
with
1,779 additions
and
677 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# This script generates the different versions of the ansys-dpf-core wheels based on a given input. | ||
# Input can be one of ["any", "win", "manylinux1", "manylinux_2_17"] | ||
|
||
import argparse | ||
import pathlib | ||
import subprocess | ||
import os | ||
import sys | ||
import shutil | ||
import tempfile | ||
|
||
|
||
supported_platforms = { | ||
"any": "any", | ||
"win": "win_amd64", | ||
"manylinux1": "manylinux1_x86_64", | ||
"manylinux_2_17": "manylinux_2_17_x86_64" | ||
} | ||
|
||
argParser = argparse.ArgumentParser() | ||
argParser.add_argument("-p", "--platform", help="platform") | ||
argParser.add_argument("-w", "--wheelhouse", help="platform", action='store_true') | ||
|
||
args = argParser.parse_args() | ||
|
||
if args.platform not in supported_platforms: | ||
raise ValueError(f"Platform {args.platform} is not supported. " | ||
f"Supported platforms are: {list(supported_platforms.keys())}") | ||
else: | ||
requested_platform = supported_platforms[args.platform] | ||
print(requested_platform) | ||
|
||
# Move binaries out of the source depending on platform requested | ||
# any: move all binaries out before building | ||
# win: move .so binaries out before building | ||
# lin: move .dll binaries out before building | ||
with tempfile.TemporaryDirectory() as tmpdirname: | ||
print('Created temporary directory: ', tmpdirname) | ||
|
||
# Create the temporary build-opts.cfg | ||
build_opts_path = os.path.join(tmpdirname, "build-opts.cfg") | ||
with open(build_opts_path, "w") as build_opts_file: | ||
build_opts_file.write(f"[bdist_wheel]\nplat-name={requested_platform}") | ||
os.environ["DIST_EXTRA_CONFIG"] = build_opts_path | ||
|
||
# Move the binaries | ||
gatebin_folder_path = os.path.join( | ||
os.path.curdir, | ||
os.path.join("src", "ansys", "dpf", "gatebin") | ||
) | ||
binaries_to_move = [] | ||
moved = [] | ||
if "win" in requested_platform or "any" == requested_platform: | ||
# Move linux binaries | ||
binaries_to_move.extend(["libAns.Dpf.GrpcClient.so", "libDPFClientAPI.so"]) | ||
if "linux" in requested_platform or "any" == requested_platform: | ||
# Move windows binaries | ||
binaries_to_move.extend(["Ans.Dpf.GrpcClient.dll", "DPFClientAPI.dll"]) | ||
if "any" == requested_platform: | ||
binaries_to_move.extend(["_version.py"]) | ||
|
||
for binary_name in binaries_to_move: | ||
src = os.path.join(gatebin_folder_path, binary_name) | ||
dst = os.path.join(tmpdirname, binary_name) | ||
print(f"Moving {src} to {dst}") | ||
shutil.move(src=src, dst=dst) | ||
moved.append([dst, src]) | ||
|
||
if "any" == requested_platform: | ||
# Also remove the gatebin folder | ||
os.rmdir(gatebin_folder_path) | ||
|
||
# Call the build | ||
if not args.wheelhouse: | ||
cmd = [sys.executable, "-m", "build", "--wheel"] | ||
else: | ||
cmd = [sys.executable, "-m", "pip", "wheel", "-w", "dist", "."] | ||
try: | ||
subprocess.run(cmd, capture_output=False, text=True) | ||
print("Done building the wheel.") | ||
except Exception as e: | ||
print(f"Build failed with error: {e}") | ||
|
||
if "any" == requested_platform: | ||
# Recreate the gatebin folder | ||
os.mkdir(gatebin_folder_path) | ||
|
||
# Move binaries back | ||
for move_back in moved: | ||
print(f"Moving back {move_back[0]} to {move_back[1]}") | ||
shutil.move(src=move_back[0], dst=move_back[1]) | ||
print("Binaries moved back.") | ||
|
||
print(f"Done building {requested_platform} wheel for ansys-dpf-core!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,24 +66,53 @@ jobs: | |
echo "ANSYS_DPF_ACCEPT_LA=Y" >> $GITHUB_ENV | ||
echo "ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}" >> $GITHUB_ENV | ||
- name: Setup Python | ||
uses: actions/[email protected].0 | ||
- name: "Setup Python" | ||
uses: actions/[email protected].1 | ||
with: | ||
python-version: ${{ inputs.python_version }} | ||
|
||
- name: "Build Package" | ||
id: build-package | ||
uses: ansys/pydpf-actions/[email protected] | ||
- name: "Install requirements" | ||
run: pip install -r requirements/requirements_build.txt | ||
|
||
- name: "Build the wheel" | ||
shell: bash | ||
run: | | ||
if [ ${{ matrix.os }} == "ubuntu-latest" ]; then | ||
export platform="manylinux_2_17" | ||
else | ||
export platform="win" | ||
fi | ||
python .ci/build_wheel.py -p $platform -w | ||
- name: "Expose the wheel" | ||
shell: bash | ||
id: wheel | ||
working-directory: dist | ||
run: | | ||
export name=`ls ansys_dpf_core*.whl` | ||
echo ${name} | ||
echo "wheel_name=${name[0]}" >> $GITHUB_OUTPUT | ||
- name: "Install package wheel" | ||
shell: bash | ||
run: | | ||
pip install dist/${{ steps.wheel.outputs.wheel_name }}[plotting] | ||
- name: "Install DPF" | ||
id: set-server-path | ||
uses: ansys/pydpf-actions/[email protected] | ||
with: | ||
python-version: ${{ inputs.python_version }} | ||
ANSYS_VERSION: ${{inputs.ANSYS_VERSION}} | ||
PACKAGE_NAME: ${{env.PACKAGE_NAME}} | ||
MODULE: ${{env.MODULE}} | ||
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}} | ||
install_extras: plotting | ||
wheel: false | ||
wheelhouse: false | ||
standalone_suffix: ${{ inputs.standalone_suffix }} | ||
ANSYS_VERSION : ${{inputs.ANSYS_VERSION}} | ||
|
||
- name: "Check licences of packages" | ||
uses: ansys/pydpf-actions/[email protected] | ||
|
||
- name: "Test import" | ||
shell: bash | ||
working-directory: tests | ||
run: python -c "from ansys.dpf import core" | ||
|
||
- name: "Setup headless display" | ||
uses: pyvista/setup-headless-display-action@v1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,23 +71,53 @@ jobs: | |
echo "ANSYS_DPF_ACCEPT_LA=Y" >> $GITHUB_ENV | ||
echo "ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}" >> $GITHUB_ENV | ||
- name: Setup Python | ||
- name: "Setup Python" | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: "Build Package" | ||
uses: ansys/pydpf-actions/[email protected] | ||
- name: "Install requirements" | ||
run: pip install -r requirements/requirements_build.txt | ||
|
||
- name: "Build the wheel" | ||
shell: bash | ||
run: | | ||
if [ ${{ matrix.os }} == "ubuntu-latest" ]; then | ||
export platform="manylinux_2_17" | ||
else | ||
export platform="win" | ||
fi | ||
python .ci/build_wheel.py -p $platform -w | ||
- name: "Expose the wheel" | ||
shell: bash | ||
id: wheel | ||
working-directory: dist | ||
run: | | ||
export name=`ls ansys_dpf_core*.whl` | ||
echo ${name} | ||
echo "wheel_name=${name[0]}" >> $GITHUB_OUTPUT | ||
- name: "Install package wheel" | ||
shell: bash | ||
run: | | ||
pip install dist/${{ steps.wheel.outputs.wheel_name }}[plotting] | ||
- name: "Install DPF" | ||
id: set-server-path | ||
uses: ansys/pydpf-actions/[email protected] | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
ANSYS_VERSION: ${{inputs.ANSYS_VERSION}} | ||
PACKAGE_NAME: ${{ env.PACKAGE_NAME }} | ||
MODULE: ${{ env.MODULE }} | ||
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}} | ||
install_extras: plotting | ||
wheelhouse: false | ||
wheel: false | ||
standalone_suffix: ${{ inputs.standalone_suffix }} | ||
ANSYS_VERSION : ${{inputs.ANSYS_VERSION}} | ||
|
||
- name: "Check licences of packages" | ||
uses: ansys/pydpf-actions/[email protected] | ||
|
||
- name: "Test import" | ||
shell: bash | ||
working-directory: tests | ||
run: python -c "from ansys.dpf import core" | ||
|
||
- name: "Prepare Testing Environment" | ||
uses: ansys/pydpf-actions/[email protected] | ||
|
Oops, something went wrong.