Skip to content

Commit

Permalink
moving wheel build to separate script #13963
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Mar 7, 2024
1 parent 8c11d46 commit ea58813
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 19 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/wheel-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ jobs:
uses: compnerd/gha-setup-vsdevenv@main

- name: Installing Python build environment
run: |
python -m pip install wheel build
mkdir tmp
run: python -m pip install wheel build

- name: Building libsumo plain
if: matrix.build_type == 'libsumo'
Expand All @@ -98,10 +96,7 @@ jobs:
python -m build --wheel tools -o dist
python tools\build_config\version.py tools\build_config\setup-traci.py tools\setup.py
python -m build --wheel tools -o dist
copy build_config\pyproject.toml .
python tools\build_config\version.py tools\build_config\setup-sumo.py .\setup.py
python -m build --wheel --config-setting=--plat-name=win_amd64 --config-setting=-G=Ninja
python -c "import glob, os; f = glob.glob(\`"dist/eclipse_sumo-*\`")[0]; os.rename(f, f.replace(\`"cp38-cp38\`", \`"py2.py3-none\`"))"
python tools\build_config\buildWindowsSUMOWheel.py
- name: Uploading artifacts
if: matrix.build_type == 'sumo'
Expand Down Expand Up @@ -144,6 +139,9 @@ jobs:

- name: Downloading Wheels artifact
uses: actions/download-artifact@v4
with:
path: python-wheels
merge-multiple: true

- name: Configuring Python
uses: actions/setup-python@v5
Expand All @@ -153,7 +151,7 @@ jobs:
- name: Preparing Python environment
run: |
python -m pip install texttest
python -m pip install (Get-ChildItem -Filter sumo-python-wheels/eclipse_sumo*).FullName
python -m pip install -f python-wheels eclipse_sumo
python -c "import sumo; print('SUMO_HOME=' + sumo.SUMO_HOME)" >> $env:GITHUB_ENV
- name: Running "sumo in the wheel" tests
Expand All @@ -173,9 +171,7 @@ jobs:
python -m pip uninstall -y eclipse-sumo
- name: Installing libsumo
run: |
python -m pip install (Get-ChildItem -Filter sumo-python-wheels/sumolib-*).FullName (Get-ChildItem -Filter sumo-python-wheels/traci-*).FullName
python -m pip install --user (Get-ChildItem -Filter libsumo-python-${{ matrix.python_version }}-wheels/libsumo-*).FullName
run: python -m pip install --user -f python-wheels sumolib traci libsumo

# - name: Running libsumo tests
# run: |
Expand Down
40 changes: 40 additions & 0 deletions tools/build_config/buildWindowsSUMOWheel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
# Copyright (C) 2008-2024 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0/
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the Eclipse
# Public License 2.0 are satisfied: GNU General Public License, version 2
# or later which is available at
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later

# @file buildWindowsSUMOWheel.py
# @author Michael Behrisch
# @date 2024-03-07

import glob
import os
import shutil
import subprocess
import sys
from os.path import join, dirname

import version


def main():
SUMO_HOME = os.environ.get("SUMO_HOME", dirname(dirname(dirname(os.path.abspath(__file__)))))
BUILD_CONFIG = join(SUMO_HOME, "tools", "build_config")
shutil.copy(join(SUMO_HOME, "build_config", "pyproject.toml"), SUMO_HOME)
version.filter_setup_py(join(BUILD_CONFIG, "setup-sumo.py"), join(SUMO_HOME, "setup.py"))
subprocess.call([sys.executable, "-m", "build", "--wheel", "--config-setting=-G=Ninja"], cwd=SUMO_HOME)
f = glob.glob(join(SUMO_HOME, "dist", "eclipse_sumo-*"))[0]
os.rename(f, f.replace("cp3%s-cp3%s" % (sys.version_info.minor, sys.version_info.minor), "py2.py3-none"))


if __name__ == "__main__":
main()
11 changes: 3 additions & 8 deletions tools/build_config/dailyBuildMSVC.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@
import zipfile
import shutil
import sys
import build

import buildWindowsSUMOWheel
import status
import wix
from version import filter_setup_py

env = os.environ
if "SUMO_HOME" not in env:
Expand Down Expand Up @@ -182,13 +181,9 @@ def main(options, platform="x64"):
status.printLog("Warning: Could not create nightly sumo-game.zip! (%s)" % e)

if options.suffix == "extra":
shutil.copy(os.path.join(SUMO_HOME, "build_config", "pyproject.toml"),
os.path.join(SUMO_HOME, "pyproject.toml"))
filter_setup_py(os.path.join(SUMO_HOME, "build_config", "setup-sumo.py"), os.path.join(SUMO_HOME, "setup.py"))
build.ProjectBuilder(SUMO_HOME).build("wheel", {"--plat-name": "win_amd64"})
buildWindowsSUMOWheel.main()
f = glob.glob(os.path.join(SUMO_HOME, "dist", "eclipse_sumo-*"))[0]
shutil.copy(f, os.path.join(options.remoteDir, "wheels",
os.path.basename(f).replace("cp38-cp38", "py2.py3-none")))
shutil.copy(f, os.path.join(options.remoteDir, "wheels"))

debug_handler = status.set_rotating_log(makeAllLog, log_handler)
ret = status.log_subprocess(["cmake", "--build", ".", "--config", "Debug"], cwd=buildDir)
Expand Down

0 comments on commit ea58813

Please sign in to comment.