Skip to content

Commit

Permalink
Changes for building fakeredis, Flor and xattr rpm
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Mar 3, 2024
1 parent 32e294c commit bb4f4bb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
3 changes: 2 additions & 1 deletion l2tdevtools/build_helpers/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ 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
# projects that use setuptools.
_SETUPTOOLS_BUILD_HELPER_CLASSES = {
'rpm': rpm.SetupPyRPMBuildHelper,
'srpm': rpm.SetupPySRPMBuildHelper,
'wheel': wheel.SetuptoolsWheelBuildHelper,
}

@classmethod
Expand Down
24 changes: 12 additions & 12 deletions l2tdevtools/build_helpers/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand All @@ -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.
Expand All @@ -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)
Expand All @@ -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.
Expand All @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions tests/build_helpers/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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()
Expand All @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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'
Expand All @@ -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(
Expand Down

0 comments on commit bb4f4bb

Please sign in to comment.