Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b15b6b7
Update `configure` to work with space in installation path
chinyeungli Feb 17, 2022
311b0a1
Remove echo statement
chinyeungli Feb 17, 2022
840ccef
Add black codestyle test for skeleton
keshav-space Feb 22, 2022
35af643
Update configure.bat
chinyeungli Feb 23, 2022
70a2d2f
Merge pull request #55 from nexB/configure_for_path_with_spaces_on_wi…
pombredanne Feb 23, 2022
c7084ee
Merge pull request #56 from keshav-space/main
pombredanne Feb 23, 2022
9558c0c
Deprecate windows-2016 images for azure CI
AyanSinhaMahapatra Feb 23, 2022
e19a520
Remove macos 10.14 job from azure-pipelines.yml
JonoYang Mar 1, 2022
cb17d70
Merge pull request #57 from nexB/deprecate-win-2016-ci
JonoYang Mar 1, 2022
7eb4ca8
Merge pull request #58 from nexB/remove-mac-1014
JonoYang Mar 1, 2022
47da14b
Do not use Python 3.6 on Windows 2022 jobs
JonoYang Mar 1, 2022
c4678dc
Merge pull request #59 from nexB/win2022-py36
JonoYang Mar 1, 2022
ad17a42
Deprecate windows-2016 images for azure CI
AyanSinhaMahapatra Feb 23, 2022
cad3164
Remove macos 10.14 job from azure-pipelines.yml
JonoYang Mar 1, 2022
d659e09
Do not use Python 3.6 on Windows 2022 jobs
JonoYang Mar 1, 2022
b408c85
Merge pull request #60 from nexB/update-signoff
pombredanne Mar 4, 2022
c5251f4
Run tests on macOS 11
pombredanne Mar 4, 2022
a118fe7
Align configuration scripts on POSIX and Windows
pombredanne Mar 4, 2022
e810da3
Update README
pombredanne Mar 4, 2022
243f7cb
Refactor and streamline thirdparty utilities
pombredanne Mar 5, 2022
931f610
Cleanup whitespaces
pombredanne Mar 5, 2022
6e43a7a
Add usage instructions to README.rst
JonoYang Mar 9, 2022
ae73ce3
Merge pull request #61 from nexB/update-readme
JonoYang Mar 9, 2022
6238b83
Merge branch 'main' of https://github.com/nexB/skeleton into main
pombredanne Mar 9, 2022
b272e3b
Format code
pombredanne Mar 9, 2022
907e540
Merge pull request #62 from nexB/better-tpp-scripts
pombredanne Mar 9, 2022
1e4d3bc
Reorg setup sections
pombredanne Mar 9, 2022
03d4799
Do not depend on click. Use argparse.
pombredanne Mar 9, 2022
f0d5a29
Correct configure scripts
pombredanne Mar 9, 2022
6ed9983
Remove remnants of configure --init
pombredanne Mar 9, 2022
61c354a
Merge latest skeleton
pombredanne Mar 10, 2022
bf6bbaa
Pytyon 3.6 is not available on Windows 2022
pombredanne Mar 11, 2022
b766dd0
Merge remote-tracking branch 'skeleton/main' into main
pombredanne Mar 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,32 @@ jobs:

- 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']
job_name: macos1015_cpython
image_name: macos-10.15
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
test_suites:
all: venv/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', '3.10']
job_name: macos11_cpython
image_name: macos-11
python_versions: ['3.7', '3.8', '3.9', '3.10']
test_suites:
all: venv/bin/pytest -n 2 -vvs

- template: etc/ci/azure-win.yml
parameters:
job_name: win2016_cpython
image_name: vs2017-win2016
job_name: win2019_cpython
image_name: windows-2019
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
test_suites:
all: venv\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', '3.10']
job_name: win2022_cpython
image_name: windows-2022
python_versions: ['3.7', '3.8', '3.9', '3.10']
test_suites:
all: venv\Scripts\pytest -n 2 -vvs
115 changes: 59 additions & 56 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ set -e
# Source this script for initial configuration
# Use configure --help for details
#
# NOTE: please keep in sync with Windows script configure.bat
#
# This script will search for a virtualenv.pyz app in etc/thirdparty/virtualenv.pyz
# Otherwise it will download the latest from the VIRTUALENV_PYZ_URL default
################################
Expand All @@ -32,10 +34,8 @@ DEV_REQUIREMENTS="--editable .[testing] --constraint requirements.txt --constrai
# where we create a virtualenv
VIRTUALENV_DIR=venv

# Cleanable files and directories with the --clean option
CLEANABLE="
build
venv"
# Cleanable files and directories to delete with the --clean option
CLEANABLE="build venv"

# extra arguments passed to pip
PIP_EXTRA_ARGS=" "
Expand All @@ -50,11 +50,14 @@ VIRTUALENV_PYZ_URL=https://bootstrap.pypa.io/virtualenv.pyz
CFG_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CFG_BIN_DIR=$CFG_ROOT_DIR/$VIRTUALENV_DIR/bin


################################
# Thirdparty package locations and index handling
# Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
if [ -f "$CFG_ROOT_DIR/thirdparty" ]; then
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty "
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty"
fi
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS --find-links https://thirdparty.aboutcode.org/pypi"
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS --find-links https://thirdparty.aboutcode.org/pypi/simple/links.html"


################################
Expand All @@ -65,56 +68,22 @@ fi


################################
# find a proper Python to run
# Find a proper Python to run
# Use environment variables or a file if available.
# Otherwise the latest Python by default.
if [[ "$PYTHON_EXECUTABLE" == "" ]]; then
# check for a file named PYTHON_EXECUTABLE
if [ -f "$CFG_ROOT_DIR/PYTHON_EXECUTABLE" ]; then
PYTHON_EXECUTABLE=$(cat "$CFG_ROOT_DIR/PYTHON_EXECUTABLE")
else
PYTHON_EXECUTABLE=python3
find_python() {
if [[ "$PYTHON_EXECUTABLE" == "" ]]; then
# check for a file named PYTHON_EXECUTABLE
if [ -f "$CFG_ROOT_DIR/PYTHON_EXECUTABLE" ]; then
PYTHON_EXECUTABLE=$(cat "$CFG_ROOT_DIR/PYTHON_EXECUTABLE")
else
PYTHON_EXECUTABLE=python3
fi
fi
fi


################################
cli_help() {
echo An initial configuration script
echo " usage: ./configure [options]"
echo
echo The default is to configure for regular use. Use --dev for development.
echo Use the --init option if starting a new project and the project
echo dependencies are not available on thirdparty.aboutcode.org/pypi/
echo and requirements.txt and/or requirements-dev.txt has not been generated.
echo
echo The options are:
echo " --clean: clean built and installed files and exit."
echo " --dev: configure the environment for development."
echo " --init: pull dependencies from PyPI. Used when first setting up a project."
echo " --help: display this help message and exit."
echo
echo By default, the python interpreter version found in the path is used.
echo Alternatively, the PYTHON_EXECUTABLE environment variable can be set to
echo configure another Python executable interpreter to use. If this is not
echo set, a file named PYTHON_EXECUTABLE containing a single line with the
echo path of the Python executable to use will be checked last.
set +e
exit
}


clean() {
# Remove cleanable file and directories and files from the root dir.
echo "* Cleaning ..."
for cln in $CLEANABLE;
do rm -rf "${CFG_ROOT_DIR:?}/${cln:?}";
done
set +e
exit
}


################################
create_virtualenv() {
# create a virtualenv for Python
# Note: we do not use the bundled Python 3 "venv" because its behavior and
Expand Down Expand Up @@ -145,6 +114,7 @@ create_virtualenv() {
}


################################
install_packages() {
# install requirements in virtualenv
# note: --no-build-isolation means that pip/wheel/setuptools will not
Expand All @@ -161,29 +131,62 @@ install_packages() {
}


################################
cli_help() {
echo An initial configuration script
echo " usage: ./configure [options]"
echo
echo The default is to configure for regular use. Use --dev for development.
echo
echo The options are:
echo " --clean: clean built and installed files and exit."
echo " --dev: configure the environment for development."
echo " --help: display this help message and exit."
echo
echo By default, the python interpreter version found in the path is used.
echo Alternatively, the PYTHON_EXECUTABLE environment variable can be set to
echo configure another Python executable interpreter to use. If this is not
echo set, a file named PYTHON_EXECUTABLE containing a single line with the
echo path of the Python executable to use will be checked last.
set +e
exit
}


################################
clean() {
# Remove cleanable file and directories and files from the root dir.
echo "* Cleaning ..."
for cln in $CLEANABLE;
do rm -rf "${CFG_ROOT_DIR:?}/${cln:?}";
done
set +e
exit
}


################################
# Main command line entry point
CFG_DEV_MODE=0
CFG_REQUIREMENTS=$REQUIREMENTS
NO_INDEX="--no-index"

# We are using getopts to parse option arguments that start with "-"
while getopts :-: optchar; do
case "${optchar}" in
-)
case "${OPTARG}" in
help ) cli_help;;
clean ) clean;;
dev ) CFG_REQUIREMENTS="$DEV_REQUIREMENTS" && CFG_DEV_MODE=1;;
init ) NO_INDEX="";;
clean ) find_python && clean;;
dev ) CFG_REQUIREMENTS="$DEV_REQUIREMENTS";;
esac;;
esac
done

PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS $NO_INDEX"
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS"

find_python
create_virtualenv "$VIRTUALENV_DIR"
install_packages "$CFG_REQUIREMENTS"
. "$CFG_BIN_DIR/activate"


set +e
52 changes: 25 additions & 27 deletions configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
@rem # Source this script for initial configuration
@rem # Use configure --help for details

@rem # NOTE: please keep in sync with POSIX script configure

@rem # This script will search for a virtualenv.pyz app in etc\thirdparty\virtualenv.pyz
@rem # Otherwise it will download the latest from the VIRTUALENV_PYZ_URL default
@rem ################################
Expand Down Expand Up @@ -49,12 +51,11 @@ set "CFG_BIN_DIR=%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts"

@rem ################################
@rem # Thirdparty package locations and index handling
if exist ""%CFG_ROOT_DIR%\thirdparty"" (
set "PIP_EXTRA_ARGS=--find-links %CFG_ROOT_DIR%\thirdparty "
@rem # Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
if exist "%CFG_ROOT_DIR%\thirdparty" (
set PIP_EXTRA_ARGS=--find-links "%CFG_ROOT_DIR%\thirdparty"
)

set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% --find-links https://thirdparty.aboutcode.org/pypi" & %INDEX_ARG%
@rem ################################
set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% --find-links https://thirdparty.aboutcode.org/pypi/simple/links.html"


@rem ################################
Expand All @@ -66,7 +67,6 @@ if not defined CFG_QUIET (

@rem ################################
@rem # Main command line entry point
set CFG_DEV_MODE=0
set "CFG_REQUIREMENTS=%REQUIREMENTS%"
set "NO_INDEX=--no-index"

Expand All @@ -76,53 +76,51 @@ if not "%1" == "" (
if "%1" EQU "--clean" (goto clean)
if "%1" EQU "--dev" (
set "CFG_REQUIREMENTS=%DEV_REQUIREMENTS%"
set CFG_DEV_MODE=1
)
if "%1" EQU "--init" (
set "NO_INDEX= "
)
shift
goto again
)

set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% %NO_INDEX%"
set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS%"


@rem ################################
@rem # find a proper Python to run
@rem # Find a proper Python to run
@rem # Use environment variables or a file if available.
@rem # Otherwise the latest Python by default.
if not defined PYTHON_EXECUTABLE (
@rem # check for a file named PYTHON_EXECUTABLE
if exist ""%CFG_ROOT_DIR%\PYTHON_EXECUTABLE"" (
set /p PYTHON_EXECUTABLE=<""%CFG_ROOT_DIR%\PYTHON_EXECUTABLE""
if exist "%CFG_ROOT_DIR%\PYTHON_EXECUTABLE" (
set /p PYTHON_EXECUTABLE=<"%CFG_ROOT_DIR%\PYTHON_EXECUTABLE"
) else (
set "PYTHON_EXECUTABLE=py"
)
)


@rem ################################
:create_virtualenv
@rem # create a virtualenv for Python
@rem # Note: we do not use the bundled Python 3 "venv" because its behavior and
@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%
mkdir "%CFG_BIN_DIR%"
)

if exist ""%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz"" (
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%
"%CFG_ROOT_DIR%\%VIRTUALENV_DIR%"
) else (
if not exist ""%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz"" (
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 (
Expand All @@ -136,7 +134,7 @@ if not exist ""%CFG_BIN_DIR%\python.exe"" (
--no-periodic-update ^
--no-vcs-ignore ^
%CFG_QUIET% ^
%CFG_ROOT_DIR%\%VIRTUALENV_DIR%
"%CFG_ROOT_DIR%\%VIRTUALENV_DIR%"
)
)

Expand All @@ -145,25 +143,29 @@ if %ERRORLEVEL% neq 0 (
)


@rem ################################
:install_packages
@rem # install requirements in virtualenv
@rem # note: --no-build-isolation means that pip/wheel/setuptools will not
@rem # be reinstalled a second time and reused from the virtualenv and this
@rem # speeds up the installation.
@rem # We always have the PEP517 build dependencies installed already.

%CFG_BIN_DIR%\pip install ^
"%CFG_BIN_DIR%\pip" install ^
--upgrade ^
--no-build-isolation ^
%CFG_QUIET% ^
%PIP_EXTRA_ARGS% ^
%CFG_REQUIREMENTS%


@rem ################################
:create_bin_junction
@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
mklink /J "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin" "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts"

if %ERRORLEVEL% neq 0 (
exit /b %ERRORLEVEL%
Expand All @@ -173,20 +175,15 @@ exit /b 0


@rem ################################

:cli_help
echo An initial configuration script
echo " usage: configure [options]"
echo " "
echo The default is to configure for regular use. Use --dev for development.
echo Use the --init option if starting a new project and the project
echo dependencies are not available on thirdparty.aboutcode.org/pypi/
echo and requirements.txt and/or requirements-dev.txt has not been generated.
echo " "
echo The options are:
echo " --clean: clean built and installed files and exit."
echo " --dev: configure the environment for development."
echo " --init: pull dependencies from PyPI. Used when first setting up a project."
echo " --help: display this help message and exit."
echo " "
echo By default, the python interpreter version found in the path is used.
Expand All @@ -197,6 +194,7 @@ exit /b 0
exit /b 0


@rem ################################
:clean
@rem # Remove cleanable file and directories and files from the root dir.
echo "* Cleaning ..."
Expand Down
Loading