Skip to content

Commit ad47ed2

Browse files
committed
Merge latest skeleton
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
2 parents 9074616 + 00f4fe7 commit ad47ed2

40 files changed

+3177
-2742
lines changed

.github/workflows/docs-ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI Documentation
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-20.04
8+
9+
strategy:
10+
max-parallel: 4
11+
matrix:
12+
python-version: [3.9]
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- name: Give permission to run scripts
24+
run: chmod +x ./docs/scripts/doc8_style_check.sh
25+
26+
- name: Install Dependencies
27+
run: pip install -e .[docs]
28+
29+
- name: Check Sphinx Documentation build minimally
30+
working-directory: ./docs
31+
run: sphinx-build -E -W source build
32+
33+
- name: Check for documentation style errors
34+
working-directory: ./docs
35+
run: ./scripts/doc8_style_check.sh
36+
37+

.github/workflows/pypi-release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release library as a PyPI wheel and sdist on GH release creation
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build-and-publish-to-pypi:
9+
name: Build and publish library to PyPI
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@master
13+
- name: Set up Python
14+
uses: actions/setup-python@v1
15+
with:
16+
python-version: 3.9
17+
- name: Install pypa/build
18+
run: python -m pip install build --user
19+
- name: Build a binary wheel and a source tarball
20+
run: python -m build --sdist --wheel --outdir dist/
21+
.
22+
- name: Publish distribution to PyPI
23+
if: startsWith(github.ref, 'refs/tags')
24+
uses: pypa/gh-action-pypi-publish@master
25+
with:
26+
password: ${{ secrets.PYPI_API_TOKEN }}
27+

azure-pipelines.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,46 +19,46 @@ jobs:
1919
parameters:
2020
job_name: ubuntu18_cpython
2121
image_name: ubuntu-18.04
22-
python_versions: ['3.6', '3.7', '3.8', '3.9']
22+
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
2323
test_suites:
2424
all: sudo chmod 0644 /boot/vmlinuz-* && sudo apt install libguestfs-tools && venv/bin/pytest -n 2 -vvs
2525

2626
- template: etc/ci/azure-posix.yml
2727
parameters:
2828
job_name: ubuntu20_cpython
2929
image_name: ubuntu-20.04
30-
python_versions: ['3.6', '3.7', '3.8', '3.9']
30+
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
3131
test_suites:
3232
all: sudo chmod 0644 /boot/vmlinuz-* && sudo apt install libguestfs-tools && venv/bin/pytest -n 2 -vvs
3333

3434
- template: etc/ci/azure-posix.yml
3535
parameters:
36-
job_name: macos1014_cpython
37-
image_name: macos-10.14
38-
python_versions: ['3.6', '3.7', '3.8', '3.9']
36+
job_name: macos1015_cpython
37+
image_name: macos-10.15
38+
python_versions: ['3.6', '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-posix.yml
4343
parameters:
44-
job_name: macos1015_cpython
45-
image_name: macos-10.15
46-
python_versions: ['3.6', '3.7', '3.8', '3.9']
44+
job_name: macos11_cpython
45+
image_name: macos-11
46+
python_versions: ['3.7', '3.8', '3.9', '3.10']
4747
test_suites:
4848
all: venv/bin/pytest -n 2 -vvs
4949

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

5858
- template: etc/ci/azure-win.yml
5959
parameters:
60-
job_name: win2019_cpython
61-
image_name: windows-2019
62-
python_versions: ['3.6', '3.7', '3.8', '3.9']
60+
job_name: win2022_cpython
61+
image_name: windows-2022
62+
python_versions: ['3.7', '3.8', '3.9', '3.10']
6363
test_suites:
6464
all: venv\Scripts\pytest -n 2 -vvs

configure

Lines changed: 63 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ 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
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
################################
@@ -28,14 +30,13 @@ CLI_ARGS=$1
2830
# Requirement arguments passed to pip and used by default or with --dev.
2931
REQUIREMENTS="--editable .[full] --constraint requirements.txt"
3032
DEV_REQUIREMENTS="--editable .[full,testing] --constraint requirements.txt --constraint requirements-dev.txt"
33+
DOCS_REQUIREMENTS="--editable .[docs] --constraint requirements.txt"
3134

3235
# where we create a virtualenv
3336
VIRTUALENV_DIR=venv
3437

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

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

54+
55+
################################
56+
# Thirdparty package locations and index handling
5357
# Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
54-
if [ -f "$CFG_ROOT_DIR/thirdparty" ]; then
55-
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty "
58+
if [ -d "$CFG_ROOT_DIR/thirdparty" ]; then
59+
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty"
5660
fi
57-
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS --find-links https://thirdparty.aboutcode.org/pypi"
61+
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS --find-links https://thirdparty.aboutcode.org/pypi/simple/links.html"
5862

5963

6064
################################
@@ -65,56 +69,22 @@ fi
6569

6670

6771
################################
68-
# find a proper Python to run
72+
# Find a proper Python to run
6973
# Use environment variables or a file if available.
7074
# 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
75+
find_python() {
76+
if [[ "$PYTHON_EXECUTABLE" == "" ]]; then
77+
# check for a file named PYTHON_EXECUTABLE
78+
if [ -f "$CFG_ROOT_DIR/PYTHON_EXECUTABLE" ]; then
79+
PYTHON_EXECUTABLE=$(cat "$CFG_ROOT_DIR/PYTHON_EXECUTABLE")
80+
else
81+
PYTHON_EXECUTABLE=python3
82+
fi
7783
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
11584
}
11685

11786

87+
################################
11888
create_virtualenv() {
11989
# create a virtualenv for Python
12090
# Note: we do not use the bundled Python 3 "venv" because its behavior and
@@ -145,6 +115,7 @@ create_virtualenv() {
145115
}
146116

147117

118+
################################
148119
install_packages() {
149120
# install requirements in virtualenv
150121
# note: --no-build-isolation means that pip/wheel/setuptools will not
@@ -161,29 +132,63 @@ install_packages() {
161132
}
162133

163134

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

170173
# We are using getopts to parse option arguments that start with "-"
171174
while getopts :-: optchar; do
172175
case "${optchar}" in
173176
-)
174177
case "${OPTARG}" in
175178
help ) cli_help;;
176-
clean ) clean;;
177-
dev ) CFG_REQUIREMENTS="$DEV_REQUIREMENTS" && CFG_DEV_MODE=1;;
178-
init ) NO_INDEX="";;
179+
clean ) find_python && clean;;
180+
dev ) CFG_REQUIREMENTS="$DEV_REQUIREMENTS";;
181+
docs ) CFG_REQUIREMENTS="$DOCS_REQUIREMENTS";;
179182
esac;;
180183
esac
181184
done
182185

183-
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS $NO_INDEX"
186+
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS"
184187

188+
find_python
185189
create_virtualenv "$VIRTUALENV_DIR"
186190
install_packages "$CFG_REQUIREMENTS"
187191
. "$CFG_BIN_DIR/activate"
188192

193+
189194
set +e

0 commit comments

Comments
 (0)