Skip to content

Commit 2d2a514

Browse files
committed
removed trying to force env vars in build script.
1 parent 4afaabc commit 2d2a514

File tree

2 files changed

+8
-72
lines changed

2 files changed

+8
-72
lines changed

.github/workflows/on-release-main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
env:
5656
CIBW_BEFORE_ALL_LINUX: |
5757
cd /opt
58-
58+
5959
# Install GraalVM
6060
export GRAALVM_VERSION=23.0.2
6161
export ARCH=x86_64 && \
@@ -65,19 +65,19 @@ jobs:
6565
echo "export JAVA_HOME=$GRAALVM_HOME" >> ~/.bashrc
6666
echo "export GRAALVM_HOME=$GRAALVM_HOME" >> ~/.bashrc
6767
echo "export PATH=$GRAALVM_HOME/bin:\$PATH" >> ~/.bashrc
68-
68+
6969
# install Poetry
7070
curl -sSL https://install.python-poetry.org | python3 -
7171
echo "export PATH=~/.local/bin:\$PATH" >> ~/.bashrc
72-
72+
7373
# Install Maven
7474
export MAVEN_VERSION=3.9.9
7575
curl -L -o apache-maven.tar.gz https://dlcdn.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
7676
tar -xzf apache-maven.tar.gz
7777
export MAVEN_HOME="$(cd "$(ls | grep "$MAVEN_VERSION" | grep maven)" && pwd)"
7878
echo "export MAVEN_HOME=$MAVEN_HOME" >> ~/.bashrc
7979
echo "export PATH=$MAVEN_HOME/bin:\$PATH" >> ~/.bashrc
80-
80+
8181
source ~/.bashrc
8282
CIBW_BEFORE_BUILD_LINUX: |
8383
poetry install --no-interaction

build.py

Lines changed: 4 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,16 @@
1-
import os
21
import shutil
32
import subprocess
43
import sys
54
from collections.abc import Mapping
65
from pathlib import Path
76

87

9-
def run_command(command: str, cwd: Path, env: Mapping[str, str]) -> None:
8+
def run_command(command: str, cwd: Path, env: Mapping[str, str] | None = None) -> None:
109
result = subprocess.run(command, cwd=cwd, env=env, shell=True, check=True, text=True)
1110
if result.returncode != 0:
1211
sys.exit(result.returncode)
1312

1413

15-
def check_env() -> Mapping[str, str]:
16-
# print the path environment variable
17-
PATH: str = os.getenv("PATH", "")
18-
LD_LIBRARY_PATH: str = os.getenv("LD_LIBRARY_PATH", "")
19-
JAVA_HOME: str | None = os.getenv("JAVA_HOME") or os.getenv("GRAALVM_HOME")
20-
GRAALVM_HOME: str | None = os.getenv("GRAALVM_HOME") or os.getenv("JAVA_HOME")
21-
MAVEN_HOME: str | None = os.getenv("MAVEN_HOME")
22-
if JAVA_HOME is None and GRAALVM_HOME is None:
23-
print("JAVA_HOME or GRAALVM_HOME environment variable must be set")
24-
sys.exit(1)
25-
print(f"PATH={PATH}")
26-
print(f"JAVA_HOME={JAVA_HOME}")
27-
print(f"GRAALVM_HOME={GRAALVM_HOME}")
28-
print(f"MAVEN_HOME={MAVEN_HOME}")
29-
30-
# find path to mvn
31-
mvn_path: str | None = shutil.which("mvn")
32-
if mvn_path is None:
33-
print("mvn could not be found")
34-
sys.exit(1)
35-
mvn_install_dir = Path(mvn_path).parent
36-
37-
# find path to poetry
38-
poetry_path: str | None = shutil.which("poetry")
39-
if poetry_path is None:
40-
print("poetry could not be found")
41-
sys.exit(1)
42-
poetry_install_dir = Path(poetry_path).parent
43-
44-
# Check if native-image is installed
45-
native_image_path: str | None = shutil.which("native-image")
46-
if native_image_path is None:
47-
print("native-image could not be found")
48-
sys.exit(1)
49-
native_image_install_dir = Path(native_image_path).parent
50-
native_image_agent_dir = Path(GRAALVM_HOME) / "lib"
51-
graalvm_bin_dir = Path(GRAALVM_HOME) / "bin"
52-
53-
# get PATH and append mvn and poetry install directories
54-
NEW_PATH = f"{mvn_install_dir}:{poetry_install_dir}:{native_image_install_dir}:{graalvm_bin_dir}:{PATH}"
55-
56-
if LD_LIBRARY_PATH == "":
57-
LD_LIBRARY_PATH = f"{native_image_agent_dir}"
58-
else:
59-
LD_LIBRARY_PATH = f"{native_image_agent_dir}/{LD_LIBRARY_PATH}"
60-
61-
new_env = os.environ.copy()
62-
new_env["PATH"] = NEW_PATH
63-
new_env["LD_LIBRARY_PATH"] = LD_LIBRARY_PATH
64-
if JAVA_HOME is not None:
65-
new_env["JAVA_HOME"] = JAVA_HOME
66-
if GRAALVM_HOME is not None:
67-
new_env["GRAALVM_HOME"] = GRAALVM_HOME
68-
if MAVEN_HOME is not None:
69-
new_env["MAVEN_HOME"] = MAVEN_HOME
70-
71-
return new_env
72-
73-
7414
def main() -> None:
7515
root_dir = Path(__file__).resolve().parent
7616
vcell_submodule_dir = root_dir / "vcell_submodule"
@@ -80,14 +20,11 @@ def main() -> None:
8020
# Ensure the libvcell/lib directory exists
8121
libvcell_lib_dir.mkdir(parents=True, exist_ok=True)
8222

83-
# Check the environment variables and pass them to the subprocess
84-
new_env = check_env()
85-
8623
# Build VCell Java project from submodule
87-
run_command("mvn --batch-mode clean install -DskipTests", cwd=vcell_submodule_dir, env=new_env)
24+
run_command("mvn --batch-mode clean install -DskipTests", cwd=vcell_submodule_dir)
8825

8926
# Build vcell-native as Java
90-
run_command("mvn --batch-mode clean install", cwd=vcell_native_dir, env=new_env)
27+
run_command("mvn --batch-mode clean install", cwd=vcell_native_dir)
9128

9229
# Run with native-image-agent to record configuration for native-image
9330
run_command(
@@ -96,11 +33,10 @@ def main() -> None:
9633
"src/test/resources/TinySpacialProject_Application0.xml "
9734
"target/sbml-input",
9835
cwd=vcell_native_dir,
99-
env=new_env,
10036
)
10137

10238
# Build vcell-native as native shared object library
103-
run_command("mvn package -P shared-dll", cwd=vcell_native_dir, env=new_env)
39+
run_command("mvn package -P shared-dll", cwd=vcell_native_dir)
10440

10541
# Copy the shared library to libvcell/lib
10642
for ext in ["so", "dylib", "dll"]:

0 commit comments

Comments
 (0)