Commit 91c64673 authored by Sebastian Brzezinka's avatar Sebastian Brzezinka Committed by Tomasz Zawadzki
Browse files

build: install python modules using setup.py



Add Makefile to install Python spdk modules, since python module
path depend on distribution, add `pydir` variable to allow specify
custom path.

Signed-off-by: default avatarSebastian Brzezinka <sebastian.brzezinka@intel.com>
Change-Id: I2a2ba50142d2804eb56a98fe092098e7f3a53fdc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16950


Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
parent 7c1a27af
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -10,6 +10,9 @@
# Installation prefix
CONFIG_PREFIX="/usr/local"

# Destination directory for the Python libraries
CONFIG_PYDIR=

# Target architecture
CONFIG_ARCH=native

+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ DIRS-$(CONFIG_ISAL_CRYPTO) += isalcryptobuild
DIRS-$(CONFIG_VFIO_USER) += vfiouserbuild
DIRS-$(CONFIG_SMA) += proto
DIRS-$(CONFIG_XNVME) += xnvmebuild
DIRS-y += python

.PHONY: all clean $(DIRS-y) include/spdk/config.h mk/config.mk \
	cc_version cxx_version .libs_only_other .ldflags ldflags install \
+4 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ function usage() {
	echo " --cross-prefix=prefix     Prefix for cross compilation (default: none)"
	echo "                           example: aarch64-linux-gnu"
	echo " --libdir=path             Configure installation path for the libraries (default: \$prefix/lib)"
	echo " --pydir=path              Configure installation path for the python libraries"
	echo " --max-lcores=VAL          DPDK configuration. VAL defines maximum number of lcores supported"
	echo "                           by EAL, or enables autodetection if set to 'detect'. When 'detect'"
	echo "                           is specified, DPDK will detect number of cores in the system during"
@@ -298,6 +299,9 @@ for i in "$@"; do
		--libdir=*)
			CONFIG[LIBDIR]="${i#*=}"
			;;
		--pydir=*)
			CONFIG[PYDIR]="${i#*=}"
			;;
		--enable-debug)
			CONFIG[DEBUG]=y
			;;
+0 −2
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@ all: $(protopy)
clean:
	$(Q)$(RM) $(protopy)

# TODO: we should probably write a proper install rule here instead of just blindly copying all
# python scripts when building the RPMs
install:
uninstall:

python/Makefile

0 → 100644
+31 −0
Original line number Diff line number Diff line
#  SPDX-License-Identifier: BSD-3-Clause
#  Copyright (C) 2023 Intel Corporation.
#  All rights reserved.
#

SPDK_ROOT_DIR := $(abspath $(CURDIR)/..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

setup_cmd = python3 setup.py install
ifneq ($(DESTDIR),)
setup_cmd += --root $(DESTDIR)
endif

ifneq ($(CONFIG_PYDIR),)
setup_cmd += --install-purelib $(CONFIG_PYDIR)
purelibdir := $(CONFIG_PYDIR)
else
purelibdir := $(shell python -c "import sysconfig; print(sysconfig.get_paths()['purelib'])")
endif

all:

clean:

install:
	$(Q)$(setup_cmd)

uninstall:
	$(Q)rm -r $(DESTDIR)/$(purelibdir)/spdk*

.PHONY: all clean install uninstall
Loading