[med-svn] [Git][med-team/librcsb-core-wrapper][master] Preliminary, not finally working changes to build properly
Andreas Tille (@tille)
gitlab at salsa.debian.org
Thu Sep 10 12:16:15 BST 2026
Andreas Tille pushed to branch master at Debian Med / librcsb-core-wrapper
Commits:
6996e207 by Andreas Tille at 2026-09-10T13:15:43+02:00
Preliminary, not finally working changes to build properly
- - - - -
5 changed files:
- debian/patches/fix-makefile.patch
- debian/patches/series
- − debian/patches/setup.py.in
- debian/rules
- + debian/wrapper_setup/setup.py.in
Changes:
=====================================
debian/patches/fix-makefile.patch
=====================================
@@ -14,3 +14,29 @@ Description: Salsa CI fails due to missing dir - just create it
cp -f -t $(M_LIB_DIR) $(addprefix $(OBJ_DIR)/,$(OBJ_FILES) $(OBJ_FILES:.o=.lo))
mkdir -p $(M_LIB_DIR)/.libs && cp -f -t $(M_LIB_DIR)/.libs $(addprefix $(OBJ_DIR)/.libs/,$(OBJ_FILES))
$(RANLIB) $@
+--- a/wrapper/Makefile
++++ b/wrapper/Makefile
+@@ -18,11 +18,11 @@ VPATH = $(OBJ_DIR)
+
+ EXT_COMP_OPT = -ftemplate-depth-128 -fno-inline -Wall
+
+-EXT_INCLS_DIRS = -I$(WWPDB_PYTHON_INC) -I$(WWPDB_BOOST_INC)
+-EXT_LIBS_DIRS = -L$(WWPDB_PYTHON_LIB_DIR) -L$(WWPDB_BOOST_PYTHON_LIB_DIR) \
+- -L$(WWPDB_XERCESC_LIB_DIR)
+-EXT_LIBS = -l$(WWPDB_PYTHON_LIB) -l$(WWPDB_BOOST_PYTHON_LIB) \
+- -l$(WWPDB_XERCESC_LIB)
++EXT_INCLS_DIRS = $(if $(WWPDB_PYTHON_INC),-I$(WWPDB_PYTHON_INC)) $(if $(WWPDB_BOOST_INC),-I$(WWPDB_BOOST_INC))
++EXT_LIBS_DIRS = $(if $(WWPDB_PYTHON_LIB_DIR),-L$(WWPDB_PYTHON_LIB_DIR)) $(if $(WWPDB_BOOST_PYTHON_LIB_DIR),-L$(WWPDB_BOOST_PYTHON_LIB_DIR)) \
++ $(if $(WWPDB_XERCESC_LIB_DIR),-L$(WWPDB_XERCESC_LIB_DIR))
++EXT_LIBS = $(if $(WWPDB_PYTHON_LIB),-l$(WWPDB_PYTHON_LIB)) $(if $(WWPDB_BOOST_PYTHON_LIB),-l$(WWPDB_BOOST_PYTHON_LIB)) \
++ $(if $(WWPDB_XERCESC_LIB),-l$(WWPDB_XERCESC_LIB))
+
+ SYS_LIBS = -lutil -lpthread -ldl
+
+@@ -147,5 +147,6 @@ $(L_MOD_LIB): $(OBJ_FILES) $(ALL_DEP_LIB
+
+ # Rule for making object files
+ %.o: $(SRC_DIR)/%.C
++ @mkdir -p $(OBJ_DIR)
+ $(CCC) $(CPPFLAGS) $(C++FLAGS) $(EXT_COMP_OPT) -c $< -o $(OBJ_DIR)/$@
+
=====================================
debian/patches/series
=====================================
@@ -6,7 +6,7 @@ devnull-log
docs
objectfiles
parallel-build
-setup.py.in
+# setup.py.in
hardening
spelling
exit-in-shlib
@@ -21,3 +21,4 @@ INSTALL-is-cifinstall.patch
make-4.4.1.patch
make-shuffle-reverse.patch
fix-makefile.patch
+# make-wrapper.patch
=====================================
debian/patches/setup.py.in deleted
=====================================
@@ -1,98 +0,0 @@
-Author: Laszlo Kajan <lkajan at rostlab.org>
-Description: python build system
-Forwarded: http://lists.alioth.debian.org/pipermail/debian-med-packaging/2012-August/016975.html
---- /dev/null
-+++ librcsb-core-wrapper/wrapper/python/setup.py.in
-@@ -0,0 +1,49 @@
-+#!/usr/bin/python3
-+
-+from distutils import sysconfig
-+from distutils.core import setup, Extension
-+import os
-+import platform
-+import sys
-+
-+# lkajan: we follow the example of libtorrent-rasterbar here - thank you very much for that!
-+def parse_cmd(cmdline, prefix, keep_prefix = False):
-+ ret = []
-+ for token in cmdline.split():
-+ if token[:len(prefix)] == prefix:
-+ if keep_prefix:
-+ ret.append(token)
-+ else:
-+ ret.append(token[len(prefix):])
-+ return ret
-+
-+config_vars = sysconfig.get_config_vars()
-+if "CFLAGS" in config_vars and "-Wstrict-prototypes" in config_vars["CFLAGS"]:
-+ config_vars["CFLAGS"] = config_vars["CFLAGS"].replace("-Wstrict-prototypes", " ")
-+if "OPT" in config_vars and "-Wstrict-prototypes" in config_vars["OPT"]:
-+ config_vars["OPT"] = config_vars["OPT"].replace("-Wstrict-prototypes", " ")
-+
-+source_list = os.listdir(os.path.join(os.path.dirname(__file__), "src"))
-+source_list = [os.path.join("src", s) for s in source_list if s.endswith(".C")]
-+
-+# g++ -O -fPIC -ansi -Werror -Wall -Wno-deprecated -DHAVE_STRCASECMP -DINCL_TEMPLATE_SRC -DHAVE_PLACEMENT_NEW -I./include -I../include -I/usr/include/python3.7 -I/apps/boost/include/boost-1_41 -ftemplate-depth-128 -fno-inline -Wall -c src/TypeCodePyWrap.C -o ./obj/TypeCodePyWrap.o
-+# g++ -shared -L/apps/boost/lib -L/apps/xerces-3.0.1/lib TypeCodePyWrap.o StlPyWrap.o CharPyWrap.o RcsbFilePyWrap.o ISTablePyWrap.o TableFilePyWrap.o CifFilePyWrap.o DicFilePyWrap.o DictObjFilePyWrap.o DataInfoPyWrap.o CifDataInfoPyWrap.o DictDataInfoPyWrap.o PdbMlFilePyWrap.o CorePyWrap.o -L../../lib/.libs -lrcsb-core-wrapper -lboost_python-mt-py27 -lxerces-c -lutil -lpthread -ldl -o ../lib/CorePyWrap.so
-+extra_cmd = '@DEFINES@'
-+
-+setup( name='python-corepywrap',
-+ version='1.000',
-+ author = 'RCSB PDB Software Team',
-+ author_email='sw-help at rcsb.rutgers.edu',
-+ description = 'Python bindings for librcsb-core-wrapper',
-+ long_description = 'Python bindings for librcsb-core-wrapper',
-+ url = 'http://sw-tools.rcsb.org/apps/CORE-WRAPPER/index.html',
-+ platforms = 'any',
-+ license = 'RCSB PDB SOFTWARE LICENSE AGREEMENT',
-+ ext_modules = [Extension('CorePyWrap',
-+ sources = source_list,
-+ language='c++',
-+ include_dirs = ['../../include'] + parse_cmd(extra_cmd, '-I'),
-+ library_dirs = ['../../lib/.libs'] + parse_cmd(extra_cmd, '-L'),
-+ extra_compile_args = parse_cmd(extra_cmd, '-D', True),
-+ libraries = ['rcsb-core-wrapper', 'boost_python%1d%1d' % ( sys.version_info[0], sys.version_info[1] )] + parse_cmd(extra_cmd, '-l'))],
-+)
---- librcsb-core-wrapper.orig/wrapper/Makefile
-+++ librcsb-core-wrapper/wrapper/Makefile
-@@ -103,11 +103,16 @@
- .PHONY: ../etc/Makefile.platform all install export clean clean_build
-
-
--all: install
-+all: build
-
-+.PHONY: build
-+build: python/setup.py
-
- install: $(M_MOD_LIB)
-
-+python/setup.py: python/setup.py.in
-+ sed -e 's!@C++FLAGS@!$(C++FLAGS)!g; s!@DEFINES@!$(DEFINES)!g; s!@EXT_COMP_OPT@!$(EXT_COMP_OPT)!; s!@EXT_LIBS_DIRS@!$(EXT_LIBS_DIRS)!g; s!@EXT_LIBS@!$(EXT_LIBS)!g;' < "$<" > "$@"
-+ ln -sf ../src python/src
-
- export:
- mkdir -p $(EXPORT_DIR)
-@@ -137,6 +142,7 @@
- @rm -f $(M_MOD_LIB)
- @rm -f $(M_AGR_LIB)
- @rm -f *.pyc
-+ @rm -f python/setup.py
-
-
- $(L_MOD_LIB): $(OBJ_FILES) $(ALL_DEP_LIBS)
---- librcsb-core-wrapper.orig/Makefile
-+++ librcsb-core-wrapper/Makefile
-@@ -12,7 +12,11 @@
- CLEAN_DOC_SCRIPT = clean_doc.sh
- EXPORT_SCRIPT = export.sh
-
--all: lib/librcsb-core-wrapper.la
-+all: wrapper
-+
-+.PHONY: wrapper
-+wrapper: lib/librcsb-core-wrapper.la
-+ cd wrapper && $(MAKE) OPT=-O
-
- compile:
- @echo
=====================================
debian/rules
=====================================
@@ -21,7 +21,16 @@ override_dh_auto_build-nopy:
PATH="$(CURDIR)/debian/build-libtool:$$PATH" dh_auto_build --no-parallel
$(MAKE) doc
+PYTHON_INC := $(shell python3 -c "import sysconfig; print(sysconfig.get_path('include'))")
+BOOST_PYTHON_LIB := boost_python$(shell python3 -c "import sys; print(f'{sys.version_info.major}{sys.version_info.minor}')")
+
override_dh_auto_build-py: override_dh_auto_build-nopy
+ mkdir -p wrapper/python
+ cp -a debian/wrapper_setup/setup.py.in wrapper/python
+ cd wrapper && $(MAKE) OPT=-O \
+ WWPDB_PYTHON_INC="$(PYTHON_INC)" WWPDB_BOOST_INC="/usr/include/boost" \
+ WWPDB_BOOST_PYTHON_LIB="$(BOOST_PYTHON_LIB)" \
+ WWPDB_XERCESC_LIB="xerces-c" WWPDB_XERCESC_LIB_DIR="/usr/lib/$(DEB_HOST_MULTIARCH)"
dh_auto_build --sourcedirectory=wrapper/python --buildsystem=pybuild
override_dh_auto_install: override_dh_auto_install-nopy override_dh_auto_install-py
=====================================
debian/wrapper_setup/setup.py.in
=====================================
@@ -0,0 +1,62 @@
+#!/usr/bin/python3
+
+from distutils import sysconfig
+from distutils.core import setup, Extension
+import os
+import platform
+import sys
+import subprocess
+
+# lkajan: we follow the example of libtorrent-rasterbar here - thank you very much for that!
+def parse_cmd(cmdline, prefix, keep_prefix = False):
+ ret = []
+ for token in cmdline.split():
+ if token[:len(prefix)] == prefix:
+ if keep_prefix:
+ ret.append(token)
+ else:
+ ret.append(token[len(prefix):])
+ return ret
+
+config_vars = sysconfig.get_config_vars()
+if "CFLAGS" in config_vars and "-Wstrict-prototypes" in config_vars["CFLAGS"]:
+ config_vars["CFLAGS"] = config_vars["CFLAGS"].replace("-Wstrict-prototypes", " ")
+if "OPT" in config_vars and "-Wstrict-prototypes" in config_vars["OPT"]:
+ config_vars["OPT"] = config_vars["OPT"].replace("-Wstrict-prototypes", " ")
+
+source_list = os.listdir(os.path.join(os.path.dirname(__file__), "src"))
+source_list = [os.path.join("src", s) for s in source_list if s.endswith(".C")]
+_here = os.path.dirname(os.path.abspath(__file__))
+_project_root = os.path.join(_here, "..", "..")
+
+# Get Python includes from python3-config
+try:
+ python_includes = subprocess.check_output(['python3-config', '--includes'],
+ universal_newlines=True).strip()
+except (subprocess.CalledProcessError, FileNotFoundError):
+ # Fallback: use sysconfig
+ python_includes = f"-I{sysconfig.get_python_inc()}"
+ plat_inc = sysconfig.get_python_inc(plat_specific=True)
+ if plat_inc != sysconfig.get_python_inc():
+ python_includes += f" -I{plat_inc}"
+
+# Only parse -I flags from python_includes
+include_dirs = [os.path.join(_project_root, 'include')] + parse_cmd(python_includes, '-I')
+
+setup( name='python-corepywrap',
+ version='1.000',
+ author = 'RCSB PDB Software Team',
+ author_email='sw-help at rcsb.rutgers.edu',
+ description = 'Python bindings for librcsb-core-wrapper',
+ long_description = 'Python bindings for librcsb-core-wrapper',
+ url = 'http://sw-tools.rcsb.org/apps/CORE-WRAPPER/index.html',
+ platforms = 'any',
+ license = 'RCSB PDB SOFTWARE LICENSE AGREEMENT',
+ ext_modules = [Extension('CorePyWrap',
+ sources = source_list,
+ language='c++',
+ include_dirs = include_dirs,
+ library_dirs = [os.path.join(_project_root, 'lib', '.libs')],
+ extra_compile_args = [],
+ libraries = ['rcsb-core-wrapper', 'boost_python%1d%1d' % ( sys.version_info[0], sys.version_info[1] )])],
+)
View it on GitLab: https://salsa.debian.org/med-team/librcsb-core-wrapper/-/commit/6996e2070f24bb236fdc07dfd0c25a173e7aa5bf
--
View it on GitLab: https://salsa.debian.org/med-team/librcsb-core-wrapper/-/commit/6996e2070f24bb236fdc07dfd0c25a173e7aa5bf
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20260910/9ee341b4/attachment-0001.htm>
More information about the debian-med-commit
mailing list