diff --git a/.github/workflows/CI_pyHAMS.yml b/.github/workflows/CI_pyHAMS.yml index 4ff2cc8..124d18f 100644 --- a/.github/workflows/CI_pyHAMS.yml +++ b/.github/workflows/CI_pyHAMS.yml @@ -87,11 +87,13 @@ jobs: - uses: conda-incubator/setup-miniconda@v2 # https://github.com/marketplace/actions/setup-miniconda with: + mamba-version: "*" miniconda-version: "latest" - auto-update-conda: true + #auto-update-conda: true python-version: ${{ matrix.python-version }} environment-file: environment.yml channels: conda-forge + channel-priority: true activate-environment: test auto-activate-base: false @@ -99,18 +101,20 @@ jobs: - name: Add dependencies windows specific if: contains( matrix.os, 'windows') run: | - conda install -y m2w64-toolchain libpython - conda list + mamba install -y m2w64-toolchain libpython + mamba list # Install dependencies of WISDEM specific to windows - name: Add dependencies mac specific if: contains( matrix.os, 'mac') run: | - conda install -y compilers + mamba install -y compilers gfortran --version # Install - name: Conda Install pyHAMS + env: + MESON_ARGS: "" run: | python setup.py develop diff --git a/setup.py b/setup.py index c3a9267..5077b06 100644 --- a/setup.py +++ b/setup.py @@ -35,6 +35,8 @@ def run_meson_build(staging_dir): meson_args = "" if "MESON_ARGS" in os.environ: meson_args = os.environ["MESON_ARGS"] + # A weird add-on on mac github action runners needs to be removed + if meson_args.find("buildtype") >= 0: meson_args = "" if platform.system() == "Windows": if not "FC" in os.environ: @@ -47,14 +49,12 @@ def run_meson_build(staging_dir): if meson_path is None: raise OSError("The meson command cannot be found on the system") - meson_call = ( - f"{meson_path} setup {staging_dir} --wipe --prefix={prefix} " - + f"-Dpython.purelibdir={purelibdir} -Dpython.platlibdir={purelibdir} {meson_args}" - ) - sysargs = meson_call.split(" ") - sysargs = [arg for arg in sysargs if arg != ""] - print(sysargs) - p1 = subprocess.run(sysargs, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + meson_call = [meson_path, "setup", staging_dir, "--wipe", + f"--prefix={prefix}", f"-Dpython.purelibdir={purelibdir}", + f"-Dpython.platlibdir={purelibdir}", meson_args] + meson_call = [m for m in meson_call if m != ""] + print(meson_call) + p1 = subprocess.run(meson_call, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) os.makedirs(staging_dir, exist_ok=True) setup_log = os.path.join(staging_dir, "setup.log") with open(setup_log, "wb") as f: @@ -62,23 +62,20 @@ def run_meson_build(staging_dir): if p1.returncode != 0: with open(setup_log, "r") as f: print(f.read()) - raise OSError(sysargs, f"The meson setup command failed! Check the log at {setup_log} for more information.") + raise OSError(meson_call, f"The meson setup command failed! Check the log at {setup_log} for more information.") # build - meson_call = f"{meson_path} compile -vC {staging_dir}" - sysargs = meson_call.split(" ") - sysargs = [arg for arg in sysargs if arg != ""] - print(sysargs) - p2 = subprocess.run(sysargs, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + meson_call = [meson_path, "compile", "-vC", staging_dir] + meson_call = [m for m in meson_call if m != ""] + print(meson_call) + p2 = subprocess.run(meson_call, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) compile_log = os.path.join(staging_dir, "compile.log") with open(compile_log, "wb") as f: f.write(p2.stdout) if p2.returncode != 0: with open(compile_log, "r") as f: print(f.read()) - raise OSError( - sysargs, f"The meson compile command failed! Check the log at {compile_log} for more information." - ) + raise OSError(meson_call, f"The meson compile command failed! Check the log at {compile_log} for more information.") def copy_shared_libraries(): @@ -94,7 +91,7 @@ def copy_shared_libraries(): match = re.search(staging_dir, new_path) new_path = new_path[match.span()[1] + 1 :] print(f"Copying build file {file_path} -> {new_path}") - shutil.copy(file_path, new_path) + shutil.move(file_path, new_path) if __name__ == "__main__": @@ -102,19 +99,13 @@ def copy_shared_libraries(): # used as the sources for setuptools staging_dir = "meson_build" - # If on Windows, use the compiled exe from Yingyi + # this keeps the meson build system from running more than once if "dist" not in str(os.path.abspath(__file__)): cwd = os.getcwd() run_meson_build(staging_dir) os.chdir(cwd) copy_shared_libraries() - #docs_require = "" - #req_txt = os.path.join("doc", "requirements.txt") - #if os.path.isfile(req_txt): - # with open(req_txt) as f: - # docs_require = f.read().splitlines() - init_file = os.path.join("pyhams", "__init__.py") #__version__ = re.findall( # r"""__version__ = ["']+([0-9\.]*)["']+""",