Skip to content

Commit

Permalink
Merge pull request #13 from UIUCLibrary/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
henryborchers authored Oct 9, 2023
2 parents 94c51e5 + fc120d5 commit db0c8be
Show file tree
Hide file tree
Showing 15 changed files with 251 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tox_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-2019]
python-version: ['3.8' ,'3.9', '3.10', '3.11']
python-version: ['3.8' ,'3.9', '3.10', '3.11', '3.12']
include:
- os: macos-latest
- os: ubuntu-latest
Expand Down
20 changes: 17 additions & 3 deletions ci/docker/linux/jenkins/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
FROM ubuntu:20.04
ARG CONAN_USER_HOME=/conan
ARG PIP_DOWNLOAD_CACHE=/.cache/pip

FROM ubuntu:22.04
COPY ci/docker/linux/jenkins/apt-packages.txt /tmp/
RUN apt-get update && \
apt-get install -y software-properties-common && \
apt-get install -y software-properties-common gpg-agent --no-install-recommends && \
add-apt-repository ppa:deadsnakes/ppa && \
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata && \
apt-get update && \
< /tmp/apt-packages.txt xargs apt-get install -y && \
< /tmp/apt-packages.txt xargs apt-get install -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*


ARG PIP_EXTRA_INDEX_URL
ARG PIP_INDEX_URL
COPY requirements/ /tmp/requirements/requirements/
COPY requirements-ci.txt /tmp/requirements/
RUN python3 -m pip install pip --upgrade && pip install -r /tmp/requirements/requirements-ci.txt

COPY ci/docker/linux/shared/update_conan_compiler.py /tmp/update_conan_compiler.py
ARG CONAN_USER_HOME
RUN conan config init && \
conan config set general.revisions_enabled=1 && \
conan profile update settings.compiler.version=$(cc -dumpfullversion -dumpversion | grep -oE "^([0-9]+(\.)?)([0-9]+?)") default && \
python3 /tmp/update_conan_compiler.py ${CONAN_USER_HOME}/.conan/settings.yml gcc $(cc -dumpfullversion -dumpversion | grep -oE "^([0-9]+(\.)?)([0-9]+?)")
ENV CONAN_USER_HOME=${CONAN_USER_HOME}
7 changes: 7 additions & 0 deletions ci/docker/linux/jenkins/apt-packages.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
ca-certificates
python3-pip
python3.8-dev
python3.8-distutils
python3.8-venv
python3.9-dev
python3.9-distutils
python3.9-venv
python3.10-dev
python3.10-distutils
python3.10-venv
python3.11-dev
python3.11-distutils
python3.11-venv
python3.12-dev
python3.12-distutils
python3.12-venv
git
37 changes: 37 additions & 0 deletions ci/docker/linux/shared/update_conan_compiler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import argparse
import yaml


def get_arg_parser():
parser = argparse.ArgumentParser()
parser.add_argument("settings_file")
parser.add_argument("compiler_name")
parser.add_argument("compiler_version")
return parser


def update_settings_file(settings_file, compiler_name, compiler_version):
with open(settings_file) as file:
data = yaml.safe_load(file)
if compiler_name not in data['compiler']:
raise ValueError(f"invalid compiler name: {compiler_name}")

if compiler_version not in data['compiler'][compiler_name]['version']:
data['compiler'][compiler_name]['version'].append(compiler_version)
print("Compiler data added")
print(data['compiler'][compiler_name]['version'])
with open(settings_file, 'w') as file:
yaml.dump(data, file)

def main():
args = get_arg_parser().parse_args()
print(args)
update_settings_file(
args.settings_file,
args.compiler_name,
args.compiler_version

)

if __name__ == '__main__':
main()
18 changes: 15 additions & 3 deletions ci/docker/linux/tox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
ARG CONAN_USER_HOME=/conan
ARG PIP_DOWNLOAD_CACHE=/.cache/pip
FROM ubuntu:20.04
FROM ubuntu:22.04
COPY ci/docker/linux/tox/apt-packages.txt /tmp/
RUN apt-get update && \
apt-get install -y software-properties-common && \
apt-get install -y software-properties-common gpg-agent --no-install-recommends && \
add-apt-repository ppa:deadsnakes/ppa && \
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata && \
apt-get update && \
< /tmp/apt-packages.txt xargs apt-get install -y && \
< /tmp/apt-packages.txt xargs apt-get install -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

ARG PIP_EXTRA_INDEX_URL
ARG PIP_INDEX_URL
COPY requirements-ci.txt /tmp/python_requirements/
Expand All @@ -18,5 +21,14 @@ ARG PIP_DOWNLOAD_CACHE
RUN mkdir -p ${PIP_DOWNLOAD_CACHE} && \
chmod -R 777 ${PIP_DOWNLOAD_CACHE}
ENV PIP_DOWNLOAD_CACHE=${PIP_DOWNLOAD_CACHE}

COPY ci/docker/linux/shared/update_conan_compiler.py /tmp/update_conan_compiler.py
ARG CONAN_USER_HOME
RUN conan config init && \
conan config set general.revisions_enabled=1 && \
conan profile update settings.compiler.version=$(cc -dumpfullversion -dumpversion | grep -oE "^([0-9]+(\.)?)([0-9]+?)") default && \
python3 /tmp/update_conan_compiler.py ${CONAN_USER_HOME}/.conan/settings.yml gcc $(cc -dumpfullversion -dumpversion | grep -oE "^([0-9]+(\.)?)([0-9]+?)")
ENV CONAN_USER_HOME=${CONAN_USER_HOME}

WORKDIR /src
CMD tox --workdir /tmp/tox --recreate
7 changes: 7 additions & 0 deletions ci/docker/linux/tox/apt-packages.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
python3-pip
python3.8-dev
python3.8-distutils
python3.8-venv
python3.9-dev
python3.9-distutils
python3.9-venv
python3.10-dev
python3.10-distutils
python3.10-venv
python3.11-dev
python3.11-distutils
python3.11-venv
python3.12-dev
python3.12-distutils
python3.12-venv
1 change: 1 addition & 0 deletions ci/docker/windows/tox/chocolatey/python.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
<package id="python39"/>
<package id="python310"/>
<package id="python311"/>
<package id="python312"/>
</packages>
79 changes: 42 additions & 37 deletions requirements/requirements-ci-freeze.txt
Original file line number Diff line number Diff line change
@@ -1,61 +1,66 @@
alabaster==0.7.13
astroid==2.15.6
Babel==2.12.1
astroid==3.0.0
Babel==2.13.0
bottle==0.12.25
certifi==2023.5.7
charset-normalizer==3.2.0
build==1.0.3
certifi==2023.7.22
charset-normalizer==3.3.0
check-manifest==0.49
colorama==0.4.6
conan==1.60.1
coverage==7.2.7
dill==0.3.6
distlib==0.3.6
conan==1.61.0
coverage==7.3.2
devpi-client==5.2.3
devpi-common==3.7.2
dill==0.3.7
distlib==0.3.7
docutils==0.20.1
fasteners==0.18
filelock==3.12.2
flake8==6.0.0
fasteners==0.19
filelock==3.12.4
flake8==6.1.0
idna==3.4
imagesize==1.4.1
iniconfig==2.0.0
isort==5.12.0
Jinja2==3.1.2
lazy-object-proxy==1.9.0
lazy==1.6
lxml==4.9.3
MarkupSafe==2.1.3
mccabe==0.7.0
mypy==1.4.1
mypy==1.5.1
mypy-extensions==1.0.0
node-semver==0.6.1
packaging==23.1
packaging==21.3
patch-ng==1.17.4
platformdirs==3.8.1
pluggy==1.2.0
pkginfo==1.9.6
platformdirs==3.11.0
pluggy==1.3.0
pluginbase==1.0.1
py==1.11.0
pybind11==2.10.4
pycodestyle==2.10.0
pyflakes==3.0.1
Pygments==2.15.1
PyJWT==2.7.0
pylint==2.17.4
pytest==7.4.0
pytest-runner==6.0.0
pybind11==2.11.1
pycodestyle==2.11.0
pyflakes==3.1.0
Pygments==2.16.1
PyJWT==2.8.0
pylint==3.0.1
pyparsing==3.1.1
pyproject_hooks==1.0.0
pytest==7.4.2
python-dateutil==2.8.2
PyYAML==6.0
PyYAML==6.0.1
requests==2.31.0
six==1.16.0
snowballstemmer==2.2.0
Sphinx==7.0.1
sphinxcontrib-applehelp==1.0.4
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.1
Sphinx==7.2.6
sphinxcontrib-applehelp==1.0.7
sphinxcontrib-devhelp==1.0.5
sphinxcontrib-htmlhelp==2.0.4
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
sphinxcontrib-qthelp==1.0.6
sphinxcontrib-serializinghtml==1.1.9
toml==0.10.2
tomlkit==0.11.8
tomlkit==0.12.1
tox==3.28.0
tqdm==4.65.0
typing_extensions==4.7.1
urllib3==1.26.16
virtualenv==20.23.1
wrapt==1.15.0
tqdm==4.66.1
typing_extensions==4.8.0
urllib3==1.26.17
virtualenv==20.24.5
1 change: 0 additions & 1 deletion requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ flake8
lxml
mypy
pytest
pytest-runner
pylint
sphinx
41 changes: 39 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
[tox]
envlist = py{38,39,310,311}
isolated_build = true
envlist = py{38,39,310,311,312}
isolated_build = true

[testenv:mypy]
deps =
mypy
lxml
types-toml
skip_install=True
setenv = MYPY_CACHE_DIR = {temp_dir}/.mypy_cache
commands = mypy {posargs: -p uiucprescon}

[testenv:flake8]
description = check the code style
deps =
flake8
skip_install=True
commands = flake8 {posargs: uiucprescon}

[testenv:pylint]
description = check the code style
deps =
pylint
skip_install=True
commands = pylint {posargs: uiucprescon}

[testenv:pydocstyle]
skip_install = true
deps=
pydocstyle
commands =
pydocstyle {posargs: {toxinidir}/uiucprescon}

[testenv:bandit]
skip_install = true
deps=
bandit
commands =
bandit {posargs: --recursive {toxinidir}/uiucprescon}
8 changes: 8 additions & 0 deletions uiucprescon/build/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
from .local_backend import build_sdist, \
build_wheel, prepare_metadata_for_build_wheel, get_requires_for_build_sdist

VERSION = "0.1.3.dev0"

__all__ = [
'build_sdist',
'build_wheel',
'prepare_metadata_for_build_wheel',
'get_requires_for_build_sdist'
]
16 changes: 10 additions & 6 deletions uiucprescon/build/compiler_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ def get_visual_studio_version():

for v in possible_versions:
try:
winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key % v, 0,
winreg.KEY_ALL_ACCESS)
winreg.OpenKey(
winreg.HKEY_LOCAL_MACHINE,
key % v,
0,
winreg.KEY_ALL_ACCESS
)
installed_versions.append(v)
except Exception as e:
pass
Expand All @@ -76,10 +80,11 @@ def get_clang_version():
# This ensures extension modules are built with correct
# compatibility values, specifically LDSHARED which can use
# '-undefined dynamic_lookup' which only works on >= 10.3.
cur_target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', _cfg_target)
cur_target =\
os.environ.get('MACOSX_DEPLOYMENT_TARGET', _cfg_target)

cur_target_split = [int(x) for x in cur_target.split('.')]
if _cfg_target_split[:2] >= [10, 3] and cur_target_split[:2] < [10,
3]:
if _cfg_target_split[:2] >= [10, 3] > cur_target_split[:2]:
my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: '
'now "%s" but "%s" during configure;'
'must use 10.3 or later'
Expand Down Expand Up @@ -160,4 +165,3 @@ def get_compiler_version():
if len(parsed_version) <= 2:
return full_version
return f"{parsed_version[0]}.{parsed_version[1]}"

Loading

0 comments on commit db0c8be

Please sign in to comment.