summaryrefslogtreecommitdiffstats
path: root/src/cephadm/build.py
diff options
context:
space:
mode:
authorJohn Mulligan <jmulligan@redhat.com>2023-12-12 21:13:01 +0100
committerJohn Mulligan <jmulligan@redhat.com>2023-12-13 16:08:23 +0100
commitadb28150e45b0ec3b054d3bcd4a0b6a5a2f7156f (patch)
tree624fbc5e42d149b5827ef9e5a273c92b394d773d /src/cephadm/build.py
parentcephadm: add InstallSpec type to build.py (diff)
downloadceph-adb28150e45b0ec3b054d3bcd4a0b6a5a2f7156f.tar.xz
ceph-adb28150e45b0ec3b054d3bcd4a0b6a5a2f7156f.zip
cephadm: make the pip-install-from-source approach for deps explicit
Previously, the code assumed that all dependencies can be cleanly installed from source with native-code compilers disabled. This worked ok for MarkupSafe because it falls back to pure-python if it can't compile the C extension code. Unfortunately, not all packages that can fall back to pure python do so cleanly in the build. As a first step to resolving that, make the current behavior an explicitly selected mode and permit installing from wheels in the future. Signed-off-by: John Mulligan <jmulligan@redhat.com>
Diffstat (limited to 'src/cephadm/build.py')
-rwxr-xr-xsrc/cephadm/build.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/cephadm/build.py b/src/cephadm/build.py
index 54de52a1fa8..06dd376be2f 100755
--- a/src/cephadm/build.py
+++ b/src/cephadm/build.py
@@ -33,16 +33,18 @@ log = logging.getLogger(__name__)
PY36_REQUIREMENTS = [
{
'package_spec': 'MarkupSafe >= 2.0.1, <2.2',
+ 'from_source': True,
'unique': True,
},
{
'package_spec': 'Jinja2 >= 3.0.2, <3.2',
+ 'from_source': True,
'unique': True,
},
]
PY_REQUIREMENTS = [
- {'package_spec': 'MarkupSafe >= 2.1.3, <2.2'},
- {'package_spec': 'Jinja2 >= 3.1.2, <3.2'},
+ {'package_spec': 'MarkupSafe >= 2.1.3, <2.2', 'from_source': True},
+ {'package_spec': 'Jinja2 >= 3.1.2, <3.2', 'from_source': True},
]
# IMPORTANT to be fully compatible with all the distros ceph is built for we
# need to work around various old versions of python/pip. As such it's easier
@@ -61,17 +63,27 @@ _VALID_VERS_VARS = [
class InstallSpec:
def __init__(
- self, package_spec, custom_pip_args=None, unique=False, **kwargs
+ self,
+ package_spec,
+ custom_pip_args=None,
+ unique=False,
+ from_source=False,
+ **kwargs,
):
self.package_spec = package_spec
self.name = package_spec.split()[0]
self.custom_pip_args = custom_pip_args or []
self.unique = unique
+ self.from_source = from_source
self.extra = kwargs
@property
def pip_args(self):
- return self.custom_pip_args
+ args = []
+ if self.from_source:
+ args.append("--no-binary")
+ args.append(":all:")
+ return args + self.custom_pip_args
@property
def pip_args_and_package(self):
@@ -306,8 +318,6 @@ def _install_pip_deps(tempdir, config):
"-m",
"pip",
"install",
- "--no-binary",
- ":all:",
"--target",
tempdir,
]