tdf#162786, tdf#161947: Add support for setuptools and pip

For that, just unzip the wheel files to the Lib directory

Change-Id: I3998e427aeadb840b626ebbb6ce91938de47d2b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180271
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Xisco Fauli 2025-01-15 11:24:06 +01:00
parent 6986986338
commit 47e110fc66
8 changed files with 1009 additions and 46 deletions

View File

@ -13,10 +13,4 @@ $(eval $(call gb_UnpackedTarball_set_tarball,lxml,$(LXML_TARBALL)))
$(eval $(call gb_UnpackedTarball_set_patchlevel,lxml,0))
ifneq ($(OS),MACOSX)
$(eval $(call gb_UnpackedTarball_add_patches,lxml, \
external/lxml/replace-setuptools-with-distutils.patch.1 \
))
endif
# vim: set noet sw=4 ts=4:

View File

@ -1,12 +0,0 @@
diff -ur lxml.org/setupinfo.py lxml/setupinfo.py
--- lxml.org/setupinfo.py 2023-10-20 10:32:17.921500435 +0200
+++ lxml/setupinfo.py 2023-10-20 10:33:40.303323572 +0200
@@ -4,7 +4,7 @@
import os.path
import subprocess
-from setuptools.command.build_ext import build_ext as _build_ext
+from distutils.command.build_ext import build_ext as _build_ext
from distutils.core import Extension
from distutils.errors import CompileError, DistutilsOptionError
from versioninfo import get_base_dir

File diff suppressed because it is too large Load Diff

View File

@ -11,13 +11,17 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,python3))
$(eval $(call gb_UnpackedTarball_set_tarball,python3,$(PYTHON_TARBALL),,python3))
# Since Python 3.11, _freeze_module.vcxproj needs python.exe to build deepfreeze.c
# on Windows
ifeq ($(OS),WNT)
# Since Python 3.11, _freeze_module.vcxproj needs python.exe to build deepfreeze.c on Windows
# Since a wheel file is just a zip file, unzil them to the Lib directory with the other libraries
ifneq ($(OS),MACOSX)
$(eval $(call gb_UnpackedTarball_set_pre_action,python3,\
mkdir -p externals/pythonx86 && \
unzip -q -d externals/pythonx86 -o $(gb_UnpackedTarget_TARFILE_LOCATION)/$(PYTHON_BOOTSTRAP_TARBALL) && \
chmod +x externals/pythonx86/tools/* \
$(if $(filter WNT,$(OS)), \
mkdir -p externals/pythonx86 && \
unzip -q -d externals/pythonx86 -o $(gb_UnpackedTarget_TARFILE_LOCATION)/$(PYTHON_BOOTSTRAP_TARBALL) && \
chmod +x externals/pythonx86/tools/* && \
) \
unzip -q -d Lib/ -o Lib/ensurepip/_bundled/setuptools-65.5.0-py3-none-any.whl && \
unzip -q -d Lib/ -o Lib/ensurepip/_bundled/pip-24.0-py3-none-any.whl \
))
endif

View File

@ -34,7 +34,7 @@ if __name__ == '__main__':
continue
for fileName in sorted(files):
if fileName.endswith(".pyc"):
if not fileName.endswith(".py"):
continue
filesList.append(path.join(relPythonDir, fileName))
if filesList:

View File

@ -49,13 +49,9 @@ endif # SYSTEM_PYTHON
$(eval $(call gb_Module_add_check_targets,pyuno, \
PythonTest_pyuno_pytests_testssl \
PythonTest_pyuno_pytests_testbz2 \
))
ifeq ($(OS),MACOSX)
$(eval $(call gb_Module_add_check_targets,pyuno, \
PythonTest_pyuno_pytests_testpip \
PythonTest_pyuno_pytests_testsetuptools \
))
endif
$(eval $(call gb_Module_add_subsequentcheck_targets,pyuno, \
PythonTest_pyuno_pytests_testcollections \

View File

@ -0,0 +1,16 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_PythonTest_PythonTest,pyuno_pytests_testpip))
$(eval $(call gb_PythonTest_add_modules,pyuno_pytests_testpip,$(SRCDIR)/pyuno/qa/pytests,\
testpip \
))
# vim: set noet sw=4 ts=4:

View File

@ -0,0 +1,14 @@
import os
import unittest
# tdf#162786: make sure importing pip works on all platforms
class SetupToolsTest(unittest.TestCase):
def test_pip_import(self):
import pip
# use imported pip module for pyflakes
with open(os.devnull, "w") as devnull:
print(str(pip), file=devnull)
if __name__ == '__main__':
unittest.main()