14
0
forked from pool/python-libcst

Accepting request 956487 from home:dspinella:branches:home:mcepl:branches:devel:languages:python

ok

OBS-URL: https://build.opensuse.org/request/show/956487
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-libcst?expand=0&rev=16
This commit is contained in:
2022-02-21 13:47:06 +00:00
committed by Git OBS Bridge
parent 1409b90fdf
commit 3dc919d44d
9 changed files with 208 additions and 39 deletions

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-libcst-test
# spec file
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,6 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
%define rustflags '-Clink-arg=-Wl,-z,relro,-z,now'
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
@@ -27,25 +28,33 @@
%bcond_with test
%endif
Name: python-libcst%{psuffix}
Version: 0.3.19
Version: 0.4.1
Release: 0
Summary: Python 3.5+ concrete syntax tree with AST-like properties
License: MIT
URL: https://github.com/Instagram/LibCST
Source: https://files.pythonhosted.org/packages/source/l/libcst/libcst-%{version}.tar.gz
Source0: LibCST-%{version}.tar.xz
Source1: vendor.tar.xz
Source2: cargo_config
# PATCH-FIX-UPSTREAM skip_failing_test.patch gh#Instagram/LibCST#442 mcepl@suse.com
# test fails on i586 with Python 3.6
Patch0: skip_failing_test.patch
# PATCH-FIX-UPSTREAM 650-sorting-in-test_ordering.patch gh#Instagram/LibCST#650 mcepl@suse.com
# Fix assumption about sorting in test_ordering
Patch1: 650-sorting-in-test_ordering.patch
BuildRequires: %{python_module setuptools-rust}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: cargo
BuildRequires: cargo-packaging
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: rust
Requires: python-PyYAML >= 5.2
Requires: python-typing-inspect >= 0.4.0
Requires: python-typing_extensions >= 3.7.4.2
BuildArch: noarch
%if %{python_version_nodots} < 37
Requires: python-dataclasses
%endif
Requires: (python-dataclasses if python-base < 3.7)
%if %{with test}
# black and isort needed for tests and the code regeneration
BuildRequires: %{python_module PyYAML >= 5.2}
@@ -63,7 +72,9 @@ BuildRequires: %{python_module typing_extensions >= 3.7.4.2}
A concrete syntax tree with AST-like properties for Python 3.5+ programs.
%prep
%setup -q -n libcst-%{version}
%setup -q -n LibCST-%{version}
tar x -C native/ -f %{SOURCE1}
(cd native ; mkdir -p .cargo ; cat %{SOURCE2} >>.cargo/config.toml)
%autopatch -p1
# wrong executable call when outside of venv (gh#Instagram/LibCST#468)
@@ -80,13 +91,23 @@ sed -i 's/import AbstractBaseMatcherNodeMeta/import Optional, AbstractBaseMatche
%if !%{with test}
%build
cd native
%{python_expand export PYO3_PYTHON=%{_bindir}/python%{$python_version}
%cargo_build
}
cd ..
%python_build
%endif
%install
%if !%{with test}
cd native
%{python_expand export PYO3_PYTHON=%{_bindir}/python%{$python_version}
%cargo_install
}
cd ..
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%endif
%if %{with test}
@@ -103,8 +124,8 @@ $python -m unittest -v
%files %{python_files}
%doc README.rst
%license LICENSE
%{python_sitelib}/libcst
%{python_sitelib}/libcst-%{version}-py*.egg-info
%{python_sitearch}/libcst
%{python_sitearch}/libcst-%{version}-py*.egg-info
%endif
%changelog