From bb4f4bbfcb1cf1a85bd76a6b8cf4cf882517508d Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Sun, 3 Mar 2024 14:39:55 +0100 Subject: [PATCH] Changes for building fakeredis, Flor and xattr rpm --- l2tdevtools/build_helpers/factory.py | 3 ++- l2tdevtools/build_helpers/wheel.py | 24 ++++++++++++------------ tests/build_helpers/wheel.py | 14 +++++++------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/l2tdevtools/build_helpers/factory.py b/l2tdevtools/build_helpers/factory.py index 100098ce..9f7c3bee 100644 --- a/l2tdevtools/build_helpers/factory.py +++ b/l2tdevtools/build_helpers/factory.py @@ -44,7 +44,7 @@ class BuildHelperFactory(object): 'rpm': rpm.SetupPyRPMBuildHelper, 'source': source.SetupPySourceBuildHelper, 'srpm': rpm.SetupPySRPMBuildHelper, - 'wheel': wheel.SetupPyWheelBuildHelper, + 'wheel': wheel.SetuptoolsWheelBuildHelper, } # Note that the rpm and srpm setup.py build helpers are used to build @@ -52,6 +52,7 @@ class BuildHelperFactory(object): _SETUPTOOLS_BUILD_HELPER_CLASSES = { 'rpm': rpm.SetupPyRPMBuildHelper, 'srpm': rpm.SetupPySRPMBuildHelper, + 'wheel': wheel.SetuptoolsWheelBuildHelper, } @classmethod diff --git a/l2tdevtools/build_helpers/wheel.py b/l2tdevtools/build_helpers/wheel.py index 9671fe47..75d85ee8 100644 --- a/l2tdevtools/build_helpers/wheel.py +++ b/l2tdevtools/build_helpers/wheel.py @@ -203,11 +203,8 @@ def Build(self, source_helper_object): return self._MoveWheel(source_helper_object) -class SetupPyWheelBuildHelper(WheelBuildHelper): - """Helper to build Python wheel packages (.whl). - - Builds wheel packages for projects that use setup.py as their build system. - """ +class FlitWheelBuildHelper(WheelBuildHelper): + """Helper to build Python wheel packages (.whl) using flit.""" def Build(self, source_helper_object): """Builds the wheel. @@ -234,7 +231,7 @@ def Build(self, source_helper_object): logging.info('Building wheel of: {0:s}'.format(source_package_filename)) log_file_path = os.path.join('..', self.LOG_FILENAME) - command = '\"{0:s}\" -m build --wheel > {1:s} 2>&1'.format( + command = '\"{0:s}\" -m flit build --format wheel > {1:s} 2>&1'.format( sys.executable, log_file_path) exit_code = subprocess.call('(cd {0:s} && {1:s})'.format( source_directory, command), shell=True) @@ -245,8 +242,8 @@ def Build(self, source_helper_object): return self._MoveWheel(source_helper_object) -class FlitWheelBuildHelper(WheelBuildHelper): - """Helper to build Python wheel packages (.whl) using flit.""" +class PoetryWheelBuildHelper(WheelBuildHelper): + """Helper to build Python wheel packages (.whl) using poetry.""" def Build(self, source_helper_object): """Builds the wheel. @@ -273,7 +270,7 @@ def Build(self, source_helper_object): logging.info('Building wheel of: {0:s}'.format(source_package_filename)) log_file_path = os.path.join('..', self.LOG_FILENAME) - command = '\"{0:s}\" -m flit build --format wheel > {1:s} 2>&1'.format( + command = '\"{0:s}\" -m poetry build --format wheel > {1:s} 2>&1'.format( sys.executable, log_file_path) exit_code = subprocess.call('(cd {0:s} && {1:s})'.format( source_directory, command), shell=True) @@ -284,8 +281,11 @@ def Build(self, source_helper_object): return self._MoveWheel(source_helper_object) -class PoetryWheelBuildHelper(WheelBuildHelper): - """Helper to build Python wheel packages (.whl) using poetry.""" +class SetuptoolsWheelBuildHelper(WheelBuildHelper): + """Helper to build Python wheel packages (.whl) using setuptools. + + Builds wheel packages for projects that use setup.py as their build system. + """ def Build(self, source_helper_object): """Builds the wheel. @@ -312,7 +312,7 @@ def Build(self, source_helper_object): logging.info('Building wheel of: {0:s}'.format(source_package_filename)) log_file_path = os.path.join('..', self.LOG_FILENAME) - command = '\"{0:s}\" -m poetry build --format wheel > {1:s} 2>&1'.format( + command = '\"{0:s}\" -m build --wheel > {1:s} 2>&1'.format( sys.executable, log_file_path) exit_code = subprocess.call('(cd {0:s} && {1:s})'.format( source_directory, command), shell=True) diff --git a/tests/build_helpers/wheel.py b/tests/build_helpers/wheel.py index 30b7fb9b..3a79f6f0 100644 --- a/tests/build_helpers/wheel.py +++ b/tests/build_helpers/wheel.py @@ -41,7 +41,7 @@ def testGetWheelFilenameProjectInformation(self): l2tdevtools_path = os.path.dirname(os.path.dirname(os.path.dirname( os.path.abspath(__file__)))) - test_build_helper = wheel.SetupPyWheelBuildHelper( + test_build_helper = wheel.WheelBuildHelper( project_definition, l2tdevtools_path, {}) source_helper_object = test_lib.TestSourceHelper( @@ -63,7 +63,7 @@ def testCheckBuildDependencies(self): l2tdevtools_path = os.path.dirname(os.path.dirname(os.path.dirname( os.path.abspath(__file__)))) - test_build_helper = wheel.SetupPyWheelBuildHelper( + test_build_helper = wheel.WheelBuildHelper( project_definition, l2tdevtools_path, {}) missing_packages = test_build_helper.CheckBuildDependencies() @@ -77,7 +77,7 @@ def testCheckBuildRequired(self): l2tdevtools_path = os.path.dirname(os.path.dirname(os.path.dirname( os.path.abspath(__file__)))) - test_build_helper = wheel.SetupPyWheelBuildHelper( + test_build_helper = wheel.WheelBuildHelper( project_definition, l2tdevtools_path, {}) source_helper_object = test_lib.TestSourceHelper( @@ -94,7 +94,7 @@ def testClean(self): l2tdevtools_path = os.path.dirname(os.path.dirname(os.path.dirname( os.path.abspath(__file__)))) - test_build_helper = wheel.SetupPyWheelBuildHelper( + test_build_helper = wheel.WheelBuildHelper( project_definition, l2tdevtools_path, {}) source_helper_object = test_lib.TestSourceHelper( @@ -144,7 +144,7 @@ def testBuild(self): l2tdevtools_path = os.path.dirname(os.path.dirname(os.path.dirname( os.path.abspath(__file__)))) - test_build_helper = wheel.SetupPyWheelBuildHelper( + test_build_helper = wheel.ConfigureMakeWheelBuildHelper( project_definition, l2tdevtools_path, {}) source_helper_object = test_lib.TestSourceHelper( @@ -178,7 +178,7 @@ def testBuild(self): self.assertEqual(len(directory_entries), 4) -class SetupPyWheelBuildHelperTest(shared_test_lib.BaseTestCase): +class SetuptoolsWheelBuildHelperTest(shared_test_lib.BaseTestCase): """Tests for the helper to build Python wheel packages (.whl).""" _TEST_PROJECT_NAME = 'dfdatetime' @@ -196,7 +196,7 @@ def testBuild(self): l2tdevtools_path = os.path.dirname(os.path.dirname(os.path.dirname( os.path.abspath(__file__)))) - test_build_helper = wheel.SetupPyWheelBuildHelper( + test_build_helper = wheel.SetuptoolsWheelBuildHelper( project_definition, l2tdevtools_path, {}) source_helper_object = test_lib.TestSourceHelper(