Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
python and py-slvs
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
whitt
Tux's lil' helper
Tux's lil' helper


Joined: 28 Dec 2020
Posts: 144

PostPosted: Sat Jul 06, 2024 9:19 pm    Post subject: python and py-slvs Reply with quote

OK - I'm going nuts here... I feel like this should have taken ten minutes, but it's taken an hour spread out over the day between other stuff... And I'm no where near solving this.

I'm trying to set up CAD_Sketcher in Blender-4.1. CAD_Sketcher requires py-slvs.

I can't pip-install py-slvs because blah blah it's an externally managed system and I have to use emerge. OK. There is no ebuild for py-slvs, so I download the source and try to make / install it (from here: https://pypi.org/project/py-slvs/#files).

I had to install sudo (cringe) and then scikit-build to get it running, but then I hit a wall when it tries to run py_slvs-1.0.6/scripts/dockcross-manylinux-x64, and 'sudo: docker: command not found'

I tried installing dev-python/docker to see if that'd do it, but nope.

I've also tried installing it inside blender, and all I get is 'Cannot install package: py-slvs' when I try to use pip, or 'Cannot install package: the-whl-file-i-downloaded...'

What am I failing to see here? I don't see much in the way of helpful information here, and am running out of ideas...
Back to top
View user's profile Send private message
salahx
Guru
Guru


Joined: 12 Mar 2005
Posts: 556

PostPosted: Sun Jul 07, 2024 2:48 am    Post subject: Reply with quote

Sounds like you need an ebuild. I have no way of run-testing it, but I was able to get it to compile. Try this (as dev-python/py-slvs-1.0.6.ebuild)
Code:
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8

DISTUTILS_USE_PEP517=setuptools
DISTUTILS_SINGLE_IMPL=1
DISTUTILS_EXT=1
PYTHON_COMPAT=( python3_{10..12} )

inherit distutils-r1 pypi
#
# Eclasses tend to list descriptions of how to use their functions properly.
# Take a look at the eclass/ directory for more examples.

# Short one-line description of this package.
DESCRIPTION="Python Binding of SOLVESPACE Constraint Solver"
HOMEPAGE="https://github.com/realthunder/slvs_py"
SRC_URI="$(pypi_sdist_url "${PN^}" "${PV}")"

#S=${WORKDIR}/${P^}

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"

REQUIRED_USE="( ${PYTHON_REQUIRED_USE} )"

RDEPEND="${PYTHON_DEPS}"
DEPEND="${RDEPEND}"
BDEPEND="dev-lang/swig
dev-python/scikit-build
virtual/pkgconfig"

python_prepare_all() {
   find "${S}/${PN/-/_}/extlib" -mindepth 1 -delete
# We can't rely on PATCHES because order counts
   pushd "${S}/${PN/-/_}" || die
   eapply "${FILESDIR}/${PN}-1.0.6-CMake-remove-deprecated.patch"
   sed   -e '/include(GetGitCommitHash)/ s/^/#/' \
      -e '/^# set(GIT_COMMIT_HASH/ s/^#//' \
      -i CMakeLists.txt || die
   sed -e "s/Python3 REQUIRED/Python3 ${EPYTHON:7} EXACT REQUIRED/" \
   -i "src/swig/python/CMakeLists.txt" || die
   popd || die
   distutils-r1_python_prepare_all
}


You'll need this patch, too: (as files/py-slvs-1.0.6-CMake-remove-deprecated.patch)
Code:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index aa6827a..b52e5cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
 # cmake configuration
 
-cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
-cmake_policy(VERSION 3.1.0)
+cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
+cmake_policy(VERSION 3.14)
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
     "${CMAKE_SOURCE_DIR}/cmake/")
 set(CMAKE_CXX_STANDARD 11)
diff --git a/src/swig/CMakeLists.txt b/src/swig/CMakeLists.txt
index f7aa4bc..ef025ce 100644
--- a/src/swig/CMakeLists.txt
+++ b/src/swig/CMakeLists.txt
@@ -1,7 +1,7 @@
 # Add subdirectories for each language if desired
 option(BUILD_PYTHON "Build Python SWIG module")
 if(BUILD_PYTHON)
