Skip to content

Commit

Permalink
Fixed #27 and Fixed #28 - Update configuration scripts
Browse files Browse the repository at this point in the history
 - configuration scripts will now check if wget/curl is installed
 - no longer using tmp as the virtualenv

Signed-off-by: Chin Yeung Li <[email protected]>
  • Loading branch information
chinyeungli committed Jul 2, 2021
1 parent b735a3f commit becea40
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 42 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/share/
/tcl/
/.eggs/
/etc/thirdparty/

# Installer logs
pip-log.txt
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ python:
install: ./configure --dev

# Scripts to run at script stage
script: tmp/bin/pytest
script: bin/pytest
14 changes: 7 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,52 +13,52 @@ jobs:
image_name: ubuntu-16.04
python_versions: ['3.6', '3.7', '3.8', '3.9']
test_suites:
all: tmp/bin/pytest -vvs
all: bin/pytest -vvs

- template: etc/ci/azure-posix.yml
parameters:
job_name: ubuntu18_cpython
image_name: ubuntu-18.04
python_versions: ['3.6', '3.7', '3.8', '3.9']
test_suites:
all: tmp/bin/pytest -n 2 -vvs
all: bin/pytest -n 2 -vvs

- template: etc/ci/azure-posix.yml
parameters:
job_name: ubuntu20_cpython
image_name: ubuntu-20.04
python_versions: ['3.6', '3.7', '3.8', '3.9']
test_suites:
all: tmp/bin/pytest -n 2 -vvs
all: bin/pytest -n 2 -vvs

- template: etc/ci/azure-posix.yml
parameters:
job_name: macos1014_cpython
image_name: macos-10.14
python_versions: ['3.6', '3.7', '3.8', '3.9']
test_suites:
all: tmp/bin/pytest -n 2 -vvs
all: bin/pytest -n 2 -vvs

- template: etc/ci/azure-posix.yml
parameters:
job_name: macos1015_cpython
image_name: macos-10.15
python_versions: ['3.6', '3.7', '3.8', '3.9']
test_suites:
all: tmp/bin/pytest -n 2 -vvs
all: bin/pytest -n 2 -vvs

- template: etc/ci/azure-win.yml
parameters:
job_name: win2016_cpython
image_name: vs2017-win2016
python_versions: ['3.6', '3.7', '3.8', '3.9']
test_suites:
all: tmp\Scripts\pytest -n 2 -vvs
all: Scripts\pytest -n 2 -vvs

- template: etc/ci/azure-win.yml
parameters:
job_name: win2019_cpython
image_name: windows-2019
python_versions: ['3.6', '3.7', '3.8', '3.9']
test_suites:
all: tmp\Scripts\pytest -n 2 -vvs
all: Scripts\pytest -n 2 -vvs
25 changes: 17 additions & 8 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@ REQUIREMENTS="--editable ."
DEV_REQUIREMENTS="--editable .[testing]"

# where we create a virtualenv
VIRTUALENV_DIR=tmp
VIRTUALENV_DIR=.

# Cleanable files and directories with the --clean option
CLEANABLE="
build
tmp"
tmp
bin
Lib
Scripts
pyvenv.cfg
etc/thirdparty/virtualenv.pyz"

