-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test installation and import also on local system (#4)
Note that `python3 -m build` doesn't work with rootless podman, I can't figure out why☹️
- Loading branch information
Showing
6 changed files
with
62 additions
and
16 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ARG BASE_IMAGE | ||
FROM ${BASE_IMAGE} | ||
|
||
COPY tests/entrypoint.sh /entrypoint.sh | ||
|
||
WORKDIR /rpm-shim | ||
COPY . . | ||
|
||
ARG INSTALL_DEPS_CMD | ||
RUN sh -c "${INSTALL_DEPS_CMD}" | ||
|
||
RUN python3 -m pip install tox build | ||
|
||
WORKDIR / | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
# fail early | ||
set -e | ||
|
||
|
||
### test import in virtualenvs | ||
|
||
pushd /rpm-shim | ||
tox | ||
popd | ||
|
||
|
||
### test import on local system | ||
|
||
PYTHON=python3 | ||
PLATFORM_PYTHON=/usr/libexec/platform-python | ||
if [ ! -x "${PYTHON}" -a -x "${PLATFORM_PYTHON}" ]; then | ||
# fallback to platform-python | ||
PYTHON="${PLATFORM_PYTHON}" | ||
fi | ||
|
||
${PYTHON} -m build --wheel /rpm-shim | ||
# failure to install is most likely caused by existing RPM bindings, consider it a success | ||
${PYTHON} -m pip install /rpm-shim/dist/*.whl || true | ||
${PYTHON} /rpm-shim/tests/import.py | ||
${PYTHON} -m pip check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright Contributors to the Packit project. | ||
# SPDX-License-Identifier: MIT | ||
|
||
import logging | ||
|
||
# enable debug logging | ||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
|
||
def test(): | ||
import rpm | ||
|
||
# sanity check | ||
print("RPM conf dir:", rpm.expandMacro("%getconfdir")) | ||
|
||
|
||
if __name__ == "__main__": | ||
test() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
[tox] | ||
envlist = py{36,37,38,39,310,311} | ||
skip_missing_interpreters = true | ||
skipsdist = true | ||
isolated_build = true | ||
|
||
[testenv] | ||
recreate = true | ||
usedevelop = true | ||
sitepackages = false | ||
# pip < 19 requires setup.py | ||
deps = pip >= 19 | ||
setenv = PYTHONDONTWRITEBYTECODE=1 | ||
commands = | ||
python -c "import rpm" | ||
python tests/import.py | ||
python -m pip check |