From 72de9c4e07c665a91fa588cf30a6e3e31f07d3c7a13dbe2b96ae4471930c8692 Mon Sep 17 00:00:00 2001 From: Todd R Date: Wed, 9 May 2018 18:36:47 +0000 Subject: [PATCH] Accepting request 605862 from devel:languages:python:misc Automatically make pyflakes-suggested changes OBS-URL: https://build.opensuse.org/request/show/605862 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-autoflake?expand=0&rev=1 --- .gitattributes | 23 ++++++++++ .gitignore | 1 + LICENSE | 19 ++++++++ autoflake-1.1.tar.gz | 3 ++ fix_standard_paths.patch | 41 +++++++++++++++++ python-autoflake.changes | 12 +++++ python-autoflake.spec | 97 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 196 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 autoflake-1.1.tar.gz create mode 100644 fix_standard_paths.patch create mode 100644 python-autoflake.changes create mode 100644 python-autoflake.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/LICENSE b/LICENSE new file mode 100644 index 0000000..6f1721c --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2012-2018 Steven Myint + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/autoflake-1.1.tar.gz b/autoflake-1.1.tar.gz new file mode 100644 index 0000000..5b21028 --- /dev/null +++ b/autoflake-1.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a74d684a7a02654f74582addc24a3016c06809316cc140457a4fe93a1e6ed131 +size 17242 diff --git a/fix_standard_paths.patch b/fix_standard_paths.patch new file mode 100644 index 0000000..921d673 --- /dev/null +++ b/fix_standard_paths.patch @@ -0,0 +1,41 @@ +From d1fe6ad670c890cce5cdbb430a438453da65f015 Mon Sep 17 00:00:00 2001 +From: toddrme2178 +Date: Tue, 13 Feb 2018 15:39:57 -0500 +Subject: [PATCH] standard_paths in plat_specific True and False + +Have `standard_paths` look in both platform-specific and platform-independent directories. Fixes issue #32. +--- + autoflake.py | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/autoflake.py b/autoflake.py +index 3918280..8d75dfb 100755 +--- a/autoflake.py ++++ b/autoflake.py +@@ -68,16 +68,18 @@ + + def standard_paths(): + """Yield paths to standard modules.""" +- path = distutils.sysconfig.get_python_lib(standard_lib=True) ++ for is_plat_spec in [True, False]: ++ path = distutils.sysconfig.get_python_lib(standard_lib=True, ++ plat_specific=is_plat_spec) + +- for name in os.listdir(path): +- yield name +- +- try: +- for name in os.listdir(os.path.join(path, 'lib-dynload')): ++ for name in os.listdir(path): + yield name +- except OSError: # pragma: no cover +- pass ++ ++ try: ++ for name in os.listdir(os.path.join(path, 'lib-dynload')): ++ yield name ++ except OSError: # pragma: no cover ++ pass + + + def standard_package_names(): diff --git a/python-autoflake.changes b/python-autoflake.changes new file mode 100644 index 0000000..a41b686 --- /dev/null +++ b/python-autoflake.changes @@ -0,0 +1,12 @@ +------------------------------------------------------------------- +Wed May 9 18:33:29 UTC 2018 - toddrme2178@gmail.com + +- Add license file +- Use license tag + +------------------------------------------------------------------- +Fri Oct 20 16:13:14 UTC 2017 - toddrme2178@gmail.com + +- initial version +- Add fix_standard_paths.patch + * Fix for https://github.com/myint/autoflake/issues/32 diff --git a/python-autoflake.spec b/python-autoflake.spec new file mode 100644 index 0000000..3f880b9 --- /dev/null +++ b/python-autoflake.spec @@ -0,0 +1,97 @@ +# +# spec file for package python-autoflake +# +# Copyright (c) 2018 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 http://bugs.opensuse.org/ + + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%bcond_without test +Name: python-autoflake +Version: 1.1 +# for license file +%define tag 44b07bb9dab60a74cb5da0b67cc78b734763785c +Release: 0 +License: MIT +Summary: Removes unused imports and unused variables +Url: https://github.com/myint/autoflake +Group: Development/Languages/Python +Source: https://files.pythonhosted.org/packages/source/a/autoflake/autoflake-%{version}.tar.gz +Source10: https://raw.githubusercontent.com/myint/autoflake/%{tag}/LICENSE +# PATCH-FIX-UPSTREAM fix_standard_paths.patch -- https://github.com/myint/autoflake/issues/32 +Patch0: fix_standard_paths.patch +BuildRequires: %pythons +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +%if %{with test} +BuildRequires: %{python_module coverage} +BuildRequires: %{python_module pyflakes >= 1.1.0} +%endif +Requires: python-pyflakes >= 1.1.0 +BuildArch: noarch +Requires(post): update-alternatives +Requires(postun): update-alternatives + +%python_subpackages + +%description +Autoflake removes unused imports and unused variables from Python +code. It makes use of pyflakes to do this. + +By default, autoflake only removes unused imports for modules that +are part of the standard library. (Other modules may have side +effects that make them unsafe to remove automatically.) Removal of +unused variables is also disabled by default. + +autoflake also removes useless pass statements. + +%prep +%setup -q -n autoflake-%{version} +cp %{SOURCE10} . +%patch0 -p1 +sed -i -e '/^#!\//, 1d' autoflake.py + +%build +%python_build + +%install +%python_install + +%{python_expand chmod a-x %{buildroot}%{$python_sitelib}/autoflake.py +%fdupes %{buildroot}%{$python_sitelib} +} + +%python_clone -a %{buildroot}%{_bindir}/autoflake + +%if %{with test} +%check +export $LANG=en_US.UTF-8 +%python_exec setup.py test +%endif + +%post +%python_install_alternative autoflake + +%postun +%python_uninstall_alternative autoflake + +%files %{python_files} +%defattr(-,root,root,-) +%doc AUTHORS.rst README.rst +%license LICENSE +%python_alternative %{_bindir}/autoflake +%{python_sitelib}/* + +%changelog