Bug 1716526

Summary: python-pystemd fails to build with Python 3.8
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-pystemdAssignee: Miro Hrončok <mhroncok>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: ngompa13
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://copr.fedorainfracloud.org/coprs/g/python/python3.8/package/python-pystemd/
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-04 09:49:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1686977    

Description Miro Hrončok 2019-06-03 14:40:20 UTC
See https://copr.fedorainfracloud.org/coprs/g/python/python3.8/package/python-pystemd/ for actual logs. This report is automated and not very verbose, but feel free to ping me for help.

Comment 1 Neal Gompa 2019-06-03 21:30:53 UTC
Miro, does this commit fix the issue for you? https://github.com/facebookincubator/pystemd/commit/35d1e091f299a8b28f62d8a37d5cc87ec79ddb30

If it does, I can backport this to resolve the issue.

Comment 2 Miro Hrončok 2019-06-03 21:39:55 UTC
Looks reasonable. Will test.

Comment 3 Miro Hrončok 2019-06-03 21:42:18 UTC
May I push this (if it works)?

diff --git a/python-pystemd.spec b/python-pystemd.spec
index 18abd45..3d7ab50 100644
--- a/python-pystemd.spec
+++ b/python-pystemd.spec
@@ -13,6 +13,9 @@ License:        LGPLv2+
 URL:            https://github.com/facebookincubator/pystemd
 Source0:        https://files.pythonhosted.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
 
+# Python 3.8 support:
+Patch0:         %{url}/commit/35d1e091f299a8b28f62d8a37d5cc87ec79ddb30.patch
+
 BuildRequires:  gcc
 BuildRequires:  pkgconfig(libsystemd)
 BuildRequires:  python3-devel
@@ -41,7 +44,7 @@ service status from systemd point of view, avoiding subprocessing systemctl
 and then parsing the output to know the result.
 
 %prep
-%autosetup -n %{pypi_name}-%{version}
+%autosetup -n %{pypi_name}-%{version} -p1
 # Remove bundled egg-info
 rm -rf %{pypi_name}.egg-info

Comment 4 Miro Hrončok 2019-06-03 21:51:39 UTC
It fixes the issue, but there is another one:

pystemd/dbuslib.c:19315:15: note: in expansion of macro ‘__Pyx_PyCode_New’
19315 |     py_code = __Pyx_PyCode_New(
      |               ^~~~~~~~~~~~~~~~
In file included from /usr/include/python3.8/compile.h:5,
                 from /usr/include/python3.8/Python.h:137,
                 from pystemd/dbuslib.c:20:
/usr/include/python3.8/code.h:105:28: note: declared here
  105 | PyAPI_FUNC(PyCodeObject *) PyCode_New(
      |                            ^~~~~~~~~~
At top level:
pystemd/dbuslib.c:14108:14: warning: ‘__pyx_f_7pystemd_7dbuslib_path_decode’ defined but not used [-Wunused-function]
14108 | static char *__pyx_f_7pystemd_7dbuslib_path_decode(char *__pyx_v_path, char *__pyx_v_prefix) {
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: command 'gcc' failed with exit status 1


This means you need to recythonize the sources.

See the following examples:

https://src.fedoraproject.org/rpms/python-compreffor/pull-request/1
https://src.fedoraproject.org/rpms/python-http-parser/pull-request/2
https://src.fedoraproject.org/rpms/python-llfuse/pull-request/4
https://src.fedoraproject.org/rpms/python-pybloomfiltermmap/pull-request/1
https://src.fedoraproject.org/rpms/python-pykdtree/pull-request/1
https://src.fedoraproject.org/rpms/python-sep/pull-request/1
https://src.fedoraproject.org/rpms/python-shapely/pull-request/4
https://src.fedoraproject.org/rpms/python-ssh2-python/pull-request/1

Comment 5 Neal Gompa 2019-06-04 02:09:53 UTC
Miro, feel free to go ahead and do what's needed to make this work in rawhide. :)