mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-11-05 12:07:46 +08:00
Merge branch 'pyprojectpath' into 'master'
python: Add pyprojectpath and pipflags See merge request redox-os/redox!2248
This commit is contained in:
commit
0aab9bcc3a
@ -390,13 +390,22 @@ pub fn build(
|
||||
"DYNAMIC_INIT\n{}cookbook_meson",
|
||||
flags_fn("COOKBOOK_MESON_FLAGS", mesonflags),
|
||||
),
|
||||
BuildKind::Python { legacysetup } => format!(
|
||||
"DYNAMIC_INIT\n{}cookbook_python",
|
||||
BuildKind::Python {
|
||||
pyprojectpath,
|
||||
legacysetup,
|
||||
pipflags,
|
||||
} => format!(
|
||||
"DYNAMIC_INIT\n{}{}{}cookbook_python",
|
||||
if *legacysetup {
|
||||
"COOKBOOK_PYTHON_LEGACY_SETUP=1\n"
|
||||
} else {
|
||||
""
|
||||
}
|
||||
},
|
||||
pyprojectpath
|
||||
.as_ref()
|
||||
.map(|s| format!("COOKBOOK_PYTHON_PYPROJECT_PATH={s}\n"))
|
||||
.unwrap_or("".into()),
|
||||
flags_fn("COOKBOOK_PYTHON_PIP_FLAGS", pipflags),
|
||||
),
|
||||
BuildKind::Custom { script } => script.clone(),
|
||||
BuildKind::Remote => unreachable!(),
|
||||
|
||||
@ -359,6 +359,9 @@ function PYTHON_INIT {
|
||||
export PYTHONPATH="${PYTHONPATH:+$PYTHONPATH:}${COOKBOOK_SYSROOT}/usr/lib/${COOKBOOK_PYTHON_V}/site-packages"
|
||||
export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata__${SYSTEM}_${ARCH}-${OS}"
|
||||
}
|
||||
COOKBOOK_PYTHON_PIP_FLAGS=(
|
||||
--ignore-installed --no-index --no-build-isolation
|
||||
)
|
||||
function cookbook_python {
|
||||
PYTHON_INIT
|
||||
# no way to do out-of-tree build: https://github.com/pypa/setuptools/issues/3237
|
||||
@ -366,8 +369,9 @@ function cookbook_python {
|
||||
if [ -n "${COOKBOOK_PYTHON_LEGACY_SETUP}" ]; then
|
||||
python3 ./source/setup.py install
|
||||
fi
|
||||
"${COOKBOOK_PYTHON}" -m pip install --prefix="${COOKBOOK_STAGE}/usr" "./source" \
|
||||
--ignore-installed --no-index --no-build-isolation "$@"
|
||||
"${COOKBOOK_PYTHON}" -m pip install --prefix="${COOKBOOK_STAGE}/usr" \
|
||||
"./source${COOKBOOK_PYTHON_PYPROJECT_PATH:+/$COOKBOOK_PYTHON_PYPROJECT_PATH}" \
|
||||
"${COOKBOOK_PYTHON_PIP_FLAGS[@]}" "$@"
|
||||
rsync -av "${COOKBOOK_BUILD}/${COOKBOOK_STAGE}/usr/" "${COOKBOOK_STAGE}/usr"
|
||||
}
|
||||
"#;
|
||||
|
||||
@ -106,6 +106,10 @@ pub enum BuildKind {
|
||||
/// Will build and install using python pip
|
||||
#[serde(rename = "python")]
|
||||
Python {
|
||||
#[serde(default)]
|
||||
pyprojectpath: Option<String>,
|
||||
#[serde(default)]
|
||||
pipflags: Vec<String>,
|
||||
/// Some recipes need to run setup.py,
|
||||
/// other does not allow running setup.py.
|
||||
/// This defaults to not run setup.py, but if build result in error,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user