File gcc-python-plugin.spec of Package gcc-python-plugin
#
# spec file for package gcc-python-plugin
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global gcc_plugins_dir %(gcc --print-file-name=plugin)
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: gcc-python-plugin
Version: 0.17
Release: 0
Summary: GCC plugin that embeds Python
License: GPL-3.0-or-later
Group: Development/Languages/Python
URL: https://gcc-python-plugin.readthedocs.io/en/latest/index.html
Source0: https://github.com/davidmalcolm/gcc-python-plugin/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM pretty_printer.patch
Patch0: pretty_printer.patch
BuildRequires: %{python_module Pygments}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module lxml}
BuildRequires: %{python_module six}
BuildRequires: gcc-c++
###BuildRequires: gcc-devel
# leap
BuildRequires: gcc8-devel
###
BuildRequires: python-rpm-macros
BuildRequires: python3-Sphinx
%description
Plugins for embedding various versions of Python within GCC
%package -n gcc-python-plugin-c-api
Summary: Shared library to make it easier to write GCC plugins
Group: Development/Languages/Python
%description -n gcc-python-plugin-c-api
Shared library to make it easier to write GCC plugins
%package -n gcc-python2-plugin
Summary: GCC plugin embedding Python 2
Group: Development/Languages/Python
Requires: gcc-python-plugin-c-api = %{version}
Requires: python-Pygments
Requires: python-lxml
Requires: python-six
%description -n gcc-python2-plugin
GCC plugin embedding Python 2
%package -n gcc-python3-plugin
Summary: GCC plugin embedding Python 3
Group: Development/Languages/Python
Requires: gcc-python-plugin-c-api = %{version}
Requires: python3-Pygments
Requires: python3-lxml
Requires: python3-six
%description -n gcc-python3-plugin
GCC plugin embedding Python 3
%package docs
Summary: API documentation for the GCC Python plugin
Group: Documentation/HTML
%description docs
This package contains API documentation for the GCC Python plugin
%prep
%setup -q -T -c
tar xzf %{SOURCE0} --strip-components=1 %{name}-%{version}/docs %{name}-%{version}/examples %{name}-%{version}/COPYING %{name}-%{version}/README.rst
for flavor in python2 python3; do
mkdir %{name}-build.${flavor}
tar xzf %{SOURCE0} --strip-components=1 -C %{name}-build.${flavor}
pushd %{name}-build.${flavor}
patch --no-backup-if-mismatch -p1 --fuzz=0 < %{_topdir}/SOURCES/pretty_printer.patch
popd
done
%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
for flavor in python2 python3; do
pushd %{name}-build.${flavor}
make %{?_smp_mflags} \
PLUGIN_NAME=${flavor} \
PLUGIN_DSO=${flavor}.so \
PYTHON=$flavor \
PYTHON_CONFIG=${flavor}-config \
PLUGIN_PYTHONPATH=%{gcc_plugins_dir}/${flavor} \
plugin print-gcc-version
popd
done
# Documentation:
make %{?_smp_mflags} html -C docs
rm docs/_build/html/.buildinfo
%install
for flavor in python2 python3; do
pushd %{name}-build.${flavor}
make install \
DESTDIR=%{buildroot} \
PLUGIN_NAME=${flavor} \
PLUGIN_DSO=${flavor}.so
popd
done
%check
export LANG=en_US.UTF-8
for flavor in python2 python3; do
pushd %{name}-build.${flavor}
LD_LIBRARY_PATH=gcc-c-api \
PLUGIN_NAME=${flavor} \
${flavor} run-test-suite.py
LD_LIBRARY_PATH=gcc-c-api \
PLUGIN_NAME=${flavor} \
${flavor} testcpychecker.py -v
popd
done
%files -n gcc-python-plugin-c-api
%{gcc_plugins_dir}/libgcc-c-api.so
%files -n gcc-python2-plugin
%license COPYING
%doc README.rst
%{_bindir}/gcc-with-python2
%{gcc_plugins_dir}/python2.so
%{gcc_plugins_dir}/python2
%{_mandir}/man1/gcc-with-python2.1%{?ext_man}
%files -n gcc-python3-plugin
%license COPYING
%doc README.rst
%{_bindir}/gcc-with-python3
%{gcc_plugins_dir}/python3.so
%{gcc_plugins_dir}/python3
%{_mandir}/man1/gcc-with-python3.1%{?ext_man}
%files docs
%license COPYING
%doc docs/_build/html
# Example scripts:
%doc examples
%changelog