Skip to content

Commit

Permalink
Reduce noise
Browse files Browse the repository at this point in the history
  • Loading branch information
rnixx committed Feb 27, 2024
1 parent 20333b1 commit 915f945
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 64 deletions.
23 changes: 8 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ PYTHON_MIN_VERSION?=3.7

# Install packages using the given package installer method.
# Supported are `pip` and `uv`. If uv is used, its global availability is
# checked. Otherwise, is is installed, either in the virtual environment or
# checked. Otherwise, it is installed, either in the virtual environment or
# using the `PRIMARY_PYTHON`, dependent on the `VENV_ENABLED` setting. If
# `VENV_ENABLED` and uv is selected, uv is used to create the virtual
# environment.
Expand Down Expand Up @@ -213,7 +213,7 @@ ifeq ($(shell [[ "$(VENV_ENABLED)" == "true" && "$(VENV_FOLDER)" == "" ]] && ech
$(error "VENV_FOLDER must be configured if VENV_ENABLED is true")
endif

# determine the executable path
# Determine the executable path
ifeq ("$(VENV_ENABLED)", "true")
export PATH:=$(shell pwd)/$(VENV_FOLDER)/bin:$(PATH)
export VIRTUAL_ENV=$(VENV_FOLDER)
Expand All @@ -222,41 +222,34 @@ else
MXENV_PYTHON=$(PRIMARY_PYTHON)
endif

# determine the package installer
# Determine the package installer
ifeq ("$(PYTHON_PACKAGE_INSTALLER)","uv")
# use uv
PYTHON_PACKAGE_COMMAND=uv pip
else
# use/default to pip
PYTHON_PACKAGE_COMMAND=$(MXENV_PYTHON) -m pip
endif # /PYTHON_PACKAGE_INSTALLER
endif

MXENV_TARGET:=$(SENTINEL_FOLDER)/mxenv.sentinel
$(MXENV_TARGET): $(SENTINEL)
ifeq ("$(VENV_ENABLED)", "true")
# Use a venv
ifeq ("$(VENV_CREATE)", "true")
# Create a venv
ifeq ("$(PYTHON_PACKAGE_INSTALLER)$(PYTHON_UV_GLOBAL)", "uvtrue")
# create venv with global uv
@echo "Setup Python Virtual Environment using package 'uv' at '$(VENV_FOLDER)'"
@uv venv -p $(PRIMARY_PYTHON) --seed $(VENV_FOLDER)
else
@echo "Setup Python Virtual Environment using module 'venv' at '$(VENV_FOLDER)'"
@$(MXENV_PYTHON) -m venv $(VENV_FOLDER)
@$(MXENV_PYTHON) -m ensurepip -U
endif # /PYTHON_PACKAGE_INSTALLER uv and PYTHON_UV_GLOBAL

endif
ifeq ("$(PYTHON_PACKAGE_INSTALLER)$(PYTHON_UV_GLOBAL)", "uvfalse")
@echo "Install uv"
@$(MXENV_PYTHON) -m pip install uv
endif # /PYTHON_PACKAGE_INSTALLER uv and not PYTHON_UV_GLOBAL
# always update pip, setuptools and wheel
endif
@$(PYTHON_PACKAGE_COMMAND) install -U pip setuptools wheel
endif # /VENV_CREATE
endif
else
@echo "Using system Python interpreter"
endif # /VENV_ENABLED
endif
@echo "Install/Update MXStack Python packages"
@$(PYTHON_PACKAGE_COMMAND) install -U $(MXDEV) $(MXMAKE)
@touch $(MXENV_TARGET)
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ It targets the development environments for Python packages but may be used outs

The detailed `mxmake` documentation is available [mxstack.github.io/mxmake](https://mxstack.github.io/mxmake).


# Copyright

- Copyright (c) 2022-2024 mxstack Contributors
Expand Down
48 changes: 21 additions & 27 deletions src/mxmake/tests/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ def test_Makefile(self, tempdir):
# Install packages using the given package installer method.
# Supported are `pip` and `uv`. If uv is used, its global availability is
# checked. Otherwise, is is installed, either in the virtual environment or
# checked. Otherwise, it is installed, either in the virtual environment or
# using the `PRIMARY_PYTHON`, dependent on the `VENV_ENABLED` setting. If
# `VENV_ENABLED` and uv is selected, uv is used to create the virtual
# environment.
Expand Down Expand Up @@ -681,7 +681,7 @@ def test_Makefile(self, tempdir):
$(error "VENV_FOLDER must be configured if VENV_ENABLED is true")
endif
# determine the executable path
# Determine the executable path
ifeq ("$(VENV_ENABLED)", "true")
export PATH:=$(shell pwd)/$(VENV_FOLDER)/bin:$(PATH)
export VIRTUAL_ENV=$(VENV_FOLDER)
Expand All @@ -690,44 +690,38 @@ def test_Makefile(self, tempdir):
MXENV_PYTHON=$(PRIMARY_PYTHON)
endif
# determine the package installer
# Determine the package installer
ifeq ("$(PYTHON_PACKAGE_INSTALLER)","uv")
# use uv
PYTHON_PACKAGE_COMMAND=uv pip
else
# use/default to pip
PYTHON_PACKAGE_COMMAND=$(MXENV_PYTHON) -m pip
endif # /PYTHON_PACKAGE_INSTALLER
endif
MXENV_TARGET:=$(SENTINEL_FOLDER)/mxenv.sentinel
$(MXENV_TARGET): $(SENTINEL)
ifeq ("$(VENV_ENABLED)", "true")
# Use a venv
ifeq ("$(VENV_CREATE)", "true")
# Create a venv
ifeq ("$(PYTHON_PACKAGE_INSTALLER)$(PYTHON_UV_GLOBAL)", "uvtrue")
# create venv with global uv
@echo "Setup Python Virtual Environment using package 'uv' at '$(VENV_FOLDER)'"
@uv venv -p $(PRIMARY_PYTHON) --seed $(VENV_FOLDER)
@echo "Setup Python Virtual Environment using package 'uv' at '$(VENV_FOLDER)'"
@uv venv -p $(PRIMARY_PYTHON) --seed $(VENV_FOLDER)
else
@echo "Setup Python Virtual Environment using module 'venv' at '$(VENV_FOLDER)'"
@$(MXENV_PYTHON) -m venv $(VENV_FOLDER)
@$(MXENV_PYTHON) -m ensurepip -U
endif # /PYTHON_PACKAGE_INSTALLER uv and PYTHON_UV_GLOBAL
@echo "Setup Python Virtual Environment using module 'venv' at '$(VENV_FOLDER)'"
@$(MXENV_PYTHON) -m venv $(VENV_FOLDER)
@$(MXENV_PYTHON) -m ensurepip -U
endif
ifeq ("$(PYTHON_PACKAGE_INSTALLER)$(PYTHON_UV_GLOBAL)", "uvfalse")
@echo "Install uv"
@$(MXENV_PYTHON) -m pip install uv
endif # /PYTHON_PACKAGE_INSTALLER uv and not PYTHON_UV_GLOBAL
# always update pip, setuptools and wheel
@$(PYTHON_PACKAGE_COMMAND) install -U pip setuptools wheel
endif # /VENV_CREATE
@echo "Install uv"
@$(MXENV_PYTHON) -m pip install uv
endif
@$(PYTHON_PACKAGE_COMMAND) install -U pip setuptools wheel
endif
else
@echo "Using system Python interpreter"
endif # /VENV_ENABLED
@echo "Install/Update MXStack Python packages"
@$(PYTHON_PACKAGE_COMMAND) install -U $(MXDEV) $(MXMAKE)
@touch $(MXENV_TARGET)
@echo "Using system Python interpreter"
endif
@echo "Install/Update MXStack Python packages"
@$(PYTHON_PACKAGE_COMMAND) install -U $(MXDEV) $(MXMAKE)
@touch $(MXENV_TARGET)
.PHONY: mxenv
mxenv: $(MXENV_TARGET)
Expand Down
34 changes: 13 additions & 21 deletions src/mxmake/topics/core/mxenv.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,18 @@
#:
#:[setting.PYTHON_PACKAGE_INSTALLER]
#:description = Install packages using the given package installer method.
#: Supported are `pip` and `uv`. If uv is used, its global availability is
#: checked. Otherwise, is is installed, either in the virtual environment or
#: using the `PRIMARY_PYTHON`, dependent on the `VENV_ENABLED` setting. If
#: `VENV_ENABLED` and uv is selected, uv is used to create the virtual
#: environment.
#: Supported are `pip` and `uv`. If uv is used, its global availability is
#: checked. Otherwise, it is installed, either in the virtual environment or
#: using the `PRIMARY_PYTHON`, dependent on the `VENV_ENABLED` setting. If
#: `VENV_ENABLED` and uv is selected, uv is used to create the virtual
#: environment.
#:default = pip
#:
#:[setting.PYTHON_UV_GLOBAL]
#:description = Flag whether to use a global installed 'uv' or install
#: it in the virtual environment.
#: it in the virtual environment.
#:default = false
#:
#:
#:[setting.VENV_ENABLED]
#:description = Flag whether to use virtual environment. If `false`, the
#: interpreter according to `PRIMARY_PYTHON` found in `PATH` is used.
Expand Down Expand Up @@ -92,7 +91,7 @@ ifeq ($(shell [[ "$(VENV_ENABLED)" == "true" && "$(VENV_FOLDER)" == "" ]] && ech
$(error "VENV_FOLDER must be configured if VENV_ENABLED is true")
endif

# determine the executable path
# Determine the executable path
ifeq ("$(VENV_ENABLED)", "true")
export PATH:=$(shell pwd)/$(VENV_FOLDER)/bin:$(PATH)
export VIRTUAL_ENV=$(VENV_FOLDER)
Expand All @@ -101,41 +100,34 @@ else
MXENV_PYTHON=$(PRIMARY_PYTHON)
endif

# determine the package installer
# Determine the package installer
ifeq ("$(PYTHON_PACKAGE_INSTALLER)","uv")
# use uv
PYTHON_PACKAGE_COMMAND=uv pip
else
# use/default to pip
PYTHON_PACKAGE_COMMAND=$(MXENV_PYTHON) -m pip
endif # /PYTHON_PACKAGE_INSTALLER
endif

MXENV_TARGET:=$(SENTINEL_FOLDER)/mxenv.sentinel
$(MXENV_TARGET): $(SENTINEL)
ifeq ("$(VENV_ENABLED)", "true")
# Use a venv
ifeq ("$(VENV_CREATE)", "true")
# Create a venv
ifeq ("$(PYTHON_PACKAGE_INSTALLER)$(PYTHON_UV_GLOBAL)", "uvtrue")
# create venv with global uv
@echo "Setup Python Virtual Environment using package 'uv' at '$(VENV_FOLDER)'"
@uv venv -p $(PRIMARY_PYTHON) --seed $(VENV_FOLDER)
else
@echo "Setup Python Virtual Environment using module 'venv' at '$(VENV_FOLDER)'"
@$(MXENV_PYTHON) -m venv $(VENV_FOLDER)
@$(MXENV_PYTHON) -m ensurepip -U
endif # /PYTHON_PACKAGE_INSTALLER uv and PYTHON_UV_GLOBAL

endif
ifeq ("$(PYTHON_PACKAGE_INSTALLER)$(PYTHON_UV_GLOBAL)", "uvfalse")
@echo "Install uv"
@$(MXENV_PYTHON) -m pip install uv
endif # /PYTHON_PACKAGE_INSTALLER uv and not PYTHON_UV_GLOBAL
# always update pip, setuptools and wheel
endif
@$(PYTHON_PACKAGE_COMMAND) install -U pip setuptools wheel
endif # /VENV_CREATE
endif
else
@echo "Using system Python interpreter"
endif # /VENV_ENABLED
endif
@echo "Install/Update MXStack Python packages"
@$(PYTHON_PACKAGE_COMMAND) install -U $(MXDEV) $(MXMAKE)
@touch $(MXENV_TARGET)
Expand Down

0 comments on commit 915f945

Please sign in to comment.