diff --git a/openbabel-python-dl.patch b/openbabel-python-dl.patch new file mode 100644 index 0000000..2c3c5f7 --- /dev/null +++ b/openbabel-python-dl.patch @@ -0,0 +1,15 @@ +diff -up openbabel-openbabel-2-4-1/scripts/CMakeLists.txt.py3 openbabel-openbabel-2-4-1/scripts/CMakeLists.txt +--- openbabel-openbabel-2-4-1/scripts/CMakeLists.txt.py3 2019-03-04 11:12:54.369464503 +0100 ++++ openbabel-openbabel-2-4-1/scripts/CMakeLists.txt 2019-03-04 11:59:39.323264995 +0100 +@@ -84,7 +84,10 @@ if (DO_PYTHON_BINDINGS) + COMMAND ${CMAKE_COMMAND} -E echo " try:" >> ob.py + COMMAND ${CMAKE_COMMAND} -E echo " import dl" >> ob.py + COMMAND ${CMAKE_COMMAND} -E echo " except ImportError:" >> ob.py +- COMMAND ${CMAKE_COMMAND} -E echo " import DLFCN as dl" >> ob.py ++ COMMAND ${CMAKE_COMMAND} -E echo " try:" >> ob.py ++ COMMAND ${CMAKE_COMMAND} -E echo " import DLFCN as dl" >> ob.py ++ COMMAND ${CMAKE_COMMAND} -E echo " except ImportError:" >> ob.py ++ COMMAND ${CMAKE_COMMAND} -E echo " import ctypes as dl" >> ob.py + COMMAND ${CMAKE_COMMAND} -E echo " sys.setdlopenflags(sys.getdlopenflags() | dl.RTLD_GLOBAL)" >> ob.py + COMMAND cat ${openbabel_SOURCE_DIR}/scripts/python/openbabel.py >> ob.py + COMMAND ${CMAKE_COMMAND} -E copy ob.py ${openbabel_SOURCE_DIR}/scripts/python/openbabel.py diff --git a/openbabel-taberror.patch b/openbabel-taberror.patch new file mode 100644 index 0000000..116ea1b --- /dev/null +++ b/openbabel-taberror.patch @@ -0,0 +1,32 @@ +diff -up openbabel-openbabel-2-4-1/test/testpdbformat.py.taberror openbabel-openbabel-2-4-1/test/testpdbformat.py +--- openbabel-openbabel-2-4-1/test/testpdbformat.py.taberror 2016-10-10 17:56:17.000000000 +0200 ++++ openbabel-openbabel-2-4-1/test/testpdbformat.py 2019-03-04 11:09:24.786801658 +0100 +@@ -24,12 +24,12 @@ class TestPDBFormat(BaseTest): + + def testInsertionCodes(self): + """ +- Testing a PDB entry with insertion codes to distinguish residues +- upon conversion to FASTA. ++ Testing a PDB entry with insertion codes to distinguish residues ++ upon conversion to FASTA. + """ + self.canFindExecutable("babel") + +- self.entryPDBwithInsertioncodes="""ATOM 406 N VAL L 29 58.041 17.797 48.254 1.00 0.00 N ++ self.entryPDBwithInsertioncodes="""ATOM 406 N VAL L 29 58.041 17.797 48.254 1.00 0.00 N + ATOM 407 CA VAL L 29 57.124 18.088 47.170 1.00 0.00 C + ATOM 408 C VAL L 29 55.739 17.571 47.538 1.00 0.00 C + ATOM 409 O VAL L 29 55.535 16.362 47.550 1.00 0.00 O +@@ -100,9 +100,9 @@ ATOM 473 HE1 TYR L 32 48.512 + ATOM 474 HE2 TYR L 32 48.145 19.172 44.648 1.00 0.00 H + ATOM 475 HH TYR L 32 46.462 17.658 44.280 1.00 0.00 H + """ +- output, error = run_exec(self.entryPDBwithInsertioncodes, +- "babel -ipdb -ofasta") +- self.assertEqual(output.rstrip().rsplit("\n",1)[1], "VSSSY") ++ output, error = run_exec(self.entryPDBwithInsertioncodes, ++ "babel -ipdb -ofasta") ++ self.assertEqual(output.rstrip().rsplit("\n",1)[1], "VSSSY") + + if __name__ == "__main__": + testsuite = [] diff --git a/openbabel.spec b/openbabel.spec index 5d2a718..d135844 100644 --- a/openbabel.spec +++ b/openbabel.spec @@ -2,14 +2,13 @@ %global shortcommit %(c=%{commit}; echo ${c:0:7}) %{!?perl_vendorarch:%global perl_vendorarch %(eval "`perl -V:installvendorarch`"; echo $installvendorarch)} -%{!?python2_sitearch:%global python2_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} # we don't want to provide private Perl or Python extension libs -%global __provides_exclude_from ^(%{perl_vendorarch}/auto|%{python2_sitearch}|%{python3_sitearch})/.*\\.so$ +%global __provides_exclude_from ^(%{perl_vendorarch}/auto|%{python3_sitearch})/.*\\.so$ Name: openbabel Version: 2.4.1 -Release: 20%{?dist} +Release: 21%{?dist} Summary: Chemistry software file format converter License: GPLv2 URL: https://openbabel.org/ @@ -35,7 +34,13 @@ Patch9: openbabel-narrowing-conversion.patch Patch10: openbabel-fix-libdir-in-pkgconfig.patch # Math 4 test is failing on s390x only Patch11: openbabel-disable-tests-s390x.patch +# Fix inconsistent whitespace +Patch12: openbabel-taberror.patch +# Fix import of dl module in python3.7 +# https://github.com/openbabel/openbabel/pull/372 +Patch13: openbabel-python-dl.patch BuildRequires: cmake +BuildRequires: dos2unix BuildRequires: desktop-file-utils BuildRequires: eigen3-devel BuildRequires: gcc-c++ @@ -109,15 +114,6 @@ BuildRequires: perl-generators %description -n perl-%{name} Perl wrapper for the Open Babel library. -%package -n python2-%{name} -Summary: Python wrapper for the Open Babel library -Requires: %{name}-libs%{?_isa} = %{version}-%{release} -BuildRequires: python2-devel -%{?python_provide:%python_provide python2-%{name}} - -%description -n python2-%{name} -Python2 wrapper for the Open Babel library. - %package -n python3-%{name} Summary: Python wrapper for the Open Babel library Requires: %{name}-libs%{?_isa} = %{version}-%{release} @@ -150,6 +146,15 @@ Ruby wrapper for the Open Babel library. %endif %patch9 -p1 -b .nc %patch10 -p1 +%patch12 -p1 -b .taberr +%patch13 -p1 -b .py3dl +# convert to Unix line endings +dos2unix -k \ + data/chemdrawcdx.h \ + include/openbabel/{tautomer.h,math/align.h} \ + src/math/align.cpp \ + test/testsmartssym.py \ + convert src/GUI/babel.xpm -transparent white babel.png # Remove duplicate html files @@ -162,19 +167,12 @@ for man in *.1; do done popd -mkdir python3 -for f in *; do - if [ "$f" != "python3" ]; then - cp -a $f python3/ - fi -done - %build %cmake \ -DCMAKE_SKIP_RPATH:BOOL=ON \ -DBUILD_GUI:BOOL=ON \ -DPYTHON_BINDINGS:BOOL=ON \ - -DPYTHON_EXECUTABLE=%{__python2} \ + -DPYTHON_EXECUTABLE=%{__python3} \ -DPERL_BINDINGS:BOOL=ON \ -DRUBY_BINDINGS:BOOL=ON \ -DOPENBABEL_USE_SYSTEM_INCHI=true \ @@ -185,32 +183,8 @@ done . make VERBOSE=1 %{?_smp_mflags} -BUILD_DIR=$PWD -pushd python3 -%cmake \ - -DCMAKE_SKIP_RPATH:BOOL=ON \ - -DBUILD_GUI:BOOL=OFF \ - -DPYTHON_BINDINGS:BOOL=ON \ - -DPYTHON_EXECUTABLE=%{__python3} \ - -DPERL_BINDINGS:BOOL=OFF \ - -DRUBY_BINDINGS:BOOL=OFF \ - -DOPENBABEL_USE_SYSTEM_INCHI=true \ - -DENABLE_VERSIONED_FORMATS=false \ - -DRUN_SWIG=true \ - -DENABLE_TESTS:BOOL=OFF \ - -DOPTIMIZE_NATIVE=OFF \ - -DBINDINGS_ONLY:BOOL=ON \ - -DBABEL_SYSTEM_LIBRARY=$BUILD_DIR/%{_lib}/libopenbabel.so \ - . -make VERBOSE=1 %{?_smp_mflags} bindings_python -popd - %install make VERBOSE=1 DESTDIR=%{buildroot} install -pushd python3 -export DESTDIR=%{buildroot} -%cmake -DCOMPONENT=bindings_python -P cmake_install.cmake -popd rm %{buildroot}%{_libdir}/cmake/openbabel2/*.cmake @@ -221,8 +195,8 @@ install -Dpm644 babel.png %{buildroot}%{_datadir}/pixmaps/babel.png %check # rm the built ruby bindings for testsuite to succeed (bug #1191173) rm %{_lib}/openbabel.so -export CTEST_OUTPUT_ON_FAILURE=1 -make test +export CTEST_OUTPUT_ON_FAILURE=1 PYTHONPATH=%{buildroot}%{python3_sitearch} +%make_build test %endif %ldconfig_scriptlets libs @@ -259,13 +233,6 @@ make test %dir %{perl_vendorarch}/*/Chemistry/OpenBabel %{perl_vendorarch}/*/Chemistry/OpenBabel/OpenBabel.so -%files -n python2-%{name} -%{python2_sitearch}/_openbabel.so -%{python2_sitearch}/openbabel.py* -%{python2_sitearch}/pybel.py* -# Egg-info is not generated in 2.3.2, see upstream bug 837 -#%%{python_sitearch}/openbabel*.egg-info - %files -n python3-%{name} %{python3_sitearch}/_openbabel.so %{python3_sitearch}/openbabel.py @@ -276,6 +243,11 @@ make test %{ruby_vendorarchdir}/openbabel.so %changelog +* Fri Mar 01 2019 Dominik Mierzejewski - 2.4.1-21 +- drop python2 subpackage (#1648558) +- fix running the testsuite with python3 +- fix line endings for some source files + * Fri Feb 01 2019 Fedora Release Engineering - 2.4.1-20 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild