Skip to content

Commit 653225d

Browse files
authored
Merge pull request #32 from nexB/23-support-many-click-versions
Support many click versions #23
2 parents a5218d7 + 100a762 commit 653225d

38 files changed

+5263
-46
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/Lib
1313
/pip-selfcheck.json
1414
/tmp
15+
/venv
1516
.Python
1617
/include
1718
/Include

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ python:
1919
install: ./configure --dev
2020

2121
# Scripts to run at script stage
22-
script: tmp/bin/pytest -vvs -n 2
22+
script: venv/bin/pytest -vvs -n 2

CHANGELOG.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
Release notes
22
=============
33

4+
Version 30.0.0 (2021-09-24)
5+
------------------------------
6+
7+
- Switch back from clamver to semver.
8+
- Adopt latest skeleton. The default virtualenv directory is now venv and no
9+
longer tmp
10+
- Fix issue with Click progressbar API #23 that prohibited to use all supported
11+
Click versions. Since Click is widely used that was a frequent source of
12+
installation conflicts.
13+
14+
415
Version 21.8.31
516
---------------
617

README.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ To install this package use::
1616
pip install commoncode
1717

1818

19-
2019
Alternatively, to set up a development environment::
2120

2221
source configure --dev

azure-pipelines.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,55 +12,69 @@ jobs:
1212
image_name: ubuntu-16.04
1313
python_versions: ['3.6', '3.7', '3.8', '3.9']
1414
test_suites:
15-
all: tmp/bin/pytest -vvs
15+
all: venv/bin/pytest -vvs
1616

1717
- template: etc/ci/azure-posix.yml
1818
parameters:
1919
job_name: ubuntu18_cpython
2020
image_name: ubuntu-18.04
2121
python_versions: ['3.6', '3.7', '3.8', '3.9']
2222
test_suites:
23-
all: tmp/bin/pytest -n 2 -vvs
23+
all: venv/bin/pytest -n 2 -vvs
2424

2525
- template: etc/ci/azure-posix.yml
2626
parameters:
2727
job_name: ubuntu20_cpython
2828
image_name: ubuntu-20.04
2929
python_versions: ['3.6', '3.7', '3.8', '3.9']
3030
test_suites:
31-
all: tmp/bin/pytest -n 2 -vvs
31+
all: venv/bin/pytest -n 2 -vvs
3232

3333
- template: etc/ci/azure-posix.yml
3434
parameters:
3535
job_name: macos1014_cpython
3636
image_name: macos-10.14
3737
python_versions: ['3.6', '3.7', '3.8', '3.9']
3838
test_suites:
39-
all: tmp/bin/pytest -n 2 -vvs
39+
all: venv/bin/pytest -n 2 -vvs
4040

4141
- template: etc/ci/azure-posix.yml
4242
parameters:
4343
job_name: macos1015_cpython
4444
image_name: macos-10.15
4545
python_versions: ['3.6', '3.7', '3.8', '3.9']
4646
test_suites:
47-
all: tmp/bin/pytest -n 2 -vvs
47+
all: venv/bin/pytest -n 2 -vvs
4848

4949
- template: etc/ci/azure-win.yml
5050
parameters:
5151
job_name: win2016_cpython
5252
image_name: vs2017-win2016
5353
python_versions: ['3.6', '3.7', '3.8', '3.9']
5454
test_suites:
55-
all: tmp\Scripts\pytest -n 2 -vvs
55+
all: venv\Scripts\pytest -n 2 -vvs
5656

5757
- template: etc/ci/azure-win.yml
5858
parameters:
5959
job_name: win2019_cpython
6060
image_name: windows-2019
6161
python_versions: ['3.6', '3.7', '3.8', '3.9']
6262
test_suites:
63-
all: tmp\Scripts\pytest -n 2 -vvs
63+
all: venv\Scripts\pytest -n 2 -vvs
64+
65+
66+
################################################################################
67+
# Test using many version of Click to work around regressions in API
68+
################################################################################
69+
70+
71+
- template: etc/ci/azure-posix.yml
72+
parameters:
73+
job_name: ubuntu20_test_all_supported_click_versions
74+
image_name: ubuntu-20.04
75+
python_versions: ['3.6', '3.7', '3.8', '3.9']
76+
test_suites:
77+
click_versions: for clk_ver in 8.0.1 7.1.2 7.1.1 7.1 6.7; do pip install click==$clk_ver; venv/bin/pytest -vvs tests/test_cliutils_progressbar.py; done
6478

6579

6680
################################################################################
@@ -74,20 +88,20 @@ jobs:
7488
image_name: ubuntu-20.04
7589
python_versions: ['3.6', '3.7', '3.8', '3.9']
7690
test_suites:
77-
all: tmp/bin/pip install --force-reinstall --upgrade -e . && tmp/bin/pytest -n 2 -vvs
91+
all: venv/bin/pip install --force-reinstall --upgrade -e . && venv/bin/pytest -n 2 -vvs
7892

7993
- template: etc/ci/azure-win.yml
8094
parameters:
8195
job_name: win2019_cpython_latest_from_pip
8296
image_name: windows-2019
8397
python_versions: ['3.6', '3.7', '3.8', '3.9']
8498
test_suites:
85-
all: tmp\Scripts\pip install --force-reinstall --upgrade -e . && tmp\Scripts\pytest -n 2 -vvs
99+
all: venv\Scripts\pip install --force-reinstall --upgrade -e . && venv\Scripts\pytest -n 2 -vvs
86100

87101
- template: etc/ci/azure-posix.yml
88102
parameters:
89103
job_name: macos1015_cpython_latest_from_pip
90104
image_name: macos-10.15
91105
python_versions: ['3.6', '3.7', '3.8', '3.9']
92106
test_suites:
93-
all: tmp/bin/pip install --force-reinstall --upgrade -e . && tmp/bin/pytest -n 2 -vvs
107+
all: venv/bin/pip install --force-reinstall --upgrade -e . && venv/bin/pytest -n 2 -vvs

configure

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -e
1111
#set -x
1212

1313
################################
14-
# A configuration script to set things up:
14+
# A configuration script to set things up:
1515
# create a virtualenv and install or update thirdparty packages.
1616
# Source this script for initial configuration
1717
# Use configure --help for details
@@ -27,15 +27,15 @@ CLI_ARGS=$1
2727

2828
# Requirement arguments passed to pip and used by default or with --dev.
2929
REQUIREMENTS="--editable . --constraint requirements.txt"
30-
DEV_REQUIREMENTS="--editable .[testing] --constraint requirements.txt"
30+
DEV_REQUIREMENTS="--editable .[testing] --constraint requirements.txt --constraint requirements-dev.txt"
3131

3232
# where we create a virtualenv
33-
VIRTUALENV_DIR=tmp
33+
VIRTUALENV_DIR=venv
3434

3535
# Cleanable files and directories with the --clean option
3636
CLEANABLE="
3737
build
38-
tmp"
38+
venv"
3939

4040
# extra arguments passed to pip
4141
PIP_EXTRA_ARGS=" "
@@ -50,9 +50,12 @@ VIRTUALENV_PYZ_URL=https://bootstrap.pypa.io/virtualenv.pyz
5050
CFG_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5151
CFG_BIN_DIR=$CFG_ROOT_DIR/$VIRTUALENV_DIR/bin
5252

53+
# Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
54+
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty --find-links https://thirdparty.aboutcode.org/pypi"
55+
5356

5457
################################
55-
# Set the quiet flag to empty if not defined
58+
# Set the quiet flag to empty if not defined
5659
if [[ "$CFG_QUIET" == "" ]]; then
5760
CFG_QUIET=" "
5861
fi
@@ -63,7 +66,7 @@ fi
6366
# Use environment variables or a file if available.
6467
# Otherwise the latest Python by default.
6568
if [[ "$PYTHON_EXECUTABLE" == "" ]]; then
66-
# check for a file named PYTHON_EXECUTABLE
69+
# check for a file named PYTHON_EXECUTABLE
6770
if [ -f "$CFG_ROOT_DIR/PYTHON_EXECUTABLE" ]; then
6871
PYTHON_EXECUTABLE=$(cat "$CFG_ROOT_DIR/PYTHON_EXECUTABLE")
6972
else
@@ -78,10 +81,14 @@ cli_help() {
7881
echo " usage: ./configure [options]"
7982
echo
8083
echo The default is to configure for regular use. Use --dev for development.
84+
echo Use the --init option if starting a new project and the project
85+
echo dependencies are not available on thirdparty.aboutcode.org/pypi/
86+
echo and requirements.txt and/or requirements-dev.txt has not been generated.
8187
echo
8288
echo The options are:
8389
echo " --clean: clean built and installed files and exit."
8490
echo " --dev: configure the environment for development."
91+
echo " --init: pull dependencies from PyPI. Used when first setting up a project."
8592
echo " --help: display this help message and exit."
8693
echo
8794
echo By default, the python interpreter version found in the path is used.
@@ -155,12 +162,22 @@ install_packages() {
155162
# Main command line entry point
156163
CFG_DEV_MODE=0
157164
CFG_REQUIREMENTS=$REQUIREMENTS
158-
159-
case "$CLI_ARGS" in
160-
--help) cli_help;;
161-
--clean) clean;;
162-
--dev) CFG_REQUIREMENTS="$DEV_REQUIREMENTS" && CFG_DEV_MODE=1;;
163-
esac
165+
NO_INDEX="--no-index"
166+
167+
# We are using getopts to parse option arguments that start with "-"
168+
while getopts :-: optchar; do
169+
case "${optchar}" in
170+
-)
171+
case "${OPTARG}" in
172+
help ) cli_help;;
173+
clean ) clean;;
174+
dev ) CFG_REQUIREMENTS="$DEV_REQUIREMENTS" && CFG_DEV_MODE=1;;
175+
init ) NO_INDEX="";;
176+
esac;;
177+
esac
178+
done
179+
180+
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS $NO_INDEX"
164181

165182
create_virtualenv "$VIRTUALENV_DIR"
166183
install_packages "$CFG_REQUIREMENTS"

configure.bat

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
@rem ################################
12-
@rem # A configuration script to set things up:
12+
@rem # A configuration script to set things up:
1313
@rem # create a virtualenv and install or update thirdparty packages.
1414
@rem # Source this script for initial configuration
1515
@rem # Use configure --help for details
@@ -25,13 +25,13 @@
2525

2626
@rem # Requirement arguments passed to pip and used by default or with --dev.
2727
set "REQUIREMENTS=--editable . --constraint requirements.txt"
28-
set "DEV_REQUIREMENTS=--editable .[testing] --constraint requirements.txt"
28+
set "DEV_REQUIREMENTS=--editable .[testing] --constraint requirements.txt --constraint requirements-dev.txt"
2929

3030
@rem # where we create a virtualenv
31-
set "VIRTUALENV_DIR=tmp"
31+
set "VIRTUALENV_DIR=venv"
3232

3333
@rem # Cleanable files and directories to delete with the --clean option
34-
set "CLEANABLE=build tmp"
34+
set "CLEANABLE=build venv"
3535

3636
@rem # extra arguments passed to pip
3737
set "PIP_EXTRA_ARGS= "
@@ -48,7 +48,13 @@ set "CFG_BIN_DIR=%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts"
4848

4949

5050
@rem ################################
51-
@rem # Set the quiet flag to empty if not defined
51+
@rem # Thirdparty package locations and index handling
52+
set "PIP_EXTRA_ARGS=--find-links %CFG_ROOT_DIR%\thirdparty --find-links https://thirdparty.aboutcode.org/pypi" & %INDEX_ARG%
53+
@rem ################################
54+
55+
56+
@rem ################################
57+
@rem # Set the quiet flag to empty if not defined
5258
if not defined CFG_QUIET (
5359
set "CFG_QUIET= "
5460
)
@@ -58,25 +64,32 @@ if not defined CFG_QUIET (
5864
@rem # Main command line entry point
5965
set CFG_DEV_MODE=0
6066
set "CFG_REQUIREMENTS=%REQUIREMENTS%"
61-
62-
if "%1" EQU "--help" (goto cli_help)
63-
if "%1" EQU "--clean" (goto clean)
64-
if "%1" EQU "--dev" (
65-
set "CFG_REQUIREMENTS=%DEV_REQUIREMENTS%"
66-
set CFG_DEV_MODE=1
67-
)
68-
if "%1" EQU "--python" (
69-
echo "The --python is now DEPRECATED. Use the PYTHON_EXECUTABLE environment
70-
echo "variable instead. Run configure --help for details."
71-
exit /b 0
67+
set "NO_INDEX=--no-index"
68+
69+
:again
70+
if not "%1" == "" (
71+
if "%1" EQU "--help" (goto cli_help)
72+
if "%1" EQU "--clean" (goto clean)
73+
if "%1" EQU "--dev" (
74+
set "CFG_REQUIREMENTS=%DEV_REQUIREMENTS%"
75+
set CFG_DEV_MODE=1
76+
)
77+
if "%1" EQU "--init" (
78+
set "NO_INDEX= "
79+
)
80+
shift
81+
goto again
7282
)
7383

84+
set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% %NO_INDEX%"
85+
86+
7487
@rem ################################
7588
@rem # find a proper Python to run
7689
@rem # Use environment variables or a file if available.
7790
@rem # Otherwise the latest Python by default.
7891
if not defined PYTHON_EXECUTABLE (
79-
@rem # check for a file named PYTHON_EXECUTABLE
92+
@rem # check for a file named PYTHON_EXECUTABLE
8093
if exist ""%CFG_ROOT_DIR%\PYTHON_EXECUTABLE"" (
8194
set /p PYTHON_EXECUTABLE=<""%CFG_ROOT_DIR%\PYTHON_EXECUTABLE""
8295
) else (
@@ -142,6 +155,9 @@ if %ERRORLEVEL% neq 0 (
142155
%PIP_EXTRA_ARGS% ^
143156
%CFG_REQUIREMENTS%
144157

158+
@rem # Create junction to bin to have the same directory between linux and windows
159+
mklink /J %CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin %CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts
160+
145161
if %ERRORLEVEL% neq 0 (
146162
exit /b %ERRORLEVEL%
147163
)
@@ -156,10 +172,14 @@ exit /b 0
156172
echo " usage: configure [options]"
157173
echo " "
158174
echo The default is to configure for regular use. Use --dev for development.
175+
echo Use the --init option if starting a new project and the project
176+
echo dependencies are not available on thirdparty.aboutcode.org/pypi/
177+
echo and requirements.txt and/or requirements-dev.txt has not been generated.
159178
echo " "
160179
echo The options are:
161180
echo " --clean: clean built and installed files and exit."
162181
echo " --dev: configure the environment for development."
182+
echo " --init: pull dependencies from PyPI. Used when first setting up a project."
163183
echo " --help: display this help message and exit."
164184
echo " "
165185
echo By default, the python interpreter version found in the path is used.

0 commit comments

Comments
 (0)