Skip to content
Snippets Groups Projects
Commit 63c611c2 authored by Anton Joubert's avatar Anton Joubert
Browse files

Use python3 explicitly instead of python

The python-build docker image now has `python` pointing to Python 2.7
instead of Python 3.7, so we need to be explicit about which executable
to use.  (In the python-runtime container `python` still points to
`python3`).

Also changed pip installations to use `python3 -m pip` instead
of relying on the `pip` and `pip3` wrapper scripts.  The new approach
is recommended by pip.

Removed installation of old utility scripts from setup.py as they
are only for Python 2.7.
parent 5d34a6e5
Branches
Tags
No related merge requests found
......@@ -44,7 +44,7 @@ build wheel for publication: # Executed on a tag
tags:
- docker-executor
script:
- python setup.py egg_info -b+$CI_COMMIT_SHORT_SHA sdist bdist_wheel
- python3 setup.py egg_info -b+$CI_COMMIT_SHORT_SHA sdist bdist_wheel
only:
- tags
artifacts:
......@@ -56,7 +56,7 @@ build wheel for development: # Executed on a commit
tags:
- docker-executor
script:
- python setup.py egg_info -b+dev.$CI_COMMIT_SHORT_SHA sdist bdist_wheel
- python3 setup.py egg_info -b+dev.$CI_COMMIT_SHORT_SHA sdist bdist_wheel
except:
- tags
artifacts:
......@@ -73,7 +73,7 @@ unit tests:
- docker-executor
script:
- echo $(ls -d ./dist/*.whl | grep $CI_COMMIT_SHORT_SHA)
- pip3 install -U $(ls -d ./dist/*.whl | grep $CI_COMMIT_SHORT_SHA) --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple
- python3 -m pip install -U $(ls -d ./dist/*.whl | grep $CI_COMMIT_SHORT_SHA) --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple
- make test
- scripts/validate-metadata.sh
artifacts:
......@@ -90,7 +90,7 @@ linting:
- docker-executor
script:
- echo $(ls -d ./dist/*.whl | grep $CI_COMMIT_SHORT_SHA)
- pip3 install -U $(ls -d ./dist/*.whl | grep $CI_COMMIT_SHORT_SHA) --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple
- python3 -m pip install -U $(ls -d ./dist/*.whl | grep $CI_COMMIT_SHORT_SHA) --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple
- make lint
artifacts:
paths:
......@@ -106,7 +106,7 @@ publish to nexus:
script:
# check metadata requirements
- scripts/validate-metadata.sh
- pip install twine
- python3 -m pip install twine
- twine upload --repository-url $PYPI_REPOSITORY_URL dist/*
only:
variables:
......
......@@ -5,6 +5,6 @@ FROM nexus.engageska-portugal.pt/ska-docker/ska-python-runtime:latest AS runtime
# create ipython profile to so that itango doesn't fail if ipython hasn't run yet
RUN ipython profile create
# A temporary workaround until system team can investigate why 'pipenv install -e .' doesn't work
RUN pip install -e . --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple
CMD ["/venv/bin/python", "/app/skabase/SKABaseDevice/SKABaseDevice.py"]
# Note: working dir is `/app` which will have a copy of our repo
RUN python3 -m pip install -e . --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple
CMD ["python3", "/app/skabase/SKABaseDevice/SKABaseDevice.py"]
......@@ -29,6 +29,7 @@ The lmc-base-classe repository contains set of eight classes as mentioned in SKA
- Fix lost properties when re-initialising test device (remove `get_name` mock).
- Fix Sphinx doc building.
- Move `ObsDevice` variable initialisation from `__init__` to `init_device`.
- Run scripts with `python3` instead of `python` and update pip usage.
#### 0.4.0
- Changed all `DevEnum` attributes to use Python `enum.IntEnum` classes. These can be imported from the
......@@ -99,7 +100,7 @@ The requirements for testing are:
### Installation steps
1. Clone the repository on local machine.
2. Navigate to the root directory of the repository from terminal
3. Run 'pip3 install . --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple'
3. Run 'python3 -m pip install . --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple'
## Testing
The LMC base classes can be tested locally my invoking *make CI_JOB_ID=some_id test* command.
......
......@@ -2,37 +2,37 @@
# PACKAGE METADATA
# ----------------
if [[ $(python setup.py --name) == "UNKNOWN" ]] ; then
if [[ $(python3 setup.py --name) == "UNKNOWN" ]] ; then
echo "[error] metadata: name missing"
exit 2
fi
if [[ $(python setup.py --version) == "0.0.0" ]] ; then
if [[ $(python3 setup.py --version) == "0.0.0" ]] ; then
echo "[error] metadata: version missing"
exit 2
fi
if ! python setup.py --version | grep -q -E '^([0-9]+)\.([0-9]+)\.([0-9]+)$' ; then
if ! python3 setup.py --version | grep -q -E '^([0-9]+)\.([0-9]+)\.([0-9]+)$' ; then
echo "[error] metadata: version is not according to versioning standards"
exit 2
fi
if [[ $(python setup.py --url) == "UNKNOWN" ]] ; then
if [[ $(python3 setup.py --url) == "UNKNOWN" ]] ; then
echo "[error] metadata: url missing"
exit 2
fi
if [[ $(python setup.py --license) == "UNKNOWN" ]] ; then
if [[ $(python3 setup.py --license) == "UNKNOWN" ]] ; then
echo "[error] metadata: license missing"
exit 2
fi
if [[ $(python setup.py --description) == "UNKNOWN" ]] ; then
if [[ $(python3 setup.py --description) == "UNKNOWN" ]] ; then
echo "[error] metadata: description missing"
exit 2
fi
if ! [[ $(python setup.py --classifiers) ]] ; then
if ! [[ $(python3 setup.py --classifiers) ]] ; then
echo "[error] metadata: classifiers missing"
exit 2
fi
......@@ -42,8 +42,8 @@ echo "[info] metadata: all required tags present"
# CONFIRM TAG VERSION
# -------------------
if [ -n "$CI_COMMIT_TAG" ]; then
if [[ $(python setup.py --version) != $CI_COMMIT_TAG ]] ; then
echo "[error] metadata: python package version [$(python setup.py --version)] differs from git tag version [$CI_COMMIT_TAG]"
if [[ $(python3 setup.py --version) != $CI_COMMIT_TAG ]] ; then
echo "[error] metadata: python package version [$(python3 setup.py --version)] differs from git tag version [$CI_COMMIT_TAG]"
exit 2
fi
fi
......@@ -22,10 +22,6 @@ setuptools.setup(
license=license,
packages=setuptools.find_packages(),
include_package_data=True,
scripts=["scripts/gen_csv_info.py",
"scripts/purge_xmi_tree.py",
"scripts/elt_ctl.py",
],
url='https://www.skatelescope.org/',
classifiers=[
"Development Status :: 3 - Alpha",
......@@ -41,5 +37,11 @@ setuptools.setup(
"future",
"ska_logging >= 0.2.0"
],
tests_require=[
"pytest",
"coverage",
"pytest-json-report",
"pytest-forked",
],
keywords="lmc base classes ska",
zip_safe=False)
......@@ -34,7 +34,7 @@ test:
# FIXME: Add pylint2junit to the tango-builder:latest image so that we don't need to install it here.
# FIXME: Missing functionality in pylint2junit prevents converting from parseable to xml. Once it's implemented there is no need to run linting twice.
lint:
pip3 install pylint2junit; \
python3 -m pip install pylint2junit; \
mkdir -p /build/reports; \
cd /app && pylint --output-format=parseable skabase | tee /build/code_analysis.stdout; \
cd /app && pylint --output-format=pylint2junit.JunitReporter skabase > /build/reports/linting.xml;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment