From 457c5cda9ee0699e10bcb684175f8a6f75f56ba9 Mon Sep 17 00:00:00 2001 From: Carl Montanari Date: Sun, 28 Jul 2024 09:26:28 -0700 Subject: [PATCH] chore: add --pre flag for (python) pre-release build --- .github/workflows/pre_release.yaml | 7 +++---- noxfile.py | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pre_release.yaml b/.github/workflows/pre_release.yaml index 9cb576f..174b7b4 100644 --- a/.github/workflows/pre_release.yaml +++ b/.github/workflows/pre_release.yaml @@ -4,8 +4,7 @@ on: schedule: # weekly at 0300 PST/1000 UTC on Sunday - cron: '0 10 * * 0' - # commented out till 3.13 - # workflow_dispatch: + workflow_dispatch: {} jobs: build_posix: @@ -32,8 +31,8 @@ jobs: python -m pip install --upgrade setuptools wheel python -m pip install nox - name: run nox - # TERM is needed needed to make the terminal a tty (i think? without this system ssh is super broken) + # TERM is needed to make the terminal a tty (i think? without this system ssh is super broken) # libssh2/ssh2-python were getting libssh2 linked incorrectly/weirdly and libraries were trying to be loaded # from the temp dir that pip used for installs. setting the DYLD_LIBRARY_PATH envvar seems to solve this -- note # that if brew macos packages get updated on runners this may break again :) - run: TERM=xterm DYLD_LIBRARY_PATH=/opt/homebrew/Cellar/libssh2/1.11.0_1/lib python -m nox -p $FRIENDLY_PYTHON_VERSION -k "not darglint" \ No newline at end of file + run: TERM=xterm DYLD_LIBRARY_PATH=/opt/homebrew/Cellar/libssh2/1.11.0_1/lib PRE_RELEASE=1 python -m nox -p $FRIENDLY_PYTHON_VERSION -k "not darglint" \ No newline at end of file diff --git a/noxfile.py b/noxfile.py index 7ae0368..58f948a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,5 +1,6 @@ """nornir_scrapli.noxfile""" +import os import re import sys from pathlib import Path @@ -11,6 +12,8 @@ nox.options.stop_on_first_error = False nox.options.default_venv_backend = "venv" +PRE = bool(os.environ.get("PRE_RELEASE")) + def parse_requirements(dev: bool = True) -> Dict[str, str]: """ @@ -64,6 +67,18 @@ def parse_requirements(dev: bool = True) -> Dict[str, str]: SKIP_LIST: List[str] = [] +def _get_install_test_args() -> List[str]: + args = [".[dev]"] + + if sys.platform == "darwin": + args = [".[dev-darwin]"] + + if PRE: + args.append("--pre") + + return args + + @nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]) def unit_tests(session): """ @@ -83,7 +98,7 @@ def unit_tests(session): return session.install("-U", "setuptools", "wheel", "pip") - session.install(".[dev]") + session.install(*_get_install_test_args()) session.run( "python", "-m", @@ -153,7 +168,7 @@ def pylama(session): N/A """ - session.install(".[dev]") + session.install(*_get_install_test_args()) session.run("python", "-m", "pylama", ".")