14
0
forked from pool/python-libcst

- Remove 650-sorting-in-test_ordering.patch not needed anymore

- Add remove-ufmt-dep.patch, python-ufmt is not in tumbleweed
- Add replace-python-call.patch, wrong executable call when outside of venv
  (gh#Instagram/LibCST#468)
- Update to 0.4.9:
  - Bump setuptools-rust version by @zsol in #809
- 0.4.8
  - Fix parse error message for number parsing by @zzl0 in #724
  - Fix problematic doc build, due to the new builder image provided by
    readthedocs doesn't has the graphviz-dev package pre-installed any more by
    @MapleCCC in #751
  - Fix docstring of FullRepoManager by @MapleCCC in #750
  - Fix bug when TypeOf is one of options in OneOf / AllOf by @MapleCCC in #756
  - Tighten the metadata type of ExpressionContextProvider by @MapleCCC in #760
  - Fix the bug that the use of formatter in codemods has undetermined target
    Python version, resulting in hard-to-reason-with behavior by @MapleCCC in
    #771
  - Python 3.11 rutime support
    - test using python 3.11 beta versions by @zsol in #723
    - Python 3.11 wheels by @vfazio in #801
  - Raise informative exception when metadata is unresolved in a metadata-based
    match by @MapleCCC in #757
  - Add AccessorProvider by @matthewshaer in #807
- 0.4.7 - 2022-07-12
  - Fix get_qualified_names_for matching on prefixes of the given name by
    @lpetre in #719
  - Implement lazy loading mechanism for expensive metadata providers by
    @Chenguang-Zhu in #720
- 0.4.6 - 2022-07-04
  - convert_type_comments now preserves comments following type comments by

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-libcst?expand=0&rev=20
This commit is contained in:
2022-12-14 12:08:22 +00:00
committed by Git OBS Bridge
parent 0aae44e0a5
commit fc72ad8a58
11 changed files with 165 additions and 112 deletions

View File

@@ -16,7 +16,6 @@
#
%{?!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}
@@ -29,7 +28,7 @@
%endif
%define modname libcst
Name: python-libcst%{psuffix}
Version: 0.4.1
Version: 0.4.9
Release: 0
Summary: Python 3.5+ concrete syntax tree with AST-like properties
License: MIT
@@ -37,12 +36,11 @@ URL: https://github.com/Instagram/LibCST
Source0: https://files.pythonhosted.org/packages/source/l/%{modname}/%{modname}-%{version}.tar.gz
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
# PATCH-FIX-OPENSUSE remove-ufmt-dep.patch python-ufmt package doesn't exists in Tumbleweed
Patch0: remove-ufmt-dep.patch
# PATCH-FIX-OPENSUSE replace-python-call.patch
# wrong executable call when outside of venv (gh#Instagram/LibCST#468)
Patch1: replace-python-call.patch
BuildRequires: %{python_module setuptools-rust}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module setuptools}
@@ -75,12 +73,15 @@ A concrete syntax tree with AST-like properties for Python 3.5+ programs.
%prep
%setup -q -n libcst-%{version}
tar x -C native/ -f %{SOURCE1}
mkdir -p .cargo && cat %{SOURCE2} >>.cargo/config.toml
(cd native && mkdir -p .cargo && cat %{SOURCE2} >>.cargo/config.toml)
%autopatch -p1
cp -rf native/vendor vendor
mkdir -p .cargo && echo "" >> .cargo/config.toml && cat %{SOURCE2} >>.cargo/config.toml
# wrong executable call when outside of venv (gh#Instagram/LibCST#468)
sed -i 's/"python"/sys.executable/' libcst/codemod/tests/test_codemod_cli.py
pushd native
mkdir -p .cargo
cat %{SOURCE2} >>.cargo/config.toml
popd
%autopatch -p1
# Depends on optional pyre
rm \
@@ -93,23 +94,12 @@ 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 ..
export CARGO_NET_OFFLINE=true PROFILE=release
cargo metadata --offline --manifest-path native/libcst/Cargo.toml --format-version 1
%python_build
%endif
%install
%if !%{with test}
cd native
%{python_expand export PYO3_PYTHON=%{_bindir}/python%{$python_version}
%cargo_install
}
cd ..
export CARGO_NET_OFFLINE=true PROFILE=release
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}
@@ -117,6 +107,9 @@ export CARGO_NET_OFFLINE=true PROFILE=release
%if %{with test}
%check
# test_fuzz needs network access because of 'from hypothesmith import from_grammar'
rm libcst/tests/test_fuzz.py
%{python_exec # https://github.com/Instagram/LibCST/issues/331 + 467
$python -m libcst.codegen.generate matchers
$python -m libcst.codegen.generate return_types