# extra arguments passed to pip
PIP_EXTRA_ARGS=" "
Expand Down Expand Up @@ -115,12 +120,16 @@ create_virtualenv() {
if [ ! -f "$CFG_BIN_DIR/python" ]; then

mkdir -p "$CFG_ROOT_DIR/$VENV_DIR"

if [ -f "$CFG_ROOT_DIR/etc/thirdparty/virtualenv.pyz" ]; then
VIRTUALENV_PYZ="$CFG_ROOT_DIR/etc/thirdparty/virtualenv.pyz"
else
VIRTUALENV_PYZ="$CFG_ROOT_DIR/$VENV_DIR/virtualenv.pyz"
wget -O "$VIRTUALENV_PYZ" "$VIRTUALENV_PYZ_URL"
VIRTUALENV_PYZ="$CFG_ROOT_DIR/etc/thirdparty/virtualenv.pyz"

if [ ! -f VIRTUALENV_PYZ ]; then
if [ -x "$(which wget)" ] ; then
wget -O "$VIRTUALENV_PYZ" "$VIRTUALENV_PYZ_URL"
elif [ -x "$(which curl)" ]; then
curl -o "$VIRTUALENV_PYZ" "$VIRTUALENV_PYZ_URL"
else
echo "Could not find curl or wget, please install one." >&2
fi
fi

$PYTHON_EXECUTABLE "$VIRTUALENV_PYZ" \
Expand Down
58 changes: 32 additions & 26 deletions configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ set "REQUIREMENTS=--editable ."
set "DEV_REQUIREMENTS=--editable .[testing]"

@rem # where we create a virtualenv
set "VIRTUALENV_DIR=tmp"
set "VIRTUALENV_DIR=."

@rem # Cleanable files and directories to delete with the --clean option
set "CLEANABLE=build tmp"
set "CLEANABLE=build tmp bin Lib Scripts pyvenv.cfg etc\thirdparty\virtualenv.pyz"

@rem # extra arguments passed to pip
set "PIP_EXTRA_ARGS= "
Expand Down Expand Up @@ -90,37 +90,39 @@ if not defined PYTHON_EXECUTABLE (
@rem # presence is not consistent across Linux distro and sometimes pip is not
@rem # included either by default. The virtualenv.pyz app cures all these issues.

if not exist ""%CFG_BIN_DIR%\python.exe"" (
if not exist "%CFG_BIN_DIR%\python.exe" (
if not exist "%CFG_BIN_DIR%" (
mkdir %CFG_BIN_DIR%
)

if exist ""%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz"" (
%PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" ^
--wheel embed --pip embed --setuptools embed ^
--seeder pip ^
--never-download ^
--no-periodic-update ^
--no-vcs-ignore ^
%CFG_QUIET% ^
%CFG_ROOT_DIR%\%VIRTUALENV_DIR%
) else (
if not exist ""%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz"" (
curl -o "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz" %VIRTUALENV_PYZ_URL%

if %ERRORLEVEL% neq 0 (
exit /b %ERRORLEVEL%
if not exist "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" (
@rem # Check if curl or wget is installed
where curl >nul 2>nul
if %ERRORLEVEL% == 0 (
curl -o "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" %VIRTUALENV_PYZ_URL%
) else (
where wget >nul 2>nul
if %ERRORLEVEL% == 0 (
wget -O "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" %VIRTUALENV_PYZ_URL%
) else (
echo "Please download and install curl or wget."
exit /b
)
)
%PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz" ^
--wheel embed --pip embed --setuptools embed ^
--seeder pip ^
--never-download ^
--no-periodic-update ^
--no-vcs-ignore ^
%CFG_QUIET% ^
%CFG_ROOT_DIR%\%VIRTUALENV_DIR%

if %ERRORLEVEL% neq 0 (
exit /b %ERRORLEVEL%
)
)

%PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" ^
--wheel embed --pip embed --setuptools embed ^
--seeder pip ^
--never-download ^
--no-periodic-update ^
--no-vcs-ignore ^
%CFG_QUIET% ^
%CFG_ROOT_DIR%\%VIRTUALENV_DIR%
)

if %ERRORLEVEL% neq 0 (
Expand All @@ -142,7 +144,11 @@ if %ERRORLEVEL% neq 0 (
%PIP_EXTRA_ARGS% ^
%CFG_REQUIREMENTS%


@rem # Create junction to bin to have the same directory between linux and windows
if exist ""%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin"" (
rmdir /s /q "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin"
)
mklink /J %CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin %CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts

if %ERRORLEVEL% neq 0 (
Expand Down

0 comments on commit becea40

Please sign in to comment.