Skip to content

Commit 1515e35

Browse files
maxcapodi78pre-commit-ci[bot]pyansys-ci-bot
authored
FIX: Remove LD_LIBRARY_PATH need (#1683)
* Remove LD_LIBRARY_PATH need * MISC: Auto fixes from pre-commit.com hooks For more information, see https://pre-commit.ci * chore: adding changelog file 1683.fixed.md [dependabot-skip] * Fix CICD * Fix CICD * removed commented lines --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 4720835 commit 1515e35

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

.github/workflows/ci_cd.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ jobs:
447447
retry_on: error
448448
timeout_minutes: 40
449449
command: |
450-
export LD_LIBRARY_PATH="${{ env.ANSYSEM_ROOT252 }}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
451450
. .venv/bin/activate
452451
pytest tests/system -n auto --dist loadfile -v --cov
453452
@@ -522,7 +521,6 @@ jobs:
522521
retry_on: error
523522
timeout_minutes: 20
524523
command: |
525-
export LD_LIBRARY_PATH="${{ env.ANSYSEM_ROOT252 }}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
526524
. .venv/bin/activate
527525
pytest tests/system -n auto --dist loadfile -v --cov
528526
@@ -597,7 +595,6 @@ jobs:
597595
retry_on: error
598596
timeout_minutes: 20
599597
command: |
600-
export LD_LIBRARY_PATH="${{ env.ANSYSEM_ROOT252 }}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
601598
. .venv/bin/activate
602599
pytest tests/unit -n auto --dist loadfile -v --cov
603600
@@ -672,7 +669,6 @@ jobs:
672669
retry_on: error
673670
timeout_minutes: 20
674671
command: |
675-
export LD_LIBRARY_PATH="${{ env.ANSYSEM_ROOT252 }}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
676672
. .venv/bin/activate
677673
pytest tests/unit -n auto --dist loadfile -v --cov
678674
@@ -843,16 +839,13 @@ jobs:
843839
env:
844840
ANSYSEM: ${{ env.ANSYSEM_ROOT252 }}
845841
run: |
846-
export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
847842
. .venv/bin/activate
848843
pip install --no-cache-dir external/pyaedt[tests]
849844
850845
- name: Install PyEDB
851846
env:
852847
ANSYSEM: ${{ env.ANSYSEM_ROOT252 }}
853848
run: |
854-
export LD_LIBRARY_PATH="${ANSYSEM}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
855-
. .venv/bin/activate
856849
python -m pip install .
857850
858851
- name: Run PyAEDT tests
@@ -864,7 +857,6 @@ jobs:
864857
retry_on: error
865858
timeout_minutes: 50
866859
command: |
867-
export LD_LIBRARY_PATH="${{ env.ANSYSEM_ROOT252 }}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
868860
. .venv/bin/activate
869861
pytest -v external/pyaedt/tests/system/general/test_01_3dlayout_edb.py
870862
pytest -v external/pyaedt/tests/system/general/test_01_configuration_files.py
@@ -879,7 +871,6 @@ jobs:
879871
retry_on: error
880872
timeout_minutes: 50
881873
command: |
882-
export LD_LIBRARY_PATH="${{ env.ANSYSEM_ROOT252 }}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
883874
. .venv/bin/activate
884875
pytest -v external/pyaedt/tests/system/solvers/test_45_workflows.py
885876
pytest -v external/pyaedt/tests/system/solvers/test_00_analyze.py
@@ -893,7 +884,6 @@ jobs:
893884
retry_on: error
894885
timeout_minutes: 50
895886
command: |
896-
export LD_LIBRARY_PATH="${{ env.ANSYSEM_ROOT252 }}/common/mono/Linux64/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
897887
. .venv/bin/activate
898888
pytest -v external/pyaedt/tests/system/extensions/test_cutout.py
899889
pytest -v external/pyaedt/tests/system/extensions/test_configure_layout.py

doc/changelog.d/1683.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove LD_LIBRARY_PATH need

src/pyedb/dotnet/clr_module.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,6 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non
111111
dotnet_root=str(dotnet_root),
112112
)
113113
os.environ["DOTNET_ROOT"] = dotnet_root.as_posix()
114-
if "mono" not in os.getenv("LD_LIBRARY_PATH", ""):
115-
warnings.warn("LD_LIBRARY_PATH needs to be setup to use pyedb.")
116-
warnings.warn("export ANSYSEM_ROOT242=/path/to/AnsysEM/v242/Linux64")
117-
msg = "export LD_LIBRARY_PATH="
118-
msg += "$ANSYSEM_ROOT242/common/mono/Linux64/lib64:$LD_LIBRARY_PATH"
119-
warnings.warn(msg)
120114
is_clr = True
121115
except ImportError:
122116
msg = "pythonnet or dotnetcore not installed. Pyedb will work only in client mode."

src/pyedb/dotnet/edb.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ def __initialization(self):
358358
self.logger.info(f"Edb version {self.version}")
359359

360360
"""Initialize DLLs."""
361+
import ctypes
362+
361363
from pyedb import __version__
362364
from pyedb.dotnet.clr_module import _clr, edb_initialized
363365

@@ -368,7 +370,11 @@ def __initialization(self):
368370
self.logger.info("Python version %s", sys.version)
369371

370372
sys.path.append(self.base_path)
371-
373+
if is_linux:
374+
ctypes.cdll.LoadLibrary(
375+
os.path.join(self.base_path, "common", "mono", "Linux64", "lib", "libmonosgen-2.0.so.1")
376+
)
377+
ctypes.cdll.LoadLibrary(os.path.join(self.base_path, "libEDBCWrapper.so"))
372378
_clr.AddReference("Ansys.Ansoft.Edb")
373379
_clr.AddReference("Ansys.Ansoft.EdbBuilderUtils")
374380
_clr.AddReference("Ansys.Ansoft.SimSetupData")

0 commit comments

Comments
 (0)