From 958485465e81784486ab5eeb7dca99ccc30e2643511843712c3be1d1f489d581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Sun, 16 Aug 2020 08:51:17 +0000 Subject: [PATCH] Accepting request 824924 from home:jayvdb:py-submit Dependency of https://build.opensuse.org/package/show/home:jayvdb:django/python-django-codemod OBS-URL: https://build.opensuse.org/request/show/824924 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-libcst?expand=0&rev=1 --- .gitattributes | 23 +++++++ .gitignore | 1 + codemod_formatter_error_input.py.txt | 15 +++++ libcst-0.3.9.tar.gz | 3 + python-libcst.changes | 30 +++++++++ python-libcst.spec | 93 ++++++++++++++++++++++++++++ 6 files changed, 165 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 codemod_formatter_error_input.py.txt create mode 100644 libcst-0.3.9.tar.gz create mode 100644 python-libcst.changes create mode 100644 python-libcst.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/codemod_formatter_error_input.py.txt b/codemod_formatter_error_input.py.txt new file mode 100644 index 0000000..58b6609 --- /dev/null +++ b/codemod_formatter_error_input.py.txt @@ -0,0 +1,15 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. +# +# pyre-strict + +import subprocess +from contextlib import AsyncExitStack + + +def fun() -> None: + # this is an explicit syntax error to cause formatter error + async with AsyncExitStack() as stack: + stack diff --git a/libcst-0.3.9.tar.gz b/libcst-0.3.9.tar.gz new file mode 100644 index 0000000..3b99603 --- /dev/null +++ b/libcst-0.3.9.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5185c84f0e4a38409aac59f53a71741bec8c1b1159c874996b3266daafe63e5 +size 393996 diff --git a/python-libcst.changes b/python-libcst.changes new file mode 100644 index 0000000..9c1a3e1 --- /dev/null +++ b/python-libcst.changes @@ -0,0 +1,30 @@ +------------------------------------------------------------------- +Sat Aug 8 04:41:45 UTC 2020 - John Vandenberg + +- Removed tests depending on optional dependency pyre +- Update to v0.3.9 + * Support string type annotations in RemoveUnusedImports + * Add scope to ImportAlias + * Add scope to ClassDef + * Fixed all pyre related errors + * Fixed enclosing attribute for attributes in call arguments + +------------------------------------------------------------------- +Thu Aug 6 09:47:23 UTC 2020 - Benjamin Greiner + +- Enhance codegen to support varied versions of isort +- Update to v0.3.8 + * Handle type subscripts when applying annotations + * Added FullRepoManager cache property + * Added optional args for tox commands + * Only remove trailing comma if the last alias is removed + * Fixed inserting imports after module docstring + * Fixed ParenthesizedWhitespace before params in FuncDef + * Fixed validation for ImportAlias and Try statements + * Fixed NotEqual position issue + * Fixed minor typo in scope_provider.py + +------------------------------------------------------------------- +Sat Jul 4 03:47:40 AM UTC 2020 - John Vandenberg + +- Initial spec for v0.3.7 diff --git a/python-libcst.spec b/python-libcst.spec new file mode 100644 index 0000000..69387d4 --- /dev/null +++ b/python-libcst.spec @@ -0,0 +1,93 @@ +# +# spec file for package python-libcst +# +# Copyright (c) 2020 SUSE LLC +# +# 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/ +# + + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +Name: python-libcst +Version: 0.3.9 +Release: 0 +Summary: Python 3.5+ concrete syntax tree with AST-like properties +License: MIT +Group: Development/Languages/Python +URL: https://github.com/Instagram/LibCST +Source: https://files.pythonhosted.org/packages/source/l/libcst/libcst-%{version}.tar.gz +Source1: https://raw.githubusercontent.com/Instagram/LibCST/master/libcst/codemod/tests/codemod_formatter_error_input.py.txt +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-PyYAML >= 5.2 +Requires: python-typing-inspect >= 0.4.0 +Requires: python-typing_extensions >= 3.7.4.2 +BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module PyYAML >= 5.2} +BuildRequires: %{python_module black} +BuildRequires: %{python_module hypothesis >= 4.36.0} +BuildRequires: %{python_module hypothesmith >= 0.0.4} +BuildRequires: %{python_module isort} +BuildRequires: %{python_module typing_extensions >= 3.7.4.2} +BuildRequires: %{python_module typing-inspect >= 0.4.0} +# /SECTION +%python_subpackages + +%description +A concrete syntax tree with AST-like properties for Python 3.5+ programs. + +%prep +%setup -q -n libcst-%{version} +cp %{SOURCE1} libcst/codemod/tests/ +sed -i 's/"python"/"python3"/' libcst/codemod/tests/test_codemod_cli.py +# https://github.com/Instagram/LibCST/issues/331 +[ isort --version | grep "VERSION 4" ] || sed -i 's/"isort", "-y"/"isort"/' libcst/codegen/generate.py + +# Depends on optional pyre +rm \ + libcst/metadata/tests/test_type_inference_provider.py \ + libcst/metadata/tests/test_full_repo_manager.py \ + libcst/tests/test_pyre_integration.py + +# Test result depends on pyre +sed -i 's/"error: .* stack:",/"Transformed 1 files successfully.",/' libcst/codemod/tests/test_codemod_cli.py + +%build +%python_build + +%install +%python_install +%{python_expand # https://github.com/Instagram/LibCST/issues/331 +export PYTHONPATH=%{buildroot}%{$python_sitelib} +$python -m libcst.codegen.generate visitors +$python -m libcst.codegen.generate return_types +$python -m libcst.codegen.generate matchers + +rm -r %{buildroot}%{$python_sitelib}/libcst/tests/ \ + %{buildroot}%{$python_sitelib}/libcst/*/tests/ \ + %{buildroot}%{$python_sitelib}/libcst/*/*/tests/ + +%fdupes %{buildroot}%{$python_sitelib} +} + +%check +%python_exec -m unittest -v + +%files %{python_files} +%doc README.rst +%license LICENSE +%{python_sitelib}/libcst +%{python_sitelib}/libcst-%{version}-py*.egg-info + +%changelog