Compare commits

...

7 Commits
master ... f32

Author SHA1 Message Date
Tomas Hrnciar
aef4d01da3 Remove doctree pickles
This commit removes hidden doctree folder which serves as a cache for
Sphinx when documentation is build. It's useless for user and creates
rpmlint warning hidden-file-or-dir.
2020-04-20 10:20:01 +02:00
Tomas Hrnciar
ff4e2c0da0 Replace pypi source with tarball from GitHub
Pypi source does not include tests folder so they had to be manually
downloaded from GitHub. This commit replaces pypi source with tarball
from GitHub where tests are included.
This also fixes rpmlint invalid-url warning.
2020-04-20 10:20:01 +02:00
Tomas Hrnciar
8660cdd3be Add rpmlint config to filter not important warnings and errors
This commit adds rpmlint config to filter warning and errors
that are not really a problem. Such as no-documentation warning
for python-pip-wheel which has documentation README shipped with main
package but rpmlint does not see it.
Then it filters out venv spelling error and adds temporary filter for
non-executable-script and wrong-script-interpreter those will be fixed
once all upstream PRs will be merged.
2020-04-20 10:20:01 +02:00
Tomas Hrnciar
4e3a74cc9b Link to man page for all executables
There are four different executables for python-pip, but so far only two of
them had man page. This commit makes man page available for rest of the
executables via links.
2020-04-20 10:20:01 +02:00
Miro Hrončok
0ef16f07c3 Allow setting $TMPDIR to $PWD/... during pip wheel
Needed for https://bugzilla.redhat.com/show_bug.cgi?id=1806625
2020-04-20 10:19:57 +02:00
Miro Hrončok
5204312d9a Make patches apply --without tests
Some patches touch tests and we didn't include the test sources --without tests,
leading to broken build. This was a long standing reoccurring problem.

Now we always include and unpack tests sources, even when we don't run them.
2020-04-16 09:19:22 +02:00
Miro Hrončok
a40d885e9b Fedora CI: Run %pyproject macros integration tests 2020-04-16 09:03:46 +02:00
5 changed files with 206 additions and 25 deletions

151
7873.patch Normal file
View File

