1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-08-04 12:21:57 +03:00

gitlab: switch to using 'pip' for package installation

The distutils/setuptools 'install' command is deprecated in favour of
'pip', and with recent versiosn, using it will create a bad install
that triggers a traceback on all future use of setuptools:

Traceback (most recent call last):
  File "/builds/berrange/libvirt-python/setup.py", line 328, in <module>
    setup(name = 'libvirt-python',
  File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 154, in setup
    _install_setup_requires(attrs)
  File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 143, in _install_setup_requires
    dist = MinimalDistribution(attrs)
  File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 135, in __init__
    super().__init__(filtered)
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 456, in __init__
    for ep in metadata.entry_points(group='distutils.setup_keywords'):
  File "/usr/lib64/python3.10/importlib/metadata/__init__.py", line 1009, in entry_points
    return SelectableGroups.load(eps).select(**params)
  File "/usr/lib64/python3.10/importlib/metadata/__init__.py", line 459, in load
    ordered = sorted(eps, key=by_group)
  File "/usr/lib64/python3.10/importlib/metadata/__init__.py", line 1006, in <genexpr>
    eps = itertools.chain.from_iterable(
  File "/usr/lib64/python3.10/importlib/metadata/_itertools.py", line 16, in unique_everseen
    k = key(element)
  File "/usr/lib64/python3.10/importlib/metadata/__init__.py", line 941, in _normalized_name
    return self._name_from_stem(stem) or super()._normalized_name
  File "/usr/lib64/python3.10/importlib/metadata/__init__.py", line 622, in _normalized_name
    return Prepared.normalize(self.name)
  File "/usr/lib64/python3.10/importlib/metadata/__init__.py", line 871, in normalize
    return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
  File "/usr/lib64/python3.10/re.py", line 209, in sub
    return _compile(pattern, flags).sub(repl, string, count)

This is certainly a bug in distutils/setuptools, but given the
'install' command is deprecated, instead of waiting for a fix,
just switch to the recommend 'pip install .' command.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2022-03-25 12:28:47 +00:00
parent c9950c1654
commit 545cc70f2f
11 changed files with 12 additions and 2 deletions

View File

@ -28,7 +28,7 @@ stages:
- ninja -C build install
- popd
- $PYTHON setup.py build
- $PYTHON setup.py install
- $PYTHON -m pip install .
- $PYTHON setup.py test
- $PYTHON setup.py sdist
- if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ; then rpmbuild --nodeps -ta dist/libvirt-python*tar.gz ; fi
@ -40,7 +40,7 @@ stages:
- export CFLAGS="-Werror"
script:
- $PYTHON setup.py build
- $PYTHON setup.py install
- $PYTHON -m pip install .
- $PYTHON setup.py test
- $PYTHON setup.py sdist
- if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ; then rpmbuild --nodeps -ta dist/libvirt-python*tar.gz ; fi

View File

@ -37,6 +37,7 @@ RUN dnf update -y && \
python3-devel \
python3-docutils \
python3-lxml \
python3-pip \
python3-pytest \
python3-setuptools \
rpcgen \

View File

@ -21,6 +21,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
python3 \
python3-dev \
python3-lxml \
python3-pip \
python3-pytest \
python3-setuptools && \
eatmydata apt-get autoremove -y && \

View File

@ -21,6 +21,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
python3 \
python3-dev \
python3-lxml \
python3-pip \
python3-pytest \
python3-setuptools && \
eatmydata apt-get autoremove -y && \

View File

@ -28,6 +28,7 @@ exec "$@"' > /usr/bin/nosync && \
python3 \
python3-devel \
python3-lxml \
python3-pip \
python3-pytest \
python3-setuptools \
rpm-build && \

View File

@ -28,6 +28,7 @@ exec "$@"' > /usr/bin/nosync && \
python3 \
python3-devel \
python3-lxml \
python3-pip \
python3-pytest \
python3-setuptools \
rpm-build && \

View File

@ -29,6 +29,7 @@ exec "$@"' > /usr/bin/nosync && \
python3 \
python3-devel \
python3-lxml \
python3-pip \
python3-pytest \
python3-setuptools \
rpm-build && \

View File

@ -18,6 +18,7 @@ RUN zypper update -y && \
python3-base \
python3-devel \
python3-lxml \
python3-pip \
python3-pytest \
python3-setuptools \
rpm-build && \

View File

@ -18,6 +18,7 @@ RUN zypper dist-upgrade -y && \
python3-base \
python3-devel \
python3-lxml \
python3-pip \
python3-pytest \
python3-setuptools \
rpm-build && \

View File

@ -21,6 +21,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
python3 \
python3-dev \
python3-lxml \
python3-pip \
python3-pytest \
python3-setuptools && \
eatmydata apt-get autoremove -y && \

View File

@ -21,6 +21,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
python3 \
python3-dev \
python3-lxml \
python3-pip \
python3-pytest \
python3-setuptools && \
eatmydata apt-get autoremove -y && \