Skip to content

Commit

Permalink
Remove unnecessary Amrex stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Aug 2, 2024
1 parent f4d5eae commit 501a78f
Showing 1 changed file with 0 additions and 108 deletions.
108 changes: 0 additions & 108 deletions new_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@
import re
import sys

import requests

try:
from configupdater import ConfigUpdater
except ImportError:
print("Warning: Cannot update .ini files without 'configupdater'")
print("Consider running 'python -m pip install configupdater'")
ConfigUpdater = None
sys.exit(1)


# Maintainer Inputs ###########################################################

print(
Expand All @@ -44,15 +33,6 @@
print("You did not confirm with 'y', aborting.")
sys.exit(1)


# New Version #################################################################

# AMReX development HEAD
openpmd_gh = requests.get(
"https://api.github.com/repos/openPMD/openPMD-api/commits/dev"
)
openpmd_HEAD = openpmd_gh.json()["sha"]

MAJOR = input("MAJOR version? (e.g., 1) ")
MINOR = input("MINOR version? (e.g., 0) ")
PATCH = input("PATCH version? (e.g., 0) ")
Expand Down Expand Up @@ -90,32 +70,6 @@
you want to require from AMReX:\n"""
)

# print(f"Currently, WarpX builds against this AMReX commit/branch/sha: {amrex_branch}")
print(f"openPMD HEAD commit (dev branch): {openpmd_HEAD}")
# amrex_new_branch = input(f"Update AMReX commit/branch/sha: ").strip()
# if not amrex_new_branch:
# amrex_new_branch = amrex_branch
# print(f"--> Nothing entered, will keep: {amrex_branch}")
# print()

# print(f"Currently, a pre-installed AMReX is required at least at version: {amrex_minimal}")
# today = datetime.date.today().strftime("%y.%m")
# amrex_new_minimal = input(f"New minimal AMReX version (e.g. {today})? ").strip()
# if not amrex_new_minimal:
# amrex_new_minimal = amrex_minimal
# print(f"--> Nothing entered, will keep: {amrex_minimal}")

# print()
# print(f"New AMReX commit/branch/sha: {amrex_new_branch}")
# print(f"New minimal AMReX version: {amrex_new_minimal}\n")

REPLY = input("Is this information correct? Will now start updating! [y/N] ")
print()
if not REPLY in ["Y", "y"]:
print("You did not confirm with 'y', aborting.")
sys.exit(1)


# Updates #####################################################################

# run_test.sh (used also for Azure Pipelines)
Expand Down Expand Up @@ -167,68 +121,6 @@ def replace(key, value):
with open(version_hpp_path, "w", encoding="utf-8") as f:
f.write(version_hpp_content)


sys.exit(0)

# CI: legacy build check in .github/workflows/cuda.yml
ci_gnumake_path = str(REPO_DIR.joinpath(".github/workflows/cuda.yml"))
with open(ci_gnumake_path, encoding="utf-8") as f:
ci_gnumake_content = f.read()
# branch/commit/tag (git fetcher) version
# cd ../amrex && git checkout COMMIT_TAG_OR_BRANCH && cd -
ci_gnumake_content = re.sub(
r"(.*cd\s+\.\./amrex.+git checkout\s+--detach\s+)(.+)(\s+&&\s.*)",
r"\g<1>{}\g<3>".format(amrex_new_branch),
ci_gnumake_content,
flags=re.MULTILINE,
)

with open(ci_gnumake_path, "w", encoding="utf-8") as f:
f.write(ci_gnumake_content)

if ConfigUpdater is not None:
# WarpX-tests.ini
tests_ini_path = str(REPO_DIR.joinpath("Regression/WarpX-tests.ini"))
cp = ConfigUpdater()
cp.optionxform = str
cp.read(tests_ini_path)
cp["AMReX"]["branch"].value = amrex_new_branch
cp.update_file()

# WarpX-GPU-tests.ini
tests_gpu_ini_path = str(REPO_DIR.joinpath("Regression/WarpX-GPU-tests.ini"))
cp = ConfigUpdater()
cp.optionxform = str
cp.read(tests_gpu_ini_path)
cp["AMReX"]["branch"].value = amrex_new_branch
cp.update_file()

# WarpX references to AMReX: cmake/dependencies/AMReX.cmake
with open(amrex_cmake_path, encoding="utf-8") as f:
amrex_cmake_content = f.read()

# branch/commit/tag (git fetcher) version
# set(WarpX_amrex_branch "development" ...
amrex_cmake_content = re.sub(
r'(.*set\(WarpX_amrex_branch\s+")(.+)("\s+.*)',
r"\g<1>{}\g<3>".format(amrex_new_branch),
amrex_cmake_content,
flags=re.MULTILINE,
)

# minimal (external) version
# find_package(AMReX YY.MM CONFIG ...
amrex_cmake_content = re.sub(
r"(.*find_package\(AMReX\s+)(.+)(\s+CONFIG\s+.*)",
r"\g<1>{}\g<3>".format(amrex_new_minimal),
amrex_cmake_content,
flags=re.MULTILINE,
)

with open(amrex_cmake_path, "w", encoding="utf-8") as f:
f.write(amrex_cmake_content)


# Epilogue ####################################################################

print(
Expand Down

0 comments on commit 501a78f

Please sign in to comment.