@ -0,0 +1,151 @@
From 0ef2645af8871b1722608c36b4f5cdcb8d38067e Mon Sep 17 00:00:00 2001
From: Tomas Hrnciar <thrnciar@redhat.com>
Date: Sun, 19 Apr 2020 20:06:52 +0200
Subject: [PATCH 1/2] Prevent infinite recursion with pip wheel with $TMPDIR in
$PWD
During a build of extension module within `pip wheel` the source directory is
recursively copied in a temporary directory.
See https://github.com/pypa/pip/issues/7555
When the temporary directory is inside the source directory
(for example by setting `TMPDIR=$PWD/tmp`) this caused an infinite recursion
that ended in:
[Errno 36] File name too long
We prevent that buy never copying the target to the target in _copy_source_tree.
Fixes https://github.com/pypa/pip/issues/7872
---
news/7872.bugfix | 1 +
src/pip/_internal/download.py | 23 ++++++++++++++++++-----
tests/data/src/extension/extension.c | 0
tests/data/src/extension/setup.py | 4 ++++
tests/functional/test_wheel.py | 11 +++++++++++
5 files changed, 34 insertions(+), 5 deletions(-)
create mode 100644 news/7872.bugfix
create mode 100644 tests/data/src/extension/extension.c
create mode 100644 tests/data/src/extension/setup.py
diff --git a/news/7872.bugfix b/news/7872.bugfix
new file mode 100644
index 00000000..3550d573
--- /dev/null
+++ b/news/7872.bugfix
@@ -0,0 +1 @@
+Prevent an infinite recursion with ``pip wheel`` when ``$TMPDIR`` is within the source directory.
diff --git a/src/pip/_internal/download.py b/src/pip/_internal/download.py
index 6567fc37..d5c01a41 100644
--- a/src/pip/_internal/download.py
+++ b/src/pip/_internal/download.py
@@ -350,12 +350,25 @@ def _copy2_ignoring_special_files(src, dest):
def _copy_source_tree(source, target):
# type: (str, str) -> None
+ target_abspath = os.path.abspath(target)
+ target_basename = os.path.basename(target_abspath)
+ target_dirname = os.path.dirname(target_abspath)
+
def ignore(d, names):
- # Pulling in those directories can potentially be very slow,
- # exclude the following directories if they appear in the top
- # level dir (and only it).
- # See discussion at https://github.com/pypa/pip/pull/6770
- return ['.tox', '.nox'] if d == source else []
+ # type: (str, List[str]) -> List[str]
+ skipped = [] # type: List[str]
+ if d == source:
+ # Pulling in those directories can potentially be very slow,
+ # exclude the following directories if they appear in the top
+ # level dir (and only it).
+ # See discussion at https://github.com/pypa/pip/pull/6770
+ skipped += ['.tox', '.nox']
+ if os.path.abspath(d) == target_dirname:
+ # Prevent an infinite recursion if the target is in source.
+ # This can happen when TMPDIR is set to ${PWD}/...
+ # and we copy PWD to TMPDIR.
+ skipped += [target_basename]
+ return skipped
kwargs = dict(ignore=ignore, symlinks=True) # type: CopytreeKwargs
diff --git a/tests/data/src/extension/extension.c b/tests/data/src/extension/extension.c
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/data/src/extension/setup.py b/tests/data/src/extension/setup.py
new file mode 100644
index 00000000..b26302b0
--- /dev/null
+++ b/tests/data/src/extension/setup.py
@@ -0,0 +1,4 @@
+from setuptools import Extension, setup
+
+module = Extension('extension', sources=['extension.c'])
+setup(name='extension', version='0.0.1', ext_modules = [module])
diff --git a/tests/functional/test_wheel.py b/tests/functional/test_wheel.py
index 5ebc9ea4..9923c023 100644
--- a/tests/functional/test_wheel.py
+++ b/tests/functional/test_wheel.py
@@ -228,6 +228,17 @@ def test_pip_wheel_with_user_set_in_config(script, data, common_wheels):
assert "Successfully built withpyproject" in result.stdout, result.stdout
+def test_pip_wheel_ext_module_with_tmpdir_inside(script, data, common_wheels):
+ tmpdir = data.src / 'extension/tmp'
+ tmpdir.mkdir()
+ script.environ['TMPDIR'] = str(tmpdir)
+ result = script.pip(
+ 'wheel', data.src / 'extension',
+ '--no-index', '-f', common_wheels
+ )
+ assert "Successfully built extension" in result.stdout, result.stdout
+
+
@pytest.mark.network
def test_pep517_wheels_are_not_confused_with_other_files(script, tmpdir, data):
"""Check correct wheels are copied. (#6196)
From 168e98adb0f5d03887c4d88fc1733308761c3b8a Mon Sep 17 00:00:00 2001
From: Tomas Hrnciar <thrnciar@redhat.com>
Date: Sun, 19 Apr 2020 20:31:47 +0200
Subject: [PATCH 2/2] Avoid a test dependency on a C compiler, skip the test on
Windows
---
tests/functional/test_wheel.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tests/functional/test_wheel.py b/tests/functional/test_wheel.py
index 9923c023..fa3df239 100644
--- a/tests/functional/test_wheel.py
+++ b/tests/functional/test_wheel.py
@@ -1,6 +1,7 @@
"""'pip wheel' tests"""
import os
import re
+import sys
from os.path import exists
import pytest
@@ -228,10 +229,17 @@ def test_pip_wheel_with_user_set_in_config(script, data, common_wheels):
assert "Successfully built withpyproject" in result.stdout, result.stdout
+@pytest.mark.skipif(sys.platform.startswith('win'),
+ reason='The empty extension module does not work on Win')
def test_pip_wheel_ext_module_with_tmpdir_inside(script, data, common_wheels):
tmpdir = data.src / 'extension/tmp'
tmpdir.mkdir()
script.environ['TMPDIR'] = str(tmpdir)
+
+ # To avoid a test dependency on a C compiler, we set the env vars to "noop"
+ # The .c source is empty anyway
+ script.environ['CC'] = script.environ['LDSHARED'] = str('true')
+
result = script.pip(
'wheel', data.src / 'extension',
'--no-index', '-f', common_wheels

15
python-pip.rpmlintrc Normal file
View File

@ -0,0 +1,15 @@
# This is just temporary, when upstream merges PRs it can be removed
# https://github.com/pypa/pip/pull/7959
# https://github.com/ActiveState/appdirs/pull/144
# https://github.com/psf/requests/pull/5410
# https://github.com/chardet/chardet/pull/192
addFilter(r'(non-executable-script|wrong-script-interpreter) .+/pip/_internal/__init__.py\b')
addFilter(r'(non-executable-script|wrong-script-interpreter) .+/pip/_vendor/appdirs.py\b')
addFilter(r'(non-executable-script|wrong-script-interpreter) .+/pip/_vendor/requests/certs.py\b')
addFilter(r'(non-executable-script|wrong-script-interpreter) .+/pip/_vendor/chardet/cli/chardetect.py\b')
# We ship README with the main package but not with the wheel
addFilter(r'python-pip-wheel.noarch: W: no-documentation')
# SPELLING ERRORS
addFilter(r'W: spelling-error .* venv')

View File

@ -16,7 +16,7 @@ Name: python-%{srcname}
# When updating, update the bundled libraries versions bellow! # When updating, update the bundled libraries versions bellow!
# You can use vendor_meta.sh in the dist git repo # You can use vendor_meta.sh in the dist git repo
Version: 19.3.1 Version: 19.3.1
Release: 2%{?dist} Release: 3%{?dist}
Summary: A tool for installing and managing Python packages Summary: A tool for installing and managing Python packages
# We bundle a lot of libraries with pip, which itself is under MIT license. # We bundle a lot of libraries with pip, which itself is under MIT license.
@ -47,8 +47,8 @@ Summary: A tool for installing and managing Python packages
# webencodings: BSD # webencodings: BSD
License: MIT and Python and ASL 2.0 and BSD and ISC and LGPLv2 and MPLv2.0 and (ASL 2.0 or BSD) License: MIT and Python and ASL 2.0 and BSD and ISC and LGPLv2 and MPLv2.0 and (ASL 2.0 or BSD)
URL: http://www.pip-installer.org URL: https://pip.pypa.io/
Source0: %pypi_source Source0: https://github.com/pypa/pip/archive/%{version}/%{srcname}-%{version}.tar.gz
BuildArch: noarch BuildArch: noarch
@ -60,18 +60,10 @@ BuildRequires: python-setuptools-wheel
BuildRequires: python-wheel-wheel BuildRequires: python-wheel-wheel
%endif %endif
# to get tests:
# git clone https://github.com/pypa/pip && cd pip
# VERSION= # define the version you want
# git checkout $VERSION && tar -czvf ../pip-$VERSION-tests.tar.gz tests/
%if %{with tests}
Source1: pip-%{version}-tests.tar.gz
%endif
# Themes required to build the docs. # Themes required to build the docs.
%if %{with doc} %if %{with doc}
Source2: https://github.com/pypa/pypa-docs-theme/archive/%{pypa_theme_commit_hash}.tar.gz Source1: https://github.com/pypa/pypa-docs-theme/archive/%{pypa_theme_commit_hash}.tar.gz
Source3: https://github.com/python/python-docs-theme/archive/2018.2.tar.gz Source2: https://github.com/python/python-docs-theme/archive/2018.2.tar.gz
%endif %endif
# Downstream only patch # Downstream only patch
@ -106,6 +98,12 @@ Patch5: network-tests.patch
# https://github.com/python/cpython/pull/16782 # https://github.com/python/cpython/pull/16782
Patch6: callable-main.patch Patch6: callable-main.patch
# Allow setting $TMPDIR to $PWD/... during pip wheel
# This is needed to have proper debugsource packages with pyproject-rpm-macros
# https://bugzilla.redhat.com/show_bug.cgi?id=1806625
# Backported from https://github.com/pypa/pip/pull/7873
Patch7: 7873.patch
# Downstream only patch # Downstream only patch
# Users might have local installations of pip from using # Users might have local installations of pip from using
# `pip install --user --upgrade pip` on older/newer versions. # `pip install --user --upgrade pip` on older/newer versions.
@ -244,14 +242,12 @@ A Python wheel of pip to use with venv.
%prep %prep
%setup -q -n %{srcname}-%{version} %setup -q -n %{srcname}-%{version}
%if %{with tests}
tar -xf %{SOURCE1}
%endif
%if %{with doc} %if %{with doc}
pushd docs/html pushd docs/html
tar -xf %{SOURCE2} tar -xf %{SOURCE1}
mv pypa-docs-theme-%{pypa_theme_commit_hash} pypa mv pypa-docs-theme-%{pypa_theme_commit_hash} pypa
tar -xf %{SOURCE3} tar -xf %{SOURCE2}
mv python-docs-theme-2018.2 python-docs-theme mv python-docs-theme-2018.2 python-docs-theme
popd popd
%endif %endif
@ -264,15 +260,13 @@ popd
%patch5 -p1 %patch5 -p1
%endif %endif
%patch6 -p1 %patch6 -p1
%patch7 -p1
# this goes together with patch4 # this goes together with patch4
rm src/pip/_vendor/certifi/*.pem rm src/pip/_vendor/certifi/*.pem
sed -i '/\.pem$/d' src/pip.egg-info/SOURCES.txt
%if %{with tests}
# tests expect wheels in here # tests expect wheels in here
ln -s %{python_wheeldir} tests/data/common_wheels ln -s %{python_wheeldir} tests/data/common_wheels
%endif
%build %build
@ -283,7 +277,7 @@ export PYTHONPATH=./src/
# from tox.ini # from tox.ini
sphinx-build-3 -b html docs/html docs/build/html sphinx-build-3 -b html docs/html docs/build/html
sphinx-build-3 -b man docs/man docs/build/man -c docs/html sphinx-build-3 -b man docs/man docs/build/man -c docs/html
rm docs/build/html/.buildinfo rm -rf docs/build/html/{.doctrees,.buildinfo}
%endif %endif
@ -303,7 +297,9 @@ pushd docs/build/man
install -d %{buildroot}%{_mandir}/man1 install -d %{buildroot}%{_mandir}/man1
for MAN in *1; do for MAN in *1; do
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/$MAN install -pm0644 $MAN %{buildroot}%{_mandir}/man1/$MAN
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/${MAN/pip/pip3} for pip in "pip3" "pip-3" "pip%{python3_version}" "pip-%{python3_version}"; do
echo ".so $MAN" > %{buildroot}%{_mandir}/man1/${MAN/pip/$pip}
done
done done
popd popd
%endif %endif
@ -392,6 +388,9 @@ ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip
%{python_wheeldir}/%{python_wheelname} %{python_wheeldir}/%{python_wheelname}
%changelog %changelog
* Fri Apr 10 2020 Miro Hrončok <mhroncok@redhat.com> - 19.3.1-3
- Allow setting $TMPDIR to $PWD/... during pip wheel (#1806625)
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 19.3.1-2 * Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 19.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

View File

@ -1,4 +1,3 @@
SHA512 (pip-19.3.1.tar.gz) = 954b390580e23d0a85d1fa4cbd2f35171df7930fbe346f9a809477fe133e95f7d30208d79b5d07f30c81ab1b0a9b52f36f3ff6c77dc81a1c9ab9beb2bd8e0aa1 SHA512 (pip-19.3.1.tar.gz) = 39446c0ab6e4495d98f22923a2a76901b024d9047b60d92580b21d447a718e5285cfd66f8ad0c20befcfe1abc7f06be29b6a5644d1b30265d3b67399fe76e033
SHA512 (pip-19.3.1-tests.tar.gz) = fb058fcaaff3325341af5f4746be0c7943953c43fb721124758320363532911ca399f254a58e347c72795adc41764600bc6d02efce0e1e27d4b6d130efad9945
SHA512 (d2e63fbfc62af3b7050f619b2f5bb8658985b931.tar.gz) = fc7b11c5cbf6322469ce2eaca2a8d7eb60b17398d316f7465ab5d3d38dabd00ee22a3da7437a28f6312f0115f77f2df0d8bf0abc671e055eef06356c94283409 SHA512 (d2e63fbfc62af3b7050f619b2f5bb8658985b931.tar.gz) = fc7b11c5cbf6322469ce2eaca2a8d7eb60b17398d316f7465ab5d3d38dabd00ee22a3da7437a28f6312f0115f77f2df0d8bf0abc671e055eef06356c94283409
SHA512 (2018.2.tar.gz) = 4c09c43a70ecb3ca3bc9445b01bf209eb382e41d9c969145696dea38551992ed88fd9b725a1264380f3dbdf8acdaf5ada3ef86b44255cdfbdbe4a01a1630912d SHA512 (2018.2.tar.gz) = 4c09c43a70ecb3ca3bc9445b01bf209eb382e41d9c969145696dea38551992ed88fd9b725a1264380f3dbdf8acdaf5ada3ef86b44255cdfbdbe4a01a1630912d

View File

@ -7,6 +7,8 @@
repositories: repositories:
- repo: "https://src.fedoraproject.org/tests/python.git" - repo: "https://src.fedoraproject.org/tests/python.git"
dest: "python" dest: "python"
- repo: "https://src.fedoraproject.org/rpms/pyproject-rpm-macros.git"
dest: "pyproject-rpm-macros"
tests: tests:
- smoke34: - smoke34:
dir: python/smoke dir: python/smoke
@ -43,6 +45,18 @@
run: VERSION=3.8 METHOD=virtualenv ./venv.sh run: VERSION=3.8 METHOD=virtualenv ./venv.sh
- pipenv: - pipenv:
run: pipenv --three && pipenv install six run: pipenv --three && pipenv install six
- pyproject_pytest:
dir: pyproject-rpm-macros/tests
run: ./mocktest.sh python-pytest
- pyproject_entrypoints:
dir: pyproject-rpm-macros/tests
run: ./mocktest.sh python-entrypoints
- pyproject_pluggy:
dir: pyproject-rpm-macros/tests
run: ./mocktest.sh python-pluggy
- pyproject_clikit:
dir: pyproject-rpm-macros/tests
run: ./mocktest.sh python-clikit
required_packages: required_packages:
- gcc - gcc
- virtualenv - virtualenv
@ -56,3 +70,6 @@
- python3-devel - python3-devel
- python3-tox - python3-tox
- pipenv - pipenv
- mock
- rpmdevtools
- rpm-build