#1 Add Python3 Support
Closed 5 years ago by hobbes1069. Opened 6 years ago by troycurtisjr.
https://gitlab.com/troycurtisjr/fedora-pkg-libftdi.git python3-support  into  master

Build the python3 bindings and add a subpackage for them.
Troy Curtis Jr • 6 years ago  
libftdi-python-version.patch
file removed
-13
@@ -1,13 +0,0 @@

- --- python/CMakeLists.txt~	2016-05-20 01:53:12.000000000 -0500

- +++ python/CMakeLists.txt	2016-06-14 14:07:30.001554507 -0500

- @@ -12,8 +12,8 @@

-        set ( SWIG_FOUND TRUE )

-      endif ()

-    endif ()

- -  find_package ( PythonLibs )

- -  find_package ( PythonInterp )

- +  find_package ( PythonLibs 2.7 REQUIRED )

- +  find_package ( PythonInterp 2.7 REQUIRED )

-  endif ()

-  

-  if ( SWIG_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND )

libftdi.spec
file modified
+45 -7
@@ -1,13 +1,12 @@

  Name:		libftdi

  Version:	1.3

- Release:	9%{?dist}

+ Release:	10%{?dist}

  Summary:	Library to program and control the FTDI USB controller

  

  Group:		System Environment/Libraries

  License:	LGPLv2

  URL:		http://www.intra2net.com/de/produkte/opensource/ftdi/

  Source0:	http://www.intra2net.com/en/developer/%{name}/download/%{name}1-%{version}.tar.bz2

- Patch0:		libftdi-python-version.patch

  

  BuildRequires:	boost-devel

  BuildRequires:	cmake
@@ -15,7 +14,9 @@

  BuildRequires:	libconfuse-devel

  BuildRequires:	libusbx-devel

  BuildRequires:	python2-devel

+ BuildRequires:	python3-devel

  BuildRequires:	swig

+ BuildRequires:	gcc-c++

  Requires:	systemd

  

  
@@ -27,6 +28,7 @@

  Summary:	Header files and static libraries for libftdi

  Group:		Development/Libraries

  Requires:	%{name}%{?_isa} = %{version}-%{release}

+ Requires:	python3-%{name}%{?_isa} = %{version}-%{release}

  Requires:	pkgconfig

  

  %description devel
@@ -45,6 +47,15 @@

  %description -n python2-libftdi

  Libftdi Python Language bindings.

  

+ %package -n python3-libftdi

+ %{?python_provide:%python_provide python3-libftdi}

+ Summary:	Libftdi library Python 3 binding

+ Group:		Development/Libraries

+ Requires:	%{name}%{?_isa} = %{version}-%{release}

+ 

+ %description -n python3-libftdi

+ Libftdi Python 3 Language bindings.

+ 

  %package c++

  Summary:	Libftdi library C++ binding

  Group:		Development/Libraries
@@ -67,21 +78,37 @@

  %prep

  %setup -q -n %{name}1-%{version}

  

- %patch0 -p0

- 

  #kernel does not provide usb_device anymore

  sed -i -e 's/usb_device/usb/g' packages/99-libftdi.rules

  sed -i -e 's/GROUP="plugdev"/TAG+="uaccess"/g' packages/99-libftdi.rules

  

  %build

  export CMAKE_PREFIX_PATH=/usr

- %{cmake} .

  

+ mkdir build-py2

+ pushd build-py2

+ %{cmake} -DPython_ADDITIONAL_VERSIONS=%{python2_version} ..

  make %{?_smp_mflags}

+ popd

  

+ mkdir build-py3

+ pushd build-py3

+ %{cmake} -DPython_ADDITIONAL_VERSIONS=%{python3_version} ..

+ make %{?_smp_mflags}

+ popd

+ 

+ # Fix python sheband lines

+ find python/examples -type f -exec sed -i '1s=^#!/usr/bin/\(python\|env python\)[23]\?=#!%{__python3}=' {} +

  

  %install

+ # Install python2, since we'll prefer python3 with the second install.

+ pushd build-py2

+ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"

+ popd

+ 

+ pushd build-py3

  make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"

+ popd

  

  mkdir -p $RPM_BUILD_ROOT/lib/udev/rules.d/

  install -p -m 644 packages/99-libftdi.rules $RPM_BUILD_ROOT/lib/udev/rules.d/69-libftdi.rules
@@ -91,7 +118,7 @@

  

  #no man install

  mkdir -p $RPM_BUILD_ROOT%{_mandir}/man3

- install -p -m 644 doc/man/man3/*.3 $RPM_BUILD_ROOT%{_mandir}/man3

+ install -p -m 644 build-py3/doc/man/man3/*.3 $RPM_BUILD_ROOT%{_mandir}/man3

  

  # Cleanup examples

  rm -f $RPM_BUILD_ROOT/%{_bindir}/simple
@@ -120,7 +147,7 @@

  /lib/udev/rules.d/69-libftdi.rules

  

  %files devel

- %doc doc/html

+ %doc build-py3/doc/html

  %doc %{_datadir}/libftdi/examples

  %{_bindir}/ftdi_eeprom

  %{_bindir}/libftdi1-config
@@ -128,10 +155,16 @@

  %{_includedir}/libftdi1

  %{_libdir}/pkgconfig/libftdi1.pc

  %{_mandir}/man3/*

+ # Don't include byte-compiled files for python scripts.

+ %exclude %{_datadir}/libftdi/examples/*.pyc

+ %exclude %{_datadir}/libftdi/examples/*.pyo

  

  %files -n python2-libftdi

  %{python2_sitearch}/*

  

+ %files -n python3-libftdi

+ %{python3_sitearch}/*

+ 

  %files c++

  %{_libdir}/libftdipp1.so.2*

  
@@ -147,6 +180,11 @@

  %postun c++ -p /sbin/ldconfig

  

  %changelog

+ * Mon Oct 09 2017 Troy Curtis, Jr <troycurtisjr@gmail.com> - 1.3-10

+ - Add python3 subpackage.

+ - Drop patch0 in favor of built-in cmake config methods.

+ - Don't include bytecompiled files for the example python scripts.

+ 

  * Sun Aug 20 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.3-9

  - Add Provides for the old name without %%_isa

  

no initial comment

In addition to the python2 bindings, build the python3 bindings and create a subpackage to hold them. Addresses bz #1323250.

I'm not the primary maintainer so I completely forgot about this pull request, sorry. I pretty much implemented the same changes (and some other FTBFS issues). This has been built for f30. Do you need this in f28 for f29?

Pull-Request has been closed by hobbes1069

5 years ago