Skip to content

Commit

Permalink
Merge pull request #10406 from NREL/build_python_wheel
Browse files Browse the repository at this point in the history
Build python wheel - Quick Fixes
  • Loading branch information
Myoldmopar authored Feb 20, 2024
2 parents 0a32a9e + 726da7c commit 3d4abc3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ on:
jobs:
build_wheel:

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
python-version: ["3.9"]
os: [ubuntu-22.04, macos-13, windows-2019]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout EnergyPlus
uses: actions/checkout@v3
Expand All @@ -43,5 +43,5 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: dist
name: energyplus-wheel-${{ matrix.os }}
path: ./dist
14 changes: 9 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@

from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from setuptools.errors import CompileError
from shutil import rmtree, copy
from platform import machine, system
from os import cpu_count
Expand Down Expand Up @@ -145,9 +144,10 @@ def cmake_configure_command() -> list[str]:
@staticmethod
def cmake_build_command() -> list[str]:
cmake_build_cmd = ["cmake", "--build", "."]
if system() == "Windows":
if system() == "Windows": # VS builds require specifying the build config
cmake_build_cmd.extend(["--config", "Release"])
cmake_build_cmd.extend(['--', '-j', f"{cpu_count() - 1}"])
else: # MSBuild doesn't like the -j passed in, so only do this on Non-Windows
cmake_build_cmd.extend(['--', '-j', f"{cpu_count() - 1}"])
return cmake_build_cmd

@staticmethod
Expand All @@ -167,13 +167,17 @@ def run(self):
cmake_cmd = self.cmake_configure_command()
check_call(cmake_cmd, cwd=build_root_directory)
except CalledProcessError as cpe:
raise CompileError(f"CMake failed to configure EnergyPlus, check error logs, raw error message: {cpe}")
raise Exception(
f"CMake failed to configure EnergyPlus, check error logs, raw error message: {cpe}"
) from None

try:
cmake_build_cmd = self.cmake_build_command()
check_call(cmake_build_cmd, cwd=build_root_directory)
except CalledProcessError as cpe:
raise CompileError(f"CMake failed to build EnergyPlus, check error logs, raw error message: {cpe}")
raise Exception(
f"CMake failed to build EnergyPlus, check error logs, raw error message: {cpe}"
) from None

# while EnergyPlus is built in the repo/build-wheel folder, set up the path to the actual wheel build
# this will be in repo/build-wheel/build/energyplus to avoid conflicting with dev's normal repo/build folders
Expand Down

5 comments on commit 3d4abc3

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2766 of 2766 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (2788 of 2788 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1978 of 1978 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (791 of 791 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (Myoldmopar) - x86_64-MacOS-10.18-clang-15.0.0: OK (2766 of 2767 tests passed, 0 test warnings)

Build Badge Test Badge

Please sign in to comment.