-    find_package(SWIG REQUIRED)
+    find_package(SWIG REQUIRED COMPONENTS python)
     include(${SWIG_USE_FILE})
     add_subdirectory(python)
 endif()
diff --git a/src/swig/python/CMakeLists.txt b/src/swig/python/CMakeLists.txt
index 1076e01..86f8481 100644
--- a/src/swig/python/CMakeLists.txt
+++ b/src/swig/python/CMakeLists.txt
@@ -1,22 +1,15 @@
 # Include python
 
 if (${CMAKE_SYSTEM_NAME} STREQUAL Windows)
-    find_package(PythonInterp ${PYTHON_VERSION_MAJOR} REQUIRED)
-    find_package(PythonLibs ${PYTHON_VERSION_MAJOR} REQUIRED)
-    message(STATUS "python version ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
-    message(STATUS "python libraries ${PYTHON_LIBRARIES}")
+    find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
+    message(STATUS "python version ${Python3_VERSION}")
+    message(STATUS "python libraries ${Python3_LIBRARIES}")
 else()
-    find_package(PythonInterp ${PYTHON_VERSION_MAJOR} REQUIRED)
-    set(Python_ADDITIONAL_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
-    message(STATUS "python version ${Python_ADDITIONAL_VERSIONS}")
-    if (NOT DEFINED PYTHON_VERSION_STRING)
-        find_package(PythonLibs REQUIRED)
-    else (NOT DEFINED PYTHON_VERSION_STRING)
-        find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT REQUIRED)
-    endif(NOT DEFINED PYTHON_VERSION_STRING)
+    find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
+    message(STATUS "python version ${Python3_VERSION}")
 endif()
 
-include_directories(${PYTHON_INCLUDE_PATH})
+include_directories(${Python3_INCLUDE_DIRS})
 
 if (WIN32)
    set(PYLIB_SUFFIX .pyd)
@@ -29,19 +22,15 @@ add_definitions(-DSLVS_STATIC_LIB)
 set_source_files_properties(../slvs.i PROPERTIES CPLUSPLUS ON)
 include_directories(../ ../../../include/)
 
-# Add swig module
-if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
-    swig_add_module(slvs python ../slvs.i)
-else()
-    swig_add_library(slvs LANGUAGE python SOURCES ../slvs.i)
-endif()
+swig_add_library(_slvs TYPE SHARED LANGUAGE python SOURCES ../slvs.i)
+set_target_properties(_slvs PROPERTIES OUTPUT_NAME "slvs")
 
 if (APPLE)
-    swig_link_libraries(slvs "-Wl,-undefined,dynamic_lookup" slvs_static_excp)
+    target_link_libraries(slvs PRIVATE "-Wl,-undefined,dynamic_lookup" slvs_static_excp)
 elseif(WIN32)
-    swig_link_libraries(slvs ${PYTHON_LIBRARIES} slvs_static_excp)
+    target_link_libraries(slvs PRIVATE ${Python3_LIBRARIES} slvs_static_excp)
 else ()
-    swig_link_libraries(slvs slvs_static_excp)
+    target_link_libraries(slvs PRIVATE slvs_static_excp)
 endif ()
 
 if (NOT ENABLE_GUI)
@@ -50,3 +39,4 @@ if (NOT ENABLE_GUI)
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/slvs.py DESTINATION py_slvs)
     install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py DESTINATION py_slvs)
 endif( NOT ENABLE_GUI)
+
.
Back to top
View user's profile Send private message
whitt
Tux's lil' helper
Tux's lil' helper


Joined: 28 Dec 2020
Posts: 144

PostPosted: Sun Jul 07, 2024 5:41 pm    Post subject: Reply with quote

Oh - hey - thanks so much!

I unfortunately got impatient and used '--break-system-packages' to get it installed before I saw this.

I'll come back and check this out when I'm motivated to fix it. Really appreciate the effort!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum