-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add activation, installation, and cleanup scripts for virtual e…
…nvironment management
- Loading branch information
Showing
13 changed files
with
226 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Copyright (c) 2020-202x The virtualenv developers | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining | ||
# a copy of this software and associated documentation files (the | ||
# "Software"), to deal in the Software without restriction, including | ||
# without limitation the rights to use, copy, modify, merge, publish, | ||
# distribute, sublicense, and/or sell copies of the Software, and to | ||
# permit persons to whom the Software is furnished to do so, subject to | ||
# the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be | ||
# included in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
# This file must be used with "source bin/activate" *from bash* | ||
# you cannot run it directly | ||
|
||
# Get script path (only used if environment is relocatable). | ||
if [ -n "${BASH_VERSION:+x}" ] ; then | ||
SCRIPT_PATH="${BASH_SOURCE[0]}" | ||
if [ "$SCRIPT_PATH" = "$0" ]; then | ||
# Only bash has a reasonably robust check for source'dness. | ||
echo "You must source this script: \$ source $0" >&2 | ||
exit 33 | ||
fi | ||
elif [ -n "${ZSH_VERSION:+x}" ] ; then | ||
SCRIPT_PATH="${(%):-%x}" | ||
elif [ -n "${KSH_VERSION:+x}" ] ; then | ||
SCRIPT_PATH="${.sh.file}" | ||
fi | ||
|
||
deactivate () { | ||
unset -f pydoc >/dev/null 2>&1 || true | ||
|
||
# reset old environment variables | ||
# ! [ -z ${VAR+_} ] returns true if VAR is declared at all | ||
if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then | ||
PATH="$_OLD_VIRTUAL_PATH" | ||
export PATH | ||
unset _OLD_VIRTUAL_PATH | ||
fi | ||
if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then | ||
PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME" | ||
export PYTHONHOME | ||
unset _OLD_VIRTUAL_PYTHONHOME | ||
fi | ||
|
||
# The hash command must be called to get it to forget past | ||
# commands. Without forgetting past commands the $PATH changes | ||
# we made may not be respected | ||
hash -r 2>/dev/null | ||
|
||
if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then | ||
PS1="$_OLD_VIRTUAL_PS1" | ||
export PS1 | ||
unset _OLD_VIRTUAL_PS1 | ||
fi | ||
|
||
unset VIRTUAL_ENV | ||
unset VIRTUAL_ENV_PROMPT | ||
if [ ! "${1-}" = "nondestructive" ] ; then | ||
# Self destruct! | ||
unset -f deactivate | ||
fi | ||
} | ||
|
||
# unset irrelevant variables | ||
deactivate nondestructive | ||
|
||
VIRTUAL_ENV='C:\Users\niteris\dev\static-ffmpeg\.venv' | ||
if ([ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]) && $(command -v cygpath &> /dev/null) ; then | ||
VIRTUAL_ENV=$(cygpath -u "$VIRTUAL_ENV") | ||
fi | ||
export VIRTUAL_ENV | ||
|
||
_OLD_VIRTUAL_PATH="$PATH" | ||
PATH="$VIRTUAL_ENV/Scripts:$PATH" | ||
export PATH | ||
|
||
if [ "xstatic-ffmpeg" != x ] ; then | ||
VIRTUAL_ENV_PROMPT="(static-ffmpeg) " | ||
else | ||
VIRTUAL_ENV_PROMPT="($(basename "$VIRTUAL_ENV")) " | ||
fi | ||
export VIRTUAL_ENV_PROMPT | ||
|
||
# unset PYTHONHOME if set | ||
if ! [ -z "${PYTHONHOME+_}" ] ; then | ||
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME" | ||
unset PYTHONHOME | ||
fi | ||
|
||
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then | ||
_OLD_VIRTUAL_PS1="${PS1-}" | ||
PS1="${VIRTUAL_ENV_PROMPT}${PS1-}" | ||
export PS1 | ||
fi | ||
|
||
# Make sure to unalias pydoc if it's already there | ||
alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true | ||
|
||
pydoc () { | ||
python -m pydoc "$@" | ||
} | ||
|
||
# The hash command must be called to get it to forget past | ||
# commands. Without forgetting past commands the $PATH changes | ||
# we made may not be respected | ||
hash -r 2>/dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
set -x | ||
rm -rf .tox | ||
rm -rf build | ||
rm -rf dist | ||
rm -rf venv | ||
rm -rf .venv | ||
rm -rf .env_* | ||
# remove all *.pyc files | ||
find . -name "*.pyc" -exec rm -rf {} \; | ||
# remove all *.egg files | ||
find . -name "*.egg" -exec rm -rf {} \; | ||
rm -rf build | ||
rm -rf dist | ||
rm -rf *.egg-info | ||
rm -rf .eggs | ||
rm -rf .tox | ||
rm -rf .cache | ||
rm -rf .pytest_cache | ||
rm -rf .mypy_cache | ||
rm -rf .coverage | ||
rm -rf .iso_env |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -e | ||
uv venv --python 3.11 | ||
uv pip install -r requirements.testing.txt | ||
uv pip install . | ||
# This is needed to force the installation to finalize. | ||
uv run python -c "import os; _ = os.getcwd()" | ||
set +e | ||
|
||
# if ./activate exists, remove it | ||
if [ -f activate ]; then | ||
rm activate | ||
fi | ||
# symlink activate to .venv/bin/activate on linux/mac and .venv/Scripts/activate on windows | ||
if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then | ||
ln -s .venv/bin/activate activate | ||
else | ||
ln -s .venv/Scripts/activate activate | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo Running ruff static_ffmpeg | ||
uv run ruff check --fix static_ffmpeg | ||
echo Running ruff tests | ||
uv run ruff check --fix tests | ||
echo Running black static_ffmpeg tests | ||
uv run black static_ffmpeg tests | ||
echo Running isort static_ffmpeg tests | ||
uv run isort --profile black static_ffmpeg tests | ||
echo Running flake8 static_ffmpeg tests | ||
uv run flake8 static_ffmpeg tests | ||
echo Running mypy static_ffmpeg | ||
uv run mypy static_ffmpeg tests | ||
echo Linting complete! | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
flake8 | ||
mypy | ||
pylint | ||
pytest | ||
pytest | ||
ruff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
requests | ||
filelock | ||
progress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
""" | ||
|
||
from ._add_paths import add_paths | ||
|
||
__all__ = ["add_paths"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
echo "Running unittests" | ||
uv run pytest tests -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters