Skip to content

Commit db14416

Browse files
authored
Merge pull request #44 from nexB/latest_skeleton
Latest skeleton
2 parents 7206c1f + b766dd0 commit db14416

20 files changed

Lines changed: 1480 additions & 2701 deletions

azure-pipelines.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,32 @@ jobs:
2525

2626
- template: etc/ci/azure-posix.yml
2727
parameters:
28-
job_name: macos1014_cpython
29-
image_name: macos-10.14
30-
python_versions: ['3.6', '3.7', '3.8', '3.9']
28+
job_name: macos1015_cpython
29+
image_name: macos-10.15
30+
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
3131
test_suites:
3232
all: venv/bin/pytest -n 2 -vvs
3333

3434
- template: etc/ci/azure-posix.yml
3535
parameters:
36-
job_name: macos1015_cpython
37-
image_name: macos-10.15
38-
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
36+
job_name: macos11_cpython
37+
image_name: macos-11
38+
python_versions: ['3.7', '3.8', '3.9', '3.10']
3939
test_suites:
4040
all: venv/bin/pytest -n 2 -vvs
4141

4242
- template: etc/ci/azure-win.yml
4343
parameters:
44-
job_name: win2016_cpython
45-
image_name: vs2017-win2016
44+
job_name: win2019_cpython
45+
image_name: windows-2019
4646
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
4747
test_suites:
4848
all: venv\Scripts\pytest -n 2 -vvs
4949

5050
- template: etc/ci/azure-win.yml
5151
parameters:
52-
job_name: win2019_cpython
53-
image_name: windows-2019
54-
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
52+
job_name: win2022_cpython
53+
image_name: windows-2022
54+
python_versions: ['3.7', '3.8', '3.9', '3.10']
5555
test_suites:
5656
all: venv\Scripts\pytest -n 2 -vvs

configure

Lines changed: 59 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ set -e
1616
# Source this script for initial configuration
1717
# Use configure --help for details
1818
#
19+
# NOTE: please keep in sync with Windows script configure.bat
20+
#
1921
# This script will search for a virtualenv.pyz app in etc/thirdparty/virtualenv.pyz
2022
# Otherwise it will download the latest from the VIRTUALENV_PYZ_URL default
2123
################################
@@ -32,10 +34,8 @@ DEV_REQUIREMENTS="--editable .[testing] --constraint requirements.txt --constrai
3234
# where we create a virtualenv
3335
VIRTUALENV_DIR=venv
3436

35-
# Cleanable files and directories with the --clean option
36-
CLEANABLE="
37-
build
38-
venv"
37+
# Cleanable files and directories to delete with the --clean option
38+
CLEANABLE="build venv"
3939

4040
# extra arguments passed to pip
4141
PIP_EXTRA_ARGS=" "
@@ -50,11 +50,14 @@ 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+
54+
################################
55+
# Thirdparty package locations and index handling
5356
# Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
5457
if [ -f "$CFG_ROOT_DIR/thirdparty" ]; then
55-
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty "
58+
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty"
5659
fi
57-
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS --find-links https://thirdparty.aboutcode.org/pypi"
60+
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS --find-links https://thirdparty.aboutcode.org/pypi/simple/links.html"
5861

5962

6063
################################
@@ -65,56 +68,22 @@ fi
6568

6669

6770
################################
68-
# find a proper Python to run
71+
# Find a proper Python to run
6972
# Use environment variables or a file if available.
7073
# Otherwise the latest Python by default.
71-
if [[ "$PYTHON_EXECUTABLE" == "" ]]; then
72-
# check for a file named PYTHON_EXECUTABLE
73-
if [ -f "$CFG_ROOT_DIR/PYTHON_EXECUTABLE" ]; then
74-
PYTHON_EXECUTABLE=$(cat "$CFG_ROOT_DIR/PYTHON_EXECUTABLE")
75-
else
76-
PYTHON_EXECUTABLE=python3
74+
find_python() {
75+
if [[ "$PYTHON_EXECUTABLE" == "" ]]; then
76+
# check for a file named PYTHON_EXECUTABLE
77+
if [ -f "$CFG_ROOT_DIR/PYTHON_EXECUTABLE" ]; then
78+
PYTHON_EXECUTABLE=$(cat "$CFG_ROOT_DIR/PYTHON_EXECUTABLE")
79+
else
80+
PYTHON_EXECUTABLE=python3
81+
fi
7782
fi
78-
fi
79-
80-
81-
################################
82-
cli_help() {
83-
echo An initial configuration script
84-
echo " usage: ./configure [options]"
85-
echo
86-
echo The default is to configure for regular use. Use --dev for development.
87-
echo Use the --init option if starting a new project and the project
88-
echo dependencies are not available on thirdparty.aboutcode.org/pypi/
89-
echo and requirements.txt and/or requirements-dev.txt has not been generated.
90-
echo
91-
echo The options are:
92-
echo " --clean: clean built and installed files and exit."
93-
echo " --dev: configure the environment for development."
94-
echo " --init: pull dependencies from PyPI. Used when first setting up a project."
95-
echo " --help: display this help message and exit."
96-
echo
97-
echo By default, the python interpreter version found in the path is used.
98-
echo Alternatively, the PYTHON_EXECUTABLE environment variable can be set to
99-
echo configure another Python executable interpreter to use. If this is not
100-
echo set, a file named PYTHON_EXECUTABLE containing a single line with the
101-
echo path of the Python executable to use will be checked last.
102-
set +e
103-
exit
104-
}
105-
106-
107-
clean() {
108-
# Remove cleanable file and directories and files from the root dir.
109-
echo "* Cleaning ..."
110-
for cln in $CLEANABLE;
111-
do rm -rf "${CFG_ROOT_DIR:?}/${cln:?}";
112-
done
113-
set +e
114-
exit
11583
}
11684

11785

86+
################################
11887
create_virtualenv() {
11988
# create a virtualenv for Python
12089
# Note: we do not use the bundled Python 3 "venv" because its behavior and
@@ -145,6 +114,7 @@ create_virtualenv() {
145114
}
146115

147116

117+
################################
148118
install_packages() {
149119
# install requirements in virtualenv
150120
# note: --no-build-isolation means that pip/wheel/setuptools will not
@@ -161,29 +131,62 @@ install_packages() {
161131
}
162132

163133

134+
################################
135+
cli_help() {
136+
echo An initial configuration script
137+
echo " usage: ./configure [options]"
138+
echo
139+
echo The default is to configure for regular use. Use --dev for development.
140+
echo
141+
echo The options are:
142+
echo " --clean: clean built and installed files and exit."
143+
echo " --dev: configure the environment for development."
144+
echo " --help: display this help message and exit."
145+
echo
146+
echo By default, the python interpreter version found in the path is used.
147+
echo Alternatively, the PYTHON_EXECUTABLE environment variable can be set to
148+
echo configure another Python executable interpreter to use. If this is not
149+
echo set, a file named PYTHON_EXECUTABLE containing a single line with the
150+
echo path of the Python executable to use will be checked last.
151+
set +e
152+
exit
153+
}
154+
155+
156+
################################
157+
clean() {
158+
# Remove cleanable file and directories and files from the root dir.
159+
echo "* Cleaning ..."
160+
for cln in $CLEANABLE;
161+
do rm -rf "${CFG_ROOT_DIR:?}/${cln:?}";
162+
done
163+
set +e
164+
exit
165+
}
166+
167+
164168
################################
165169
# Main command line entry point
166-
CFG_DEV_MODE=0
167170
CFG_REQUIREMENTS=$REQUIREMENTS
168-
NO_INDEX="--no-index"
169171

170172
# We are using getopts to parse option arguments that start with "-"
171173
while getopts :-: optchar; do
172174
case "${optchar}" in
173175
-)
174176
case "${OPTARG}" in
175177
help ) cli_help;;
176-
clean ) clean;;
177-
dev ) CFG_REQUIREMENTS="$DEV_REQUIREMENTS" && CFG_DEV_MODE=1;;
178-
init ) NO_INDEX="";;
178+
clean ) find_python && clean;;
179+
dev ) CFG_REQUIREMENTS="$DEV_REQUIREMENTS";;
179180
esac;;
180181
esac
181182
done
182183

183-
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS $NO_INDEX"
184+
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS"
184185

186+
find_python
185187
create_virtualenv "$VIRTUALENV_DIR"
186188
install_packages "$CFG_REQUIREMENTS"
187189
. "$CFG_BIN_DIR/activate"
188190

191+
189192
set +e

configure.bat

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
@rem # Source this script for initial configuration
1515
@rem # Use configure --help for details
1616

17+
@rem # NOTE: please keep in sync with POSIX script configure
18+
1719
@rem # This script will search for a virtualenv.pyz app in etc\thirdparty\virtualenv.pyz
1820
@rem # Otherwise it will download the latest from the VIRTUALENV_PYZ_URL default
1921
@rem ################################
@@ -49,12 +51,11 @@ set "CFG_BIN_DIR=%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts"
4951

5052
@rem ################################
5153
@rem # Thirdparty package locations and index handling
52-
if exist ""%CFG_ROOT_DIR%\thirdparty"" (
53-
set "PIP_EXTRA_ARGS=--find-links %CFG_ROOT_DIR%\thirdparty "
54+
@rem # Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
55+
if exist "%CFG_ROOT_DIR%\thirdparty" (
56+
set PIP_EXTRA_ARGS=--find-links "%CFG_ROOT_DIR%\thirdparty"
5457
)
55-
56-
set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% --find-links https://thirdparty.aboutcode.org/pypi" & %INDEX_ARG%
57-
@rem ################################
58+
set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% --find-links https://thirdparty.aboutcode.org/pypi/simple/links.html"
5859

5960

6061
@rem ################################
@@ -66,7 +67,6 @@ if not defined CFG_QUIET (
6667

6768
@rem ################################
6869
@rem # Main command line entry point
69-
set CFG_DEV_MODE=0
7070
set "CFG_REQUIREMENTS=%REQUIREMENTS%"
7171
set "NO_INDEX=--no-index"
7272

@@ -76,53 +76,51 @@ if not "%1" == "" (
7676
if "%1" EQU "--clean" (goto clean)
7777
if "%1" EQU "--dev" (
7878
set "CFG_REQUIREMENTS=%DEV_REQUIREMENTS%"
79-
set CFG_DEV_MODE=1
80-
)
81-
if "%1" EQU "--init" (
82-
set "NO_INDEX= "
8379
)
8480
shift
8581
goto again
8682
)
8783

88-
set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% %NO_INDEX%"
84+
set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS%"
8985

9086

9187
@rem ################################
92-
@rem # find a proper Python to run
88+
@rem # Find a proper Python to run
9389
@rem # Use environment variables or a file if available.
9490
@rem # Otherwise the latest Python by default.
9591
if not defined PYTHON_EXECUTABLE (
9692
@rem # check for a file named PYTHON_EXECUTABLE
97-
if exist ""%CFG_ROOT_DIR%\PYTHON_EXECUTABLE"" (
98-
set /p PYTHON_EXECUTABLE=<""%CFG_ROOT_DIR%\PYTHON_EXECUTABLE""
93+
if exist "%CFG_ROOT_DIR%\PYTHON_EXECUTABLE" (
94+
set /p PYTHON_EXECUTABLE=<"%CFG_ROOT_DIR%\PYTHON_EXECUTABLE"
9995
) else (
10096
set "PYTHON_EXECUTABLE=py"
10197
)
10298
)
10399

100+
101+
@rem ################################
104102
:create_virtualenv
105103
@rem # create a virtualenv for Python
106104
@rem # Note: we do not use the bundled Python 3 "venv" because its behavior and
107105
@rem # presence is not consistent across Linux distro and sometimes pip is not
108106
@rem # included either by default. The virtualenv.pyz app cures all these issues.
109107

110-
if not exist ""%CFG_BIN_DIR%\python.exe"" (
108+
if not exist "%CFG_BIN_DIR%\python.exe" (
111109
if not exist "%CFG_BIN_DIR%" (
112-
mkdir %CFG_BIN_DIR%
110+
mkdir "%CFG_BIN_DIR%"
113111
)
114112

115-
if exist ""%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz"" (
113+
if exist "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" (
116114
%PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" ^
117115
--wheel embed --pip embed --setuptools embed ^
118116
--seeder pip ^
119117
--never-download ^
120118
--no-periodic-update ^
121119
--no-vcs-ignore ^
122120
%CFG_QUIET% ^
123-
%CFG_ROOT_DIR%\%VIRTUALENV_DIR%
121+
"%CFG_ROOT_DIR%\%VIRTUALENV_DIR%"
124122
) else (
125-
if not exist ""%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz"" (
123+
if not exist "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz" (
126124
curl -o "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz" %VIRTUALENV_PYZ_URL%
127125

128126
if %ERRORLEVEL% neq 0 (
@@ -136,7 +134,7 @@ if not exist ""%CFG_BIN_DIR%\python.exe"" (
136134
--no-periodic-update ^
137135
--no-vcs-ignore ^
138136
%CFG_QUIET% ^
139-
%CFG_ROOT_DIR%\%VIRTUALENV_DIR%
137+
"%CFG_ROOT_DIR%\%VIRTUALENV_DIR%"
140138
)
141139
)
142140

@@ -145,25 +143,29 @@ if %ERRORLEVEL% neq 0 (
145143
)
146144

147145

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

155-
%CFG_BIN_DIR%\pip install ^
154+
"%CFG_BIN_DIR%\pip" install ^
156155
--upgrade ^
157156
--no-build-isolation ^
158157
%CFG_QUIET% ^
159158
%PIP_EXTRA_ARGS% ^
160159
%CFG_REQUIREMENTS%
161160

161+
162+
@rem ################################
163+
:create_bin_junction
162164
@rem # Create junction to bin to have the same directory between linux and windows
163165
if exist "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin" (
164166
rmdir /s /q "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin"
165167
)
166-
mklink /J %CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin %CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts
168+
mklink /J "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin" "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts"
167169

168170
if %ERRORLEVEL% neq 0 (
169171
exit /b %ERRORLEVEL%
@@ -173,20 +175,15 @@ exit /b 0
173175

174176

175177
@rem ################################
176-
177178
:cli_help
178179
echo An initial configuration script
179180
echo " usage: configure [options]"
180181
echo " "
181182
echo The default is to configure for regular use. Use --dev for development.
182-
echo Use the --init option if starting a new project and the project
183-
echo dependencies are not available on thirdparty.aboutcode.org/pypi/
184-
echo and requirements.txt and/or requirements-dev.txt has not been generated.
185183
echo " "
186184
echo The options are:
187185
echo " --clean: clean built and installed files and exit."
188186
echo " --dev: configure the environment for development."
189-
echo " --init: pull dependencies from PyPI. Used when first setting up a project."
190187
echo " --help: display this help message and exit."
191188
echo " "
192189
echo By default, the python interpreter version found in the path is used.
@@ -197,6 +194,7 @@ exit /b 0
197194
exit /b 0
198195

199196

197+
@rem ################################
200198
:clean
201199
@rem # Remove cleanable file and directories and files from the root dir.
202200
echo "* Cleaning ..."

0 commit comments

Comments
 (0)