From 6b37ca0f2064a8e93250c5c7f8e3cf8cd30ecec3 Mon Sep 17 00:00:00 2001 From: Vaughn Kottler Date: Sat, 22 Jul 2023 15:24:10 -0500 Subject: [PATCH] 1.10.2 - Remove some vcorelib methods --- .github/workflows/python-package.yml | 2 +- README.md | 4 +- local/configs/package.yaml | 2 +- local/variables/package.yaml | 2 +- pyproject.toml | 2 +- vmklib/__init__.py | 4 +- vmklib/requirements.txt | 2 +- vmklib/tasks/python/__init__.py | 73 ++++++---------------------- 8 files changed, 24 insertions(+), 67 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 10b9f7c..cea1cee 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -65,7 +65,7 @@ jobs: - run: | mk python-release owner=vkottler \ - repo=vmklib version=1.10.1 + repo=vmklib version=1.10.2 if: | matrix.python-version == '3.11' && matrix.system == 'ubuntu-latest' diff --git a/README.md b/README.md index 16ee4e1..a47573e 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ ===================================== generator=datazen version=3.1.2 - hash=0c42310385e6f37f284556e25b419929 + hash=c81b547f706d9871faa71c1694b4c9a0 ===================================== --> -# vmklib ([1.10.1](https://pypi.org/project/vmklib/)) +# vmklib ([1.10.2](https://pypi.org/project/vmklib/)) [![python](https://img.shields.io/pypi/pyversions/vmklib.svg)](https://pypi.org/project/vmklib/) ![Build Status](https://github.com/vkottler/vmklib/workflows/Python%20Package/badge.svg) diff --git a/local/configs/package.yaml b/local/configs/package.yaml index 24baf30..6fc173c 100644 --- a/local/configs/package.yaml +++ b/local/configs/package.yaml @@ -5,7 +5,7 @@ description: "Simplify project workflows by standardizing use of GNU Make." entry: {{entry}} requirements: - - vcorelib>=2.3.1 + - vcorelib>=2.4.0 dev_requirements: - pytest-asyncio diff --git a/local/variables/package.yaml b/local/variables/package.yaml index 6cfe0b0..47cf070 100644 --- a/local/variables/package.yaml +++ b/local/variables/package.yaml @@ -1,5 +1,5 @@ --- major: 1 minor: 10 -patch: 1 +patch: 2 entry: mk diff --git a/pyproject.toml b/pyproject.toml index 0ced937..2ee52a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta:__legacy__" [project] name = "vmklib" -version = "1.10.1" +version = "1.10.2" description = "Simplify project workflows by standardizing use of GNU Make." readme = "README.md" requires-python = ">=3.8" diff --git a/vmklib/__init__.py b/vmklib/__init__.py index 0d6c6cc..bf971b3 100644 --- a/vmklib/__init__.py +++ b/vmklib/__init__.py @@ -1,7 +1,7 @@ # ===================================== # generator=datazen # version=3.1.2 -# hash=089d813c9238c490a893adefbd7ad945 +# hash=968ffb78bb91f14f331f14edd76f9321 # ===================================== """ @@ -10,4 +10,4 @@ DESCRIPTION = "Simplify project workflows by standardizing use of GNU Make." PKG_NAME = "vmklib" -VERSION = "1.10.1" +VERSION = "1.10.2" diff --git a/vmklib/requirements.txt b/vmklib/requirements.txt index 3388370..03cb775 100644 --- a/vmklib/requirements.txt +++ b/vmklib/requirements.txt @@ -1 +1 @@ -vcorelib>=2.3.1 +vcorelib>=2.4.0 diff --git a/vmklib/tasks/python/__init__.py b/vmklib/tasks/python/__init__.py index 93e80b6..187d2f0 100644 --- a/vmklib/tasks/python/__init__.py +++ b/vmklib/tasks/python/__init__.py @@ -2,64 +2,21 @@ Utilities for working with Python. """ -# built-in -from os import environ -from pathlib import Path -from shutil import which -from sys import executable, version_info - # third-party -from vcorelib.task.subprocess.run import is_windows +from vcorelib.python import ( + python_entry, + python_version, + venv_bin, + venv_dir, + venv_name, +) PREFIX = "python-" - - -def python_version() -> str: - """Get the version of Python to use.""" - return environ.get( - "PYTHON_VERSION", f"{version_info[0]}.{version_info[1]}" - ) - - -def python_entry(version: str) -> str: - """Attempt to get a Python entry-point as a string.""" - - result = None - - options = [f"python{version}{'.exe' if is_windows() else ''}"] - - # Use the current executable as a candidate if it's the right version. - if version.startswith(f"{version_info[0]}.{version_info[1]}"): - result = str(executable) - options.append(result) - - for option in options: - if which(option) is not None: - result = option - break - - assert result is not None, f"Couldn't find 'python{version}'!" - return result - - -def venv_name(version: str = None) -> str: - """Get the name for a virtual environment to use.""" - if version is None: - version = python_version() - return f"venv{version}" - - -def venv_dir(cwd: Path, version: str = None) -> Path: - """Get the path for a virtual environment to use.""" - return cwd.joinpath(venv_name(version)) - - -def venv_bin(cwd: Path, program: str = None, version: str = None) -> Path: - """Get the path to a virtual environment's script directory.""" - - path = venv_dir(cwd, version).joinpath( - "Scripts" if is_windows() else "bin" - ) - if program is not None: - path = path.joinpath(f"{program}{'.exe' if is_windows() else ''}") - return path +__all__ = [ + "PREFIX", + "python_version", + "python_entry", + "venv_name", + "venv_dir", + "venv_bin", +]