mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-05 15:03:33 +08:00
added VENV_STATE to Makefile for forcing venv rebuilds
This commit is contained in:
parent
2b12bf24fa
commit
e7d3ea98ec
27
Makefile
27
Makefile
@ -176,7 +176,7 @@ dummymodules-clean: env
|
|||||||
|
|
||||||
# Build the project's Python virtual environment. This should happen
|
# Build the project's Python virtual environment. This should happen
|
||||||
# automatically as a dependency of the env target.
|
# automatically as a dependency of the env target.
|
||||||
venv: .venv/efro_venv_complete
|
venv: .venv/.efro_venv_complete
|
||||||
|
|
||||||
# Update pip requirements to latest versions.
|
# Update pip requirements to latest versions.
|
||||||
venv-upgrade: env
|
venv-upgrade: env
|
||||||
@ -1221,10 +1221,10 @@ TOOL_CFG_INST = $(PCOMMAND) tool_config_install
|
|||||||
|
|
||||||
# Anything that affects tool-config generation.
|
# Anything that affects tool-config generation.
|
||||||
TOOL_CFG_SRC = tools/efrotools/toolconfig.py config/projectconfig.json \
|
TOOL_CFG_SRC = tools/efrotools/toolconfig.py config/projectconfig.json \
|
||||||
.venv/efro_venv_complete tools/pcommand
|
.venv/.efro_venv_complete tools/pcommand
|
||||||
|
|
||||||
# Anything that should trigger an environment-check when changed.
|
# Anything that should trigger an environment-check when changed.
|
||||||
ENV_SRC = tools/batools/build.py .venv/efro_venv_complete tools/pcommand
|
ENV_SRC = tools/batools/build.py .venv/.efro_venv_complete tools/pcommand
|
||||||
|
|
||||||
# Generate a pcommand script hard-coded to use our virtual environment.
|
# Generate a pcommand script hard-coded to use our virtual environment.
|
||||||
# This is a prereq dependency so should not itself depend on env.
|
# This is a prereq dependency so should not itself depend on env.
|
||||||
@ -1273,21 +1273,28 @@ SKIP_ENV_CHECKS ?= 0
|
|||||||
|
|
||||||
VENV_PYTHON ?= python3.12
|
VENV_PYTHON ?= python3.12
|
||||||
|
|
||||||
# Rebuild our virtual environment whenever reqs or Python version changes.
|
# Increment this to force all downstream venvs to fully rebuild. Useful after
|
||||||
# This is a prereq dependency so should not itself depend on env. Note that we
|
# removing requirements since upgrading in place will never uninstall stuff.
|
||||||
# rely on pcommand but can't use it in here until the end when the venv is up.
|
VENV_STATE = 0
|
||||||
# Also note that we try to update existing venvs when possible, but when
|
|
||||||
# Python version changes we blow it away and start over to be safe.
|
# Rebuild our virtual environment whenever reqs, Python version, or explicit
|
||||||
.venv/efro_venv_complete: tools/pcommand config/requirements.txt \
|
# state number changes. This is a dependency of env so it should not itself
|
||||||
|
# depend on env. Note that we list pcommand as a requirement but can't use it
|
||||||
|
# in here until the end when the venv is up. Also note that we try to update
|
||||||
|
# venvs in place when possible, but when Python version or venv-state changes
|
||||||
|
# we blow it away and start over to be safe.
|
||||||
|
.venv/.efro_venv_complete: tools/pcommand config/requirements.txt \
|
||||||
tools/efrotools/pyver.py
|
tools/efrotools/pyver.py
|
||||||
@[ -f .venv/bin/$(VENV_PYTHON) ] \
|
@[ -f .venv/bin/$(VENV_PYTHON) ] \
|
||||||
|
&& [ -f .venv/.efro_venv_state_$(VENV_STATE) ] \
|
||||||
&& echo Updating existing $(VENV_PYTHON) virtual environment in \'.venv\'... \
|
&& echo Updating existing $(VENV_PYTHON) virtual environment in \'.venv\'... \
|
||||||
|| (echo Creating new $(VENV_PYTHON) virtual environment in \'.venv\'... \
|
|| (echo Creating new $(VENV_PYTHON) virtual environment in \'.venv\'... \
|
||||||
&& rm -rf .venv)
|
&& rm -rf .venv)
|
||||||
$(VENV_PYTHON) -m venv .venv
|
$(VENV_PYTHON) -m venv .venv
|
||||||
.venv/bin/pip install --upgrade pip
|
.venv/bin/pip install --upgrade pip
|
||||||
.venv/bin/pip install -r config/requirements.txt
|
.venv/bin/pip install -r config/requirements.txt
|
||||||
touch .venv/efro_venv_complete # Done last to enforce fully-built venvs.
|
touch .venv/.efro_venv_state_$(VENV_STATE) \
|
||||||
|
.venv/.efro_venv_complete # Done last to enforce fully-built venvs.
|
||||||
@$(PCOMMAND) echo \
|
@$(PCOMMAND) echo \
|
||||||
GRN Project virtual environment for BLD $(VENV_PYTHON) RST GRN \
|
GRN Project virtual environment for BLD $(VENV_PYTHON) RST GRN \
|
||||||
at BLD .venv RST GRN is ready to use.
|
at BLD .venv RST GRN is ready to use.
|
||||||
|
|||||||
@ -31,7 +31,6 @@
|
|||||||
"astroid",
|
"astroid",
|
||||||
"pylint.lint",
|
"pylint.lint",
|
||||||
"pytest",
|
"pytest",
|
||||||
"pytz",
|
|
||||||
"yaml",
|
"yaml",
|
||||||
"requests",
|
"requests",
|
||||||
"typing_extensions",
|
"typing_extensions",
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
ansiwrap==0.8.4
|
|
||||||
cpplint==1.6.1
|
cpplint==1.6.1
|
||||||
dmgbuild==1.6.1
|
dmgbuild==1.6.1
|
||||||
filelock==3.13.4
|
filelock==3.13.4
|
||||||
@ -13,13 +12,11 @@ pytest==8.1.1
|
|||||||
python-daemon==3.0.1
|
python-daemon==3.0.1
|
||||||
python-lsp-black==2.0.0
|
python-lsp-black==2.0.0
|
||||||
python-lsp-server==1.11.0
|
python-lsp-server==1.11.0
|
||||||
pytz==2024.1
|
|
||||||
PyYAML==6.0.1
|
PyYAML==6.0.1
|
||||||
requests==2.31.0
|
requests==2.31.0
|
||||||
Sphinx==7.3.7
|
Sphinx==7.3.7
|
||||||
types-certifi==2021.10.8.3
|
types-certifi==2021.10.8.3
|
||||||
types-filelock==3.2.7
|
types-filelock==3.2.7
|
||||||
types-pytz==2024.1.0.20240417
|
|
||||||
types-PyYAML==6.0.12.20240311
|
types-PyYAML==6.0.12.20240311
|
||||||
types-requests==2.31.0.20240406
|
types-requests==2.31.0.20240406
|
||||||
typing_extensions==4.11.0
|
typing_extensions==4.11.0
|
||||||
|
|||||||
@ -12,16 +12,6 @@ import functools
|
|||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import TYPE_CHECKING, cast, TypeVar, Generic
|
from typing import TYPE_CHECKING, cast, TypeVar, Generic
|
||||||
|
|
||||||
_pytz_utc: Any
|
|
||||||
|
|
||||||
# We don't *require* pytz, but we want to support it for tzinfos if available.
|
|
||||||
try:
|
|
||||||
import pytz
|
|
||||||
|
|
||||||
_pytz_utc = pytz.utc
|
|
||||||
except ModuleNotFoundError:
|
|
||||||
_pytz_utc = None # pylint: disable=invalid-name
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
import asyncio
|
import asyncio
|
||||||
from efro.call import Call as Call # 'as Call' so we re-export.
|
from efro.call import Call as Call # 'as Call' so we re-export.
|
||||||
@ -112,12 +102,9 @@ def enum_by_value(cls: type[EnumT], value: Any) -> EnumT:
|
|||||||
|
|
||||||
def check_utc(value: datetime.datetime) -> None:
|
def check_utc(value: datetime.datetime) -> None:
|
||||||
"""Ensure a datetime value is timezone-aware utc."""
|
"""Ensure a datetime value is timezone-aware utc."""
|
||||||
if value.tzinfo is not datetime.timezone.utc and (
|
if value.tzinfo is not datetime.UTC:
|
||||||
_pytz_utc is None or value.tzinfo is not _pytz_utc
|
|
||||||
):
|
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
'datetime value does not have timezone set as'
|
'datetime value does not have timezone set as datetime.UTC'
|
||||||
' datetime.timezone.utc'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user