From 24d86502c93f37371241ffb9009539d18c5381a1 Mon Sep 17 00:00:00 2001 From: Tim Whisonant Date: Mon, 17 Apr 2023 10:03:24 -0700 Subject: [PATCH] Merge feature/pip install to master (#2917) Move Python projects to pyproject.toml. Removes the legacy behavior of calling python on setup.py, which is no longer the advised way of creating python packages, per PEP 517. Signed-off-by: Tim Whisonant --- binaries/fpgadiag/CMakeLists.txt | 36 ++++++++++------- binaries/fpgadiag/pyproject.toml | 58 +++++++++++++++++++++++++++ binaries/fpgadiag/setup.py | 30 ++++---------- binaries/hssi/CMakeLists.txt | 15 ++++--- binaries/hssi/pyproject.toml | 50 +++++++++++++++++++++++ binaries/hssi/setup.py | 10 ++--- binaries/ofs.uio/CMakeLists.txt | 15 +++---- binaries/ofs.uio/pyproject.toml | 48 ++++++++++++++++++++++ binaries/ofs.uio/setup.py | 8 +--- binaries/opae.io/CMakeLists.txt | 28 ++++++++++--- binaries/opae.io/main.cpp | 2 +- binaries/opae.io/pyproject.toml | 49 +++++++++++++++++++++++ binaries/opae.io/setup.py | 23 +++++------ cmake/modules/OPAEPackaging.cmake | 25 ++++++++++-- libraries/pyopae/CMakeLists.txt | 13 ++---- libraries/pyopae/MANIFEST.in | 17 -------- libraries/pyopae/pyproject.toml | 62 +++++++++++++++++++++++++++++ libraries/pyopae/setup.py | 31 +++------------ libraries/pyopaeuio/CMakeLists.txt | 32 +++++++-------- libraries/pyopaeuio/pyproject.toml | 40 +++++++++++++++++++ libraries/pyopaeuio/setup.py | 34 +++++----------- opae.spec.fedora | 46 +++++---------------- opae.spec.rhel | 16 ++------ packaging/opae/deb/rules | 19 ++++----- python/opae.admin/LICENSE | 2 +- python/opae.admin/pyproject.toml | 64 ++++++++++++++++++++++++++++++ python/opae.admin/setup.py | 15 ++----- python/packager/pyproject.toml | 59 +++++++++++++++++++++++++++ python/packager/setup.py | 10 +---- python/pacsign/pyproject.toml | 50 +++++++++++++++++++++++ python/pacsign/setup.py | 10 +---- 31 files changed, 649 insertions(+), 268 deletions(-) create mode 100644 binaries/fpgadiag/pyproject.toml create mode 100644 binaries/hssi/pyproject.toml create mode 100644 binaries/ofs.uio/pyproject.toml create mode 100644 binaries/opae.io/pyproject.toml delete mode 100644 libraries/pyopae/MANIFEST.in create mode 100644 libraries/pyopae/pyproject.toml create mode 100644 libraries/pyopaeuio/pyproject.toml create mode 100644 python/opae.admin/pyproject.toml create mode 100644 python/packager/pyproject.toml create mode 100644 python/pacsign/pyproject.toml diff --git a/binaries/fpgadiag/CMakeLists.txt b/binaries/fpgadiag/CMakeLists.txt index d41988f256ca..7562bb5d00c3 100644 --- a/binaries/fpgadiag/CMakeLists.txt +++ b/binaries/fpgadiag/CMakeLists.txt @@ -92,32 +92,40 @@ if (OPAE_WITH_PYBIND11) set(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/timestamp) file(GLOB_RECURSE PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/opae/*) - set(INCLUDE_DIRS "${OPAE_INCLUDE_PATH}:${pybind11_ROOT}/include") - set(LINK_DIRS "${LIBRARY_OUTPUT_PATH}") + set(PYFILES + pyproject.toml + setup.py + mux.json + nlb0.json + nlb3.json + nlb7.json + ) + + set(PYDIST_STAGE_DIR ${CMAKE_CURRENT_BINARY_DIR}/stage) + + foreach(pyfile ${PYFILES}) + configure_file(${pyfile} ${PYDIST_STAGE_DIR}/${pyfile} @ONLY) + endforeach(pyfile ${PYFILES}) + + file(COPY opae DESTINATION ${PYDIST_STAGE_DIR}) + file(COPY src DESTINATION ${PYDIST_STAGE_DIR}) add_custom_command( OUTPUT ${OUTPUT} - COMMAND ${PYTHON_EXECUTABLE} setup.py build_ext -I ${INCLUDE_DIRS} -L ${LINK_DIRS} - COMMAND ${PYTHON_EXECUTABLE} setup.py build + COMMAND ${PYTHON_EXECUTABLE} -m pip install --root=${PYDIST_STAGE_DIR}/build --no-warn-script-location . COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS setup.py ${PKG_FILES} - ) - - set_property(DIRECTORY PROPERTY - ADDITIONAL_MAKE_CLEAN_FILES - "${CMAKE_CURRENT_SOURCE_DIR}/build" - "${CMAKE_CURRENT_SOURCE_DIR}/dist" + WORKING_DIRECTORY ${PYDIST_STAGE_DIR} + DEPENDS pyproject.toml setup.py ${PKG_FILES} ) - pybind11_add_module(eth_group THIN_LTO src/eth_group.cpp) + pybind11_add_module(eth_group THIN_LTO ${PYDIST_STAGE_DIR}/src/eth_group.cpp) target_link_libraries(eth_group PRIVATE opaeuio) add_custom_target(opae.diag-build ALL DEPENDS nlb0 nlb3 nlb7 ${OUTPUT}) opae_python_install( COMPONENT toolfpgadiagapps RECORD_FILE fpgadiag-install.txt - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} + SOURCE_DIR ${PYDIST_STAGE_DIR} RPM_PACKAGE tools-extra ) endif(OPAE_WITH_PYBIND11) diff --git a/binaries/fpgadiag/pyproject.toml b/binaries/fpgadiag/pyproject.toml new file mode 100644 index 000000000000..84b587a7201b --- /dev/null +++ b/binaries/fpgadiag/pyproject.toml @@ -0,0 +1,58 @@ +# Copyright(c) 2023, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +[build-system] +requires = ["setuptools>=59.6", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "opae.diag" +version = "2.0.1" +description = "eth group provides python bindings for ethernet mdev" +#readme = "" +license = {text = "BSD-3-Clause"} +requires-python = ">=3.6" + +[tool.setuptools] +packages = [ +"opae", +"opae.diag", +] + +[tool.setuptools.package-data] +"*" = ["*.json"] + +[project.scripts] +fpgadiag = "opae.diag.fpgadiag:main" +fvlbypass = "opae.diag.fvlbypass:main" +fpgalpbk = "opae.diag.fpgalpbk:main" +mactest = "opae.diag.mactest:main" +fpgastats = "opae.diag.fpgastats:main" +fpgamac = "opae.diag.fpgamac:main" +fecmode = "opae.diag.fecmode:main" + +[project.urls] +Homepage = "https://opae.github.io" diff --git a/binaries/fpgadiag/setup.py b/binaries/fpgadiag/setup.py index 116f9efe79fe..de67920978bf 100644 --- a/binaries/fpgadiag/setup.py +++ b/binaries/fpgadiag/setup.py @@ -23,11 +23,10 @@ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. + from setuptools import setup, find_namespace_packages from setuptools.command.build_ext import build_ext -from distutils.ccompiler import new_compiler from distutils.extension import Extension -from distutils.errors import CompileError, DistutilsExecError # get the original build_extensions method original_build_extensions = build_ext.build_extensions @@ -45,16 +44,6 @@ def override_build_extensions(self): build_ext.build_extensions = override_build_extensions -class pybind_include_dirs(object): - def __init__(self, user=False): - self.user = user - - def __str__(self): - import pybind11 - return pybind11.get_include(self.user) - - - def extensions(): ext = [] @@ -64,17 +53,20 @@ def extensions(): language="c++", extra_compile_args=["-std=c++11"], extra_link_args=["-std=c++11"], + include_dirs=[ + "@OPAE_INCLUDE_PATH@", + "@pybind11_ROOT@/include", + ], libraries=['opaeuio'], - ) + library_dirs=["@LIBRARY_OUTPUT_PATH@"]) ) return ext setup( - name='opae.diag', - version="2.0", + name="opae.diag", + version="2.0.1", packages=find_namespace_packages(include=['opae.*']), - include_dirs=[pybind_include_dirs()], entry_points={ 'console_scripts': [ 'fpgadiag = opae.diag.fpgadiag:main', @@ -86,11 +78,5 @@ def extensions(): 'fecmode = opae.diag.fecmode:main', ] }, - description="eth group provides python bindings" - "for ethernet mdev", - license="BSD3", - keywords="OPAE eth group bindings", - url="https://opae.github.io", ext_modules=extensions(), - include_package_data=True, ) diff --git a/binaries/hssi/CMakeLists.txt b/binaries/hssi/CMakeLists.txt index 6825ca3ce082..f2776c0a937d 100644 --- a/binaries/hssi/CMakeLists.txt +++ b/binaries/hssi/CMakeLists.txt @@ -1,4 +1,4 @@ -## Copyright(c) 2021, Intel Corporation +## Copyright(c) 2021-2023, Intel Corporation ## ## Redistribution and use in source and binary forms, with or without ## modification, are permitted provided that the following conditions are met: @@ -25,17 +25,14 @@ ## POSSIBILITY OF SUCH DAMAGE. set(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/timestamp) -file(GLOB_RECURSE PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.py) - -set(LINK_DIRS "${LIBRARY_OUTPUT_PATH}") +file(GLOB_RECURSE PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/ethernet/*.py) add_custom_command( OUTPUT ${OUTPUT} - COMMAND ${PYTHON_EXECUTABLE} setup.py build_ext -L ${LINK_DIRS} - COMMAND ${PYTHON_EXECUTABLE} setup.py build + COMMAND ${PYTHON_EXECUTABLE} -m pip install --root=${CMAKE_CURRENT_SOURCE_DIR}/build --no-warn-script-location . COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS setup.py ${PKG_FILES} + DEPENDS pyproject.toml ${PKG_FILES} ) set_property(DIRECTORY PROPERTY @@ -43,7 +40,9 @@ set_property(DIRECTORY PROPERTY "${CMAKE_CURRENT_SOURCE_DIR}/build" "${CMAKE_CURRENT_SOURCE_DIR}/dist" ) -add_custom_target(build ALL DEPENDS ${OUTPUT}) + +add_custom_target(build ALL DEPENDS ${OUTPUT}) + opae_python_install( COMPONENT toolhssi RECORD_FILE hssi-install.txt diff --git a/binaries/hssi/pyproject.toml b/binaries/hssi/pyproject.toml new file mode 100644 index 000000000000..8bf765633fb9 --- /dev/null +++ b/binaries/hssi/pyproject.toml @@ -0,0 +1,50 @@ +# Copyright(c) 2023, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +[build-system] +requires = ["setuptools>=59.6", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "hssi_ethernet" +version = "2.0.1" +description = "hssi ethernet tools" +#readme = "" +license = {text = "BSD-3-Clause"} +requires-python = ">=3.6" + +[tool.setuptools] +packages = [ +"ethernet" +] + +[project.scripts] +hssistats = "ethernet.hssistats:main" +hssimac = "ethernet.hssimac:main" +hssiloopback = "ethernet.hssiloopback:main" + +[project.urls] +Homepage = "https://opae.github.io" diff --git a/binaries/hssi/setup.py b/binaries/hssi/setup.py index 9000de8a7bb1..2cda617df1b1 100644 --- a/binaries/hssi/setup.py +++ b/binaries/hssi/setup.py @@ -23,11 +23,12 @@ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. + from setuptools import setup, find_packages setup( - name='hssi ethernet', - version="2.0", + name='hssi_ethernet', + version="2.0.1", packages=find_packages(include=['*']), entry_points={ 'console_scripts': [ @@ -36,9 +37,4 @@ 'hssiloopback = ethernet.hssiloopback:main' ] }, - description="hssi ethernet tools", - license="BSD3", - keywords="OPAE hssi tools ", - url="https://opae.github.io", - include_package_data=True, ) diff --git a/binaries/ofs.uio/CMakeLists.txt b/binaries/ofs.uio/CMakeLists.txt index 994e79450678..43792725bbb6 100644 --- a/binaries/ofs.uio/CMakeLists.txt +++ b/binaries/ofs.uio/CMakeLists.txt @@ -1,4 +1,4 @@ -## Copyright(c) 2022, Intel Corporation +## Copyright(c) 2022-2023, Intel Corporation ## ## Redistribution and use in source and binary forms, with or without ## modification, are permitted provided that the following conditions are met: @@ -24,20 +24,14 @@ ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ## POSSIBILITY OF SUCH DAMAGE. -# Build and install ofs.uio Python package - set(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/timestamp) -file(GLOB_RECURSE PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/uio/*) - -set(LINK_DIRS "${LIBRARY_OUTPUT_PATH}") add_custom_command( OUTPUT ${OUTPUT} - COMMAND ${PYTHON_EXECUTABLE} setup.py build_ext -L ${LINK_DIRS} - COMMAND ${PYTHON_EXECUTABLE} setup.py build + COMMAND ${PYTHON_EXECUTABLE} -m pip install --root=${CMAKE_CURRENT_SOURCE_DIR}/build --no-warn-script-location . COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS setup.py ${PKG_FILES} + DEPENDS pyproject.toml ${PKG_FILES} ) set_property(DIRECTORY PROPERTY @@ -46,7 +40,8 @@ set_property(DIRECTORY PROPERTY "${CMAKE_CURRENT_SOURCE_DIR}/dist" ) -add_custom_target(ofs.uio-build ALL DEPENDS ${OUTPUT}) +add_custom_target(ofs.uio-build ALL DEPENDS ${OUTPUT}) + opae_python_install( COMPONENT ofs.uio RECORD_FILE ofs.uio-install.txt diff --git a/binaries/ofs.uio/pyproject.toml b/binaries/ofs.uio/pyproject.toml new file mode 100644 index 000000000000..3f6eeeb728d8 --- /dev/null +++ b/binaries/ofs.uio/pyproject.toml @@ -0,0 +1,48 @@ +# Copyright(c) 2023, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +[build-system] +requires = ["setuptools>=59.6", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "ofs.uio" +version = "1.0.1" +description = "tool to peek/poke and mailbox read/write csr" +#readme = "" +license = {text = "BSD-3-Clause"} +requires-python = ">=3.6" + +[tool.setuptools] +packages = [ +"uio" +] + +[project.scripts] +"ofs.uio" = "uio.ofs_uio:main" + +[project.urls] +Homepage = "https://opae.github.io" diff --git a/binaries/ofs.uio/setup.py b/binaries/ofs.uio/setup.py index 5b33c22a5681..8196a4a5f13e 100644 --- a/binaries/ofs.uio/setup.py +++ b/binaries/ofs.uio/setup.py @@ -23,20 +23,16 @@ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. + from setuptools import setup, find_namespace_packages setup( name='ofs.uio', - version="1.0", + version="1.0.1", packages=find_namespace_packages(include=['uio*']), entry_points={ 'console_scripts': [ 'ofs.uio = uio.ofs_uio:main', ] }, - description="ofs uio tool to peek/poke and mailbox read/write csr", - license="BSD3", - keywords="ofs uio tools ", - url="https://opae.github.io", - include_package_data=True, ) diff --git a/binaries/opae.io/CMakeLists.txt b/binaries/opae.io/CMakeLists.txt index 93edd1fc49e2..56582b3d3b15 100644 --- a/binaries/opae.io/CMakeLists.txt +++ b/binaries/opae.io/CMakeLists.txt @@ -60,22 +60,38 @@ if (PLATFORM_SUPPORTS_VFIO AND OPAE_WITH_PYBIND11 AND OPAE_WITH_LIBEDIT) set(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/timestamp) file(GLOB_RECURSE PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/opae/*) - set(INCLUDE_DIRS "${OPAE_INCLUDE_PATH}:${pybind11_ROOT}/include:${OPAE_BIN_SOURCE}/opae.io") - set(LINK_DIRS "${LIBRARY_OUTPUT_PATH}") + set(PYFILES + pyproject.toml + setup.py + ) + + set(PYDIST_STAGE_DIR ${CMAKE_CURRENT_BINARY_DIR}/stage) + + foreach(pyfile ${PYFILES}) + configure_file(${pyfile} ${PYDIST_STAGE_DIR}/${pyfile} @ONLY) + endforeach(pyfile ${PYFILES}) + + file(COPY opae DESTINATION ${PYDIST_STAGE_DIR}) + file(COPY scripts DESTINATION ${PYDIST_STAGE_DIR}) + + foreach(cppfile vfiobindings.cpp) + file(COPY ${cppfile} DESTINATION ${PYDIST_STAGE_DIR}) + endforeach(cppfile ${PYOPAE_SRC}) add_custom_command( OUTPUT ${OUTPUT} - COMMAND ${PYTHON_EXECUTABLE} setup.py build_ext -I ${INCLUDE_DIRS} -L ${LINK_DIRS} + COMMAND ${PYTHON_EXECUTABLE} -m pip install --root=${PYDIST_STAGE_DIR}/build . COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS setup.py ${PKG_FILES} + WORKING_DIRECTORY ${PYDIST_STAGE_DIR} + DEPENDS ${PYFILES} ${PKG_FILES} ) add_custom_target(opae.io-build ALL DEPENDS opaevfio opae.io ${OUTPUT}) + opae_python_install( COMPONENT opae.io RECORD_FILE opae.io-install.txt - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} + SOURCE_DIR ${PYDIST_STAGE_DIR} RPM_PACKAGE devel ) diff --git a/binaries/opae.io/main.cpp b/binaries/opae.io/main.cpp index 80792d428e6c..b08a499770ac 100644 --- a/binaries/opae.io/main.cpp +++ b/binaries/opae.io/main.cpp @@ -47,7 +47,7 @@ struct mmio_region *the_region = nullptr; const char *program = "opae.io"; const int major = 0; const int minor = 2; -const int patch = 6; +const int patch = 7; py::tuple version() { diff --git a/binaries/opae.io/pyproject.toml b/binaries/opae.io/pyproject.toml new file mode 100644 index 000000000000..c6b5f9dcb7bc --- /dev/null +++ b/binaries/opae.io/pyproject.toml @@ -0,0 +1,49 @@ +# Copyright(c) 2023, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +[build-system] +requires = ["setuptools>=59.6", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "opae.io" +version = "0.2.7" +description = "opae.io provides Python bindings around the VFIO API" +#readme = "" +license = {text = "BSD-3-Clause"} +requires-python = ">=3.6" + +[tool.setuptools] +packages = [ +"opae", +"opae.io", +] + +[tool.setuptools.package-data] +"*" = ["scripts/*"] + +[project.urls] +Homepage = "https://opae.github.io" diff --git a/binaries/opae.io/setup.py b/binaries/opae.io/setup.py index 8e1b0aaa0349..9c7be8b52710 100644 --- a/binaries/opae.io/setup.py +++ b/binaries/opae.io/setup.py @@ -28,22 +28,21 @@ from distutils.core import Extension, setup setup( - name="opae.io", - version="0.2.6", + name='opae.io', + version='0.2.7', packages=find_namespace_packages(include=['opae.*']), - entry_points={ - 'console_scripts': [] - }, ext_modules=[ - Extension('libvfio', ['vfiobindings.cpp'], + Extension('libvfio', + sources=['vfiobindings.cpp'], language="c++", extra_compile_args=["-std=c++11"], extra_link_args=["-std=c++11"], - libraries=['opaevfio']) + include_dirs=[ + "@OPAE_INCLUDE_PATH@", + "@pybind11_ROOT@/include", + "@OPAE_BIN_SOURCE@/opae.io", + ], + libraries=['opaevfio'], + library_dirs=["@LIBRARY_OUTPUT_PATH@"]) ], - description="pyopae provides Python bindings around the " - "VFIO API", - license="BSD3", - keywords="OPAE accelerator vfio bindings", - url="https://opae.github.io", ) diff --git a/cmake/modules/OPAEPackaging.cmake b/cmake/modules/OPAEPackaging.cmake index 00077250b2bf..f62586824107 100644 --- a/cmake/modules/OPAEPackaging.cmake +++ b/cmake/modules/OPAEPackaging.cmake @@ -215,21 +215,40 @@ function(opae_python_install) # `make install DESTDIR=/mnt/root`). Avoid passing an empty variable to # --root= by checking (and possibly set) the $DESTDIR variable before # calling python setuptools. + + #install( + # CODE " + # if (\"\$ENV{DESTDIR}\" STREQUAL \"\") + # set(ENV{DESTDIR} /) + # endif() + # execute_process( + # COMMAND ${PYTHON_EXECUTABLE} setup.py install -O1 \ + # --single-version-externally-managed \ + # --root=\$ENV{DESTDIR} \ + # --prefix=${CMAKE_INSTALL_PREFIX} \ + # --record=${CMAKE_BINARY_DIR}/${OPAE_PYTHON_INSTALL_RECORD_FILE} + # WORKING_DIRECTORY ${OPAE_PYTHON_INSTALL_SOURCE_DIR} + # ) + # ${APPEND_CODE} + # " + # COMPONENT ${OPAE_PYTHON_INSTALL_COMPONENT} + #) + install( CODE " if (\"\$ENV{DESTDIR}\" STREQUAL \"\") set(ENV{DESTDIR} /) endif() execute_process( - COMMAND ${PYTHON_EXECUTABLE} setup.py install -O1 \ - --single-version-externally-managed \ + COMMAND ${PYTHON_EXECUTABLE} -m pip install \ --root=\$ENV{DESTDIR} \ --prefix=${CMAKE_INSTALL_PREFIX} \ - --record=${CMAKE_BINARY_DIR}/${OPAE_PYTHON_INSTALL_RECORD_FILE} + --no-warn-script-location . WORKING_DIRECTORY ${OPAE_PYTHON_INSTALL_SOURCE_DIR} ) ${APPEND_CODE} " COMPONENT ${OPAE_PYTHON_INSTALL_COMPONENT} ) + endfunction(opae_python_install) diff --git a/libraries/pyopae/CMakeLists.txt b/libraries/pyopae/CMakeLists.txt index 6db8fa1f8270..2a3646001105 100644 --- a/libraries/pyopae/CMakeLists.txt +++ b/libraries/pyopae/CMakeLists.txt @@ -24,8 +24,6 @@ ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ## POSSIBILITY OF SUCH DAMAGE. -set(PYOPAE_PYBIND11_VERSION "2.2.4") - set(PYOPAE_SRC opae.cpp pycontext.h @@ -82,9 +80,9 @@ add_custom_command(TARGET _opae COMMENT "Copying Python test files") if (OPAE_BUILD_PYTHON_DIST) - set(SETUP_INCLUDE_DIRS "${OPAE_INCLUDE_PATH}:${pybind11_INCLUDE_DIRS}") set(PYFILES + pyproject.toml setup.py opae/fpga/__init__.py test_pyopae.py @@ -100,16 +98,13 @@ if (OPAE_BUILD_PYTHON_DIST) foreach(cppfile ${PYOPAE_SRC}) file(COPY ${cppfile} DESTINATION ${PYDIST_STAGE_DIR}) endforeach(cppfile ${PYOPAE_SRC}) - file(COPY MANIFEST.in DESTINATION ${PYDIST_STAGE_DIR}) + add_custom_target(pyopae-dist - COMMAND ${PYTHON_EXECUTABLE} setup.py sdist - COMMAND ${PYTHON_EXECUTABLE} setup.py build_ext - --include-dirs=${OPAE_INCLUDE_PATH} - --library-dirs=${LIBRARY_OUTPUT_PATH} - COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel + COMMAND ${PYTHON_EXECUTABLE} -m pip install --root=${PYDIST_STAGE_DIR}/build . DEPENDS ${PYFILES} ${PYOPAE_SRC} WORKING_DIRECTORY ${PYDIST_STAGE_DIR} COMMENT "Building Python distrubutions") + opae_python_install( COMPONONENT opae.fpga RECORD_FILE opae.fpga-install.txt diff --git a/libraries/pyopae/MANIFEST.in b/libraries/pyopae/MANIFEST.in deleted file mode 100644 index 3209430dd36e..000000000000 --- a/libraries/pyopae/MANIFEST.in +++ /dev/null @@ -1,17 +0,0 @@ -include opae.cpp -include pycontext.h -include pycontext.cpp -include pyproperties.h -include pyproperties.cpp -include pyhandle.h -include pyhandle.cpp -include pytoken.h -include pytoken.cpp -include pyshared_buffer.h -include pyshared_buffer.cpp -include pyevents.h -include pyevents.cpp -include pyerrors.h -include pyerrors.cpp -include pysysobject.h -include pysysobject.cpp diff --git a/libraries/pyopae/pyproject.toml b/libraries/pyopae/pyproject.toml new file mode 100644 index 000000000000..e53d9f3abf3f --- /dev/null +++ b/libraries/pyopae/pyproject.toml @@ -0,0 +1,62 @@ +# Copyright(c) 2023, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +[build-system] +requires = ["setuptools>=59.6", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "opae.fpga" +version = "@OPAE_VERSION@" +description = "pyopae provides Python bindings around the OPAE C API" +#readme = "" +license = {text = "BSD-3-Clause"} +requires-python = ">=3.6" + +[tool.setuptools.package-data] +"*" = [ +"README.md", +"opae.cpp", +"pycontext.h", +"pycontext.cpp", +"pyproperties.h", +"pyproperties.cpp", +"pyhandle.h", +"pyhandle.cpp", +"pytoken.h", +"pytoken.cpp", +"pyshared_buffer.h", +"pyshared_buffer.cpp", +"pyevents.h", +"pyevents.cpp", +"pyerrors.h", +"pyerrors.cpp", +"pysysobject.h", +"pysysobject.cpp", +] + +[project.urls] +Homepage = "https://opae.github.io" diff --git a/libraries/pyopae/setup.py b/libraries/pyopae/setup.py index 8927e463627e..c8e7098f94d9 100644 --- a/libraries/pyopae/setup.py +++ b/libraries/pyopae/setup.py @@ -23,6 +23,7 @@ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. + from setuptools import setup, find_namespace_packages from setuptools.command.build_ext import build_ext from distutils.extension import Extension @@ -44,15 +45,6 @@ def override_build_extensions(self): build_ext.build_extensions = override_build_extensions -class pybind_include_dirs(object): - def __init__(self, user=False): - self.user = user - - def __str__(self): - import pybind11 - return pybind11.get_include(self.user) - - extensions = [ Extension("opae.fpga._opae", sources=["pyproperties.cpp", @@ -70,8 +62,7 @@ def __str__(self): include_dirs=[ "@CMAKE_INSTALL_PREFIX@/include", "@OPAE_INCLUDE_PATH@", - pybind_include_dirs(), - pybind_include_dirs(True) + "@pybind11_ROOT@/include" ], libraries=["opae-c", "opae-cxx-core", "uuid"], library_dirs=["@LIBRARY_OUTPUT_PATH@", @@ -80,18 +71,8 @@ def __str__(self): ] setup( - name="opae.fpga", - version="@OPAE_VERSION@", - packages=find_namespace_packages(), - entry_points={ - 'console_scripts': [ - ] - }, - ext_modules=extensions, - install_requires=['pybind11>=@PYOPAE_PYBIND11_VERSION@'], - description="pyopae provides Python bindings around the " - "OPAE C API", - license="BSD3", - keywords="OPAE accelerator fpga bindings", - url="https://opae.github.io", + name='opae.fpga', + version='@OPAE_VERSION@', + packages=find_namespace_packages(), + ext_modules=extensions ) diff --git a/libraries/pyopaeuio/CMakeLists.txt b/libraries/pyopaeuio/CMakeLists.txt index a0c441d0c579..8e3c002f5ba5 100644 --- a/libraries/pyopaeuio/CMakeLists.txt +++ b/libraries/pyopaeuio/CMakeLists.txt @@ -24,29 +24,28 @@ ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ## POSSIBILITY OF SUCH DAMAGE. - if (OPAE_WITH_PYBIND11) - set(INCLUDE_DIRS "${OPAE_INCLUDE_PATH}:${pybind11_ROOT}/include") - set(LINK_DIRS "${LIBRARY_OUTPUT_PATH}") set(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/timestamp) - set(PYUIOFILES "setup.py") - set(PYOPAEUIO_DIST_STAGE_DIR ${CMAKE_CURRENT_BINARY_DIR}/stage) + set(PYFILES + setup.py + pyproject.toml + ) + set(PYDIST_STAGE_DIR ${CMAKE_CURRENT_BINARY_DIR}/stage) - foreach(pyfile ${PYUIOFILES}) - configure_file(${pyfile} ${PYOPAEUIO_DIST_STAGE_DIR}/${pyfile} @ONLY) - endforeach(pyfile ${PYUIOFILES}) + foreach(pyfile ${PYFILES}) + configure_file(${pyfile} ${PYDIST_STAGE_DIR}/${pyfile} @ONLY) + endforeach(pyfile ${PYFILES}) - file(COPY pyopaeuio.cpp DESTINATION ${PYOPAEUIO_DIST_STAGE_DIR}) - file(COPY pyopaeuio.h DESTINATION ${PYOPAEUIO_DIST_STAGE_DIR}) + file(COPY pyopaeuio.cpp DESTINATION ${PYDIST_STAGE_DIR}) + file(COPY pyopaeuio.h DESTINATION ${PYDIST_STAGE_DIR}) add_custom_command( OUTPUT ${OUTPUT} - COMMAND ${PYTHON_EXECUTABLE} setup.py build_ext -I ${INCLUDE_DIRS} -L ${LINK_DIRS} - COMMAND ${PYTHON_EXECUTABLE} setup.py build + COMMAND ${PYTHON_EXECUTABLE} -m pip install --root=${PYDIST_STAGE_DIR}/build . COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT} - WORKING_DIRECTORY ${PYOPAEUIO_DIST_STAGE_DIR} - DEPENDS ${SETUP_PY} ${PKG_FILES} + WORKING_DIRECTORY ${PYDIST_STAGE_DIR} + DEPENDS ${PYFILES} pyopaeuio.cpp pyopaeuio.h ) set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES @@ -54,13 +53,14 @@ if (OPAE_WITH_PYBIND11) "${CMAKE_CURRENT_SOURCE_DIR}/dist" ) - pybind11_add_module(pyopaeuio THIN_LTO pyopaeuio.cpp) + pybind11_add_module(pyopaeuio THIN_LTO ${PYDIST_STAGE_DIR}/pyopaeuio.cpp) target_link_libraries(pyopaeuio PRIVATE opaeuio) add_custom_target(pyopaeuio-build ALL DEPENDS opaeuio pyopaeuio ${OUTPUT}) + opae_python_install( COMPONENT pyopaeuio RECORD_FILE pyopaeuio-install.txt - SOURCE_DIR ${PYOPAEUIO_DIST_STAGE_DIR} + SOURCE_DIR ${PYDIST_STAGE_DIR} RPM_PACKAGE devel) endif(OPAE_WITH_PYBIND11) diff --git a/libraries/pyopaeuio/pyproject.toml b/libraries/pyopaeuio/pyproject.toml new file mode 100644 index 000000000000..20ffbbd1e548 --- /dev/null +++ b/libraries/pyopaeuio/pyproject.toml @@ -0,0 +1,40 @@ +# Copyright(c) 2023, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +[build-system] +requires = ["setuptools>=59.6", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "pyopaeuio" +version = "2.0.1" +description = "pyopaeuio provides Python bindings around the opaeuio" +#readme = "" +license = {text = "BSD-3-Clause"} +requires-python = ">=3.6" + +[project.urls] +Homepage = "https://opae.github.io" diff --git a/libraries/pyopaeuio/setup.py b/libraries/pyopaeuio/setup.py index 38fd22755cb6..f2b63b0c3c03 100644 --- a/libraries/pyopaeuio/setup.py +++ b/libraries/pyopaeuio/setup.py @@ -23,12 +23,11 @@ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -import os + from setuptools import setup, find_packages from setuptools.command.build_ext import build_ext from distutils.extension import Extension - # get the original build_extensions method original_build_extensions = build_ext.build_extensions @@ -45,38 +44,23 @@ def override_build_extensions(self): build_ext.build_extensions = override_build_extensions -class pybind_include_dirs(object): - def __init__(self, user=False): - self.user = user - - def __str__(self): - import pybind11 - return pybind11.get_include(self.user) - - extensions = [ Extension("pyopaeuio", sources=['pyopaeuio.cpp'], language="c++", extra_compile_args=["-std=c++11"], extra_link_args=["-std=c++11"], + include_dirs=[ + "@OPAE_INCLUDE_PATH@", + "@pybind11_ROOT@/include", + ], libraries = ['opaeuio'], - ) + library_dirs=["@LIBRARY_OUTPUT_PATH@"]) ] setup( - name="pyopaeuio", - version="2.0", + name='pyopaeuio', + version='2.0.1', packages=find_packages(), - entry_points={ - 'console_scripts': [ - ] - }, - ext_modules=extensions, - install_requires=['pybind11>=@PYBIND11_VERSION@'], - description="pyopaeuio provides Python bindings around the " - "opaeuio", - license="BSD3", - keywords="opaeuio fpga bindings", - url="https://opae.github.io", + ext_modules=extensions ) diff --git a/opae.spec.fedora b/opae.spec.fedora index cb0bed90ff3d..4610acccd2e5 100644 --- a/opae.spec.fedora +++ b/opae.spec.fedora @@ -150,42 +150,15 @@ for file in %{buildroot}%{_usr}/src/opae/cmake/modules/*; do chmod a+x $file done -prev=$PWD -pushd %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/binaries/opae.io -%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} -popd - -pushd %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/binaries/hssi -%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} -popd - -pushd %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/binaries/fpgadiag -%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} -popd - -pushd %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/%__cmake_builddir/libraries/pyopae/stage -%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} -popd - -pushd %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/%__cmake_builddir/libraries/pyopaeuio/stage -%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} -popd - -pushd %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/python/opae.admin -%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} -popd - -pushd %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/python/pacsign -%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} -popd - -pushd %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/python/packager -%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} -popd - -pushd %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/binaries/ofs.uio -%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} -popd +%{__python3} -m pip install --prefix=/usr --root=%{buildroot} %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/%__cmake_builddir/binaries/opae.io/stage +%{__python3} -m pip install --prefix=/usr --root=%{buildroot} %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/binaries/hssi +%{__python3} -m pip install --prefix=/usr --root=%{buildroot} %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/%__cmake_builddir/binaries/fpgadiag/stage +%{__python3} -m pip install --prefix=/usr --root=%{buildroot} %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/%__cmake_builddir/libraries/pyopae/stage +%{__python3} -m pip install --prefix=/usr --root=%{buildroot} %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/%__cmake_builddir/libraries/pyopaeuio/stage +%{__python3} -m pip install --prefix=/usr --root=%{buildroot} %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/python/opae.admin +%{__python3} -m pip install --prefix=/usr --root=%{buildroot} %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/python/pacsign +%{__python3} -m pip install --prefix=/usr --root=%{buildroot} %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/python/packager +%{__python3} -m pip install --prefix=/usr --root=%{buildroot} %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/binaries/ofs.uio # Make rpmlint happy about install permissions # admin tools @@ -257,7 +230,6 @@ done %config(noreplace) %{_sysconfdir}/opae/opae.cfg* %config(noreplace) %{_sysconfdir}/sysconfig/fpgad.conf* -%{_datadir}/doc/opae.admin/LICENSE %{_unitdir}/fpgad.service %post diff --git a/opae.spec.rhel b/opae.spec.rhel index 088f9d466ea2..6912428601d9 100644 --- a/opae.spec.rhel +++ b/opae.spec.rhel @@ -122,18 +122,9 @@ for file in %{buildroot}%{_usr}/src/opae/cmake/modules/*; do chmod a+x $file done -prev=$PWD -pushd %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/python/opae.admin/ -%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} -popd - -pushd %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/python/pacsign -%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} -popd - -pushd %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/python/packager -%{__python3} setup.py install --single-version-externally-managed --root=%{buildroot} -popd +%{__python3} -m pip install --prefix=/usr --root=%{buildroot} %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/python/opae.admin +%{__python3} -m pip install --prefix=/usr --root=%{buildroot} %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/python/pacsign +%{__python3} -m pip install --prefix=/usr --root=%{buildroot} %{_topdir}/BUILD/%{name}-%{version}-%{opae_release}/python/packager # Make rpmlint happy about install permissions # admin tools @@ -195,7 +186,6 @@ done %config(noreplace) %{_sysconfdir}/opae/opae.cfg* %config(noreplace) %{_sysconfdir}/sysconfig/fpgad.conf* -%{_datadir}/doc/opae.admin/LICENSE %{_unitdir}/fpgad.service %post diff --git a/packaging/opae/deb/rules b/packaging/opae/deb/rules index e1e15875be46..0f6d04da3aa4 100755 --- a/packaging/opae/deb/rules +++ b/packaging/opae/deb/rules @@ -27,13 +27,14 @@ override_dh_auto_configure: dh_auto_configure -- -DCMAKE_INSTALL_PREFIX=/usr -DOPAE_BUILD_PYTHON_DIST=ON -DOPAE_BUILD_FPGABIST=ON override_dh_auto_install: - cd $(CURDIR)/binaries/opae.io && python3 setup.py install --single-version-externally-managed --root=$(CURDIR)/debian/tmp --install-layout=deb && cd $(CURDIR) - cd $(CURDIR)/binaries/hssi && python3 setup.py install --single-version-externally-managed --root=$(CURDIR)/debian/tmp --install-layout=deb && cd $(CURDIR) - cd $(CURDIR)/binaries/ofs.uio && python3 setup.py install --single-version-externally-managed --root=$(CURDIR)/debian/tmp --install-layout=deb && cd $(CURDIR) - cd $(CURDIR)/binaries/fpgadiag && python3 setup.py install --single-version-externally-managed --root=$(CURDIR)/debian/tmp --install-layout=deb && cd $(CURDIR) - cd $(CURDIR)/obj-x86_64-linux-gnu/libraries/pyopae/stage && python3 setup.py install --single-version-externally-managed --root=$(CURDIR)/debian/tmp --install-layout=deb && cd $(CURDIR) - cd $(CURDIR)/obj-x86_64-linux-gnu/libraries/pyopaeuio/stage && python3 setup.py install --single-version-externally-managed --root=$(CURDIR)/debian/tmp --install-layout=deb && cd $(CURDIR) - cd $(CURDIR)/python/opae.admin && python3 setup.py install --single-version-externally-managed --root=$(CURDIR)/debian/tmp --install-layout=deb && cd $(CURDIR) - cd $(CURDIR)/python/pacsign && python3 setup.py install --single-version-externally-managed --root=$(CURDIR)/debian/tmp --install-layout=deb && cd $(CURDIR) - cd $(CURDIR)/python/packager && python3 setup.py install --single-version-externally-managed --root=$(CURDIR)/debian/tmp --install-layout=deb && cd $(CURDIR) + DEB_PYTHON_INSTALL_LAYOUT=deb_system python3 -m pip install --prefix=/usr --root=$(CURDIR)/debian/tmp $(CURDIR)/obj-x86_64-linux-gnu/binaries/opae.io/stage + DEB_PYTHON_INSTALL_LAYOUT=deb_system python3 -m pip install --prefix=/usr --root=$(CURDIR)/debian/tmp $(CURDIR)/binaries/hssi + DEB_PYTHON_INSTALL_LAYOUT=deb_system python3 -m pip install --prefix=/usr --root=$(CURDIR)/debian/tmp $(CURDIR)/binaries/ofs.uio + DEB_PYTHON_INSTALL_LAYOUT=deb_system python3 -m pip install --prefix=/usr --root=$(CURDIR)/debian/tmp $(CURDIR)/obj-x86_64-linux-gnu/binaries/fpgadiag/stage + DEB_PYTHON_INSTALL_LAYOUT=deb_system python3 -m pip install --prefix=/usr --root=$(CURDIR)/debian/tmp $(CURDIR)/obj-x86_64-linux-gnu/libraries/pyopae/stage + DEB_PYTHON_INSTALL_LAYOUT=deb_system python3 -m pip install --prefix=/usr --root=$(CURDIR)/debian/tmp $(CURDIR)/obj-x86_64-linux-gnu/libraries/pyopaeuio/stage + DEB_PYTHON_INSTALL_LAYOUT=deb_system python3 -m pip install --prefix=/usr --root=$(CURDIR)/debian/tmp $(CURDIR)/python/opae.admin + DEB_PYTHON_INSTALL_LAYOUT=deb_system python3 -m pip install --prefix=/usr --root=$(CURDIR)/debian/tmp $(CURDIR)/python/packager + DEB_PYTHON_INSTALL_LAYOUT=deb_system python3 -m pip install --prefix=/usr --root=$(CURDIR)/debian/tmp $(CURDIR)/python/pacsign dh_auto_install + diff --git a/python/opae.admin/LICENSE b/python/opae.admin/LICENSE index 699b608468d0..07bef0d999a6 100644 --- a/python/opae.admin/LICENSE +++ b/python/opae.admin/LICENSE @@ -1,4 +1,4 @@ -Copyright(c) 2019-2020 Intel Corporation +Copyright(c) 2019-2023 Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/python/opae.admin/pyproject.toml b/python/opae.admin/pyproject.toml new file mode 100644 index 000000000000..b6d1d039fa69 --- /dev/null +++ b/python/opae.admin/pyproject.toml @@ -0,0 +1,64 @@ +# Copyright(c) 2023, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +[build-system] +requires = ["setuptools>=59.6", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "opae.admin" +version = "1.4.4" +description = "opae.admin provides Python classes for interfacing with OPAE kernel drivers" +#readme = "" +license = {text = "BSD-3-Clause"} +requires-python = ">=3.6" + +[tool.setuptools] +packages = [ +"opae", +"opae.admin", +"opae.admin.tools", +"opae.admin.utils", +] + +[tool.setuptools.package-data] +"*" = ["LICENSE"] + +[project.scripts] +fpgasupdate = "opae.admin.tools.fpgasupdate:main" +rsu = "opae.admin.tools.rsu:main" +super-rsu = "opae.admin.tools.super_rsu:main" +fpgaflash = "opae.admin.tools.fpgaflash:main" +fpgaotsu = "opae.admin.tools.fpgaotsu:main" +fpgaport = "opae.admin.tools.fpgaport:main" +bitstreaminfo = "opae.admin.tools.bitstream_info:main" +opaevfio = "opae.admin.tools.opaevfio:main" +pci_device = "opae.admin.tools.pci_device:main" +regmap-debugfs = "opae.admin.tools.regmap_debugfs:main" +fpgareg = "opae.admin.tools.fpgareg:main" + +[project.urls] +Homepage = "https://opae.github.io" diff --git a/python/opae.admin/setup.py b/python/opae.admin/setup.py index 30fb9c789c03..acc1ac3410a7 100644 --- a/python/opae.admin/setup.py +++ b/python/opae.admin/setup.py @@ -1,4 +1,4 @@ -# Copyright(c) 2019-2023, Intel Corporation +# Copyright(c) 2023, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -23,11 +23,12 @@ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. + from setuptools import setup, find_namespace_packages setup( - name="opae.admin", - version='1.4.3', + name='opae.admin', + version='1.4.4', packages=find_namespace_packages(include=['opae.*']), entry_points={ 'console_scripts': [ @@ -44,12 +45,4 @@ 'fpgareg = opae.admin.tools.fpgareg:main', ] }, - install_requires=[], - description="opae.admin provides Python classes for interfacing with" - "OPAE kernel drivers", - license="BSD3", - keywords="OPAE accelerator fpga kernel sysfs", - data_files=[('share/doc/opae.admin', - ['LICENSE'])], - url="https://opae.github.io", ) diff --git a/python/packager/pyproject.toml b/python/packager/pyproject.toml new file mode 100644 index 000000000000..4c0a23cfeee5 --- /dev/null +++ b/python/packager/pyproject.toml @@ -0,0 +1,59 @@ +# Copyright(c) 2023, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +[build-system] +requires = ["setuptools>=59.6", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "packager" +version = "1.0.1" +description = "packager provides Python classes for creating Green BitStreams (GBS)" +license = {text = "BSD-3-Clause"} +requires-python = ">=3.4" + +dependencies = [ + "jsonschema>=2.3.0", +] + +[tool.setuptools] +packages = [ +"packager", +"packager.metadata", +"packager.schema", +"packager.tools", +"packager.utils", +] + +[tool.setuptools.package-data] +"*" = ["README", "*.json"] + +[project.scripts] +packager = "packager.tools.packager:main" +afu_json_mgr = "packager.tools.afu_json_mgr:main" + +[project.urls] +Homepage = "https://opae.github.io" diff --git a/python/packager/setup.py b/python/packager/setup.py index 56682130b966..10985fdc6570 100644 --- a/python/packager/setup.py +++ b/python/packager/setup.py @@ -23,11 +23,12 @@ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. + from setuptools import setup, find_packages setup( name="packager", - version='1.0.0', + version='1.0.1', packages=find_packages(), entry_points={ 'console_scripts': [ @@ -36,12 +37,5 @@ ] }, install_requires=['jsonschema>=2.3.0'], - description="packager provides Python classes for creating" - " Green BitStreams (GBS)", - license="BSD3", - keywords="OPAE accelerator GBS AFU", - data_files=[('share/opae/packager', ['README']), - ], - url="https://opae.github.io", include_package_data=True, ) diff --git a/python/pacsign/pyproject.toml b/python/pacsign/pyproject.toml new file mode 100644 index 000000000000..da8bebcd288e --- /dev/null +++ b/python/pacsign/pyproject.toml @@ -0,0 +1,50 @@ +# Copyright(c) 2023, Intel Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +[build-system] +requires = ["setuptools>=59.6", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "pacsign" +version = "1.0.8" +description = "pacsign provides Python classes for interfacing with the OPAE PACSign tool" +readme = "PACSign.md" +license = {text = "BSD-3-Clause"} +requires-python = ">=3.6" + +[tool.setuptools] +packages = [ +"pacsign", +"pacsign.hsm_managers", +"pacsign.hsm_managers.openssl", +] + +[project.scripts] +PACSign = "pacsign.__main__:main" + +[project.urls] +Homepage = "https://opae.github.io" diff --git a/python/pacsign/setup.py b/python/pacsign/setup.py index 71e2b4913f3d..b32499d6c577 100644 --- a/python/pacsign/setup.py +++ b/python/pacsign/setup.py @@ -23,22 +23,16 @@ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. + from setuptools import setup, find_packages setup( name="pacsign", - version="1.0.7", + version="1.0.8", packages=find_packages(), - python_requires='>=3.6', - extra_requires={'pkcs11': ['python-pkcs11']}, - description="pacsign provides Python classes for interfacing with" - "OPAE PACSign tool", entry_points={ 'console_scripts': [ 'PACSign = pacsign.__main__:main', ], }, - license="BSD3", - keywords="OPAE accelerator fpga signing security", - url="https://opae.github.